mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: run rustfmt with custom defined fmt configuration (#1848)
* chore: update rustfmt * chore: apply rustfmt format
This commit is contained in:
@ -10,51 +10,53 @@ use flowy_user::entities::UserProfilePB;
|
||||
use nanoid::nanoid;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{event_builder::*, helper::*, *};
|
||||
pub use lib_dispatch::prelude::*;
|
||||
pub use crate::{event_builder::*, helper::*, *};
|
||||
pub use lib_dispatch::prelude::*;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FlowySDKTest {
|
||||
pub inner: AppFlowyCore,
|
||||
pub inner: AppFlowyCore,
|
||||
}
|
||||
|
||||
impl std::ops::Deref for FlowySDKTest {
|
||||
type Target = AppFlowyCore;
|
||||
type Target = AppFlowyCore;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl std::default::Default for FlowySDKTest {
|
||||
fn default() -> Self {
|
||||
Self::new(DocumentVersionPB::V0)
|
||||
}
|
||||
fn default() -> Self {
|
||||
Self::new(DocumentVersionPB::V0)
|
||||
}
|
||||
}
|
||||
|
||||
impl FlowySDKTest {
|
||||
pub fn new(document_version: DocumentVersionPB) -> Self {
|
||||
let server_config = get_client_server_configuration().unwrap();
|
||||
let config = AppFlowyCoreConfig::new(&root_dir(), nanoid!(6), server_config)
|
||||
.with_document_version(document_version)
|
||||
.log_filter("info", vec![]);
|
||||
let sdk = std::thread::spawn(|| AppFlowyCore::new(config)).join().unwrap();
|
||||
std::mem::forget(sdk.dispatcher());
|
||||
Self { inner: sdk }
|
||||
}
|
||||
pub fn new(document_version: DocumentVersionPB) -> Self {
|
||||
let server_config = get_client_server_configuration().unwrap();
|
||||
let config = AppFlowyCoreConfig::new(&root_dir(), nanoid!(6), server_config)
|
||||
.with_document_version(document_version)
|
||||
.log_filter("info", vec![]);
|
||||
let sdk = std::thread::spawn(|| AppFlowyCore::new(config))
|
||||
.join()
|
||||
.unwrap();
|
||||
std::mem::forget(sdk.dispatcher());
|
||||
Self { inner: sdk }
|
||||
}
|
||||
|
||||
pub async fn sign_up(&self) -> SignUpContext {
|
||||
async_sign_up(self.inner.dispatcher()).await
|
||||
}
|
||||
pub async fn sign_up(&self) -> SignUpContext {
|
||||
async_sign_up(self.inner.dispatcher()).await
|
||||
}
|
||||
|
||||
pub async fn init_user(&self) -> UserProfilePB {
|
||||
let context = async_sign_up(self.inner.dispatcher()).await;
|
||||
init_user_setting(self.inner.dispatcher()).await;
|
||||
context.user_profile
|
||||
}
|
||||
pub async fn init_user(&self) -> UserProfilePB {
|
||||
let context = async_sign_up(self.inner.dispatcher()).await;
|
||||
init_user_setting(self.inner.dispatcher()).await;
|
||||
context.user_profile
|
||||
}
|
||||
|
||||
pub fn document_version(&self) -> DocumentVersionPB {
|
||||
self.inner.config.document.version.clone()
|
||||
}
|
||||
pub fn document_version(&self) -> DocumentVersionPB {
|
||||
self.inner.config.document.version.clone()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user