fix: push to sign in screen when logout (#3127)

* fix: push to sign in screen when logout

* chore: show historical login users

* chore: open historical user

* chore: show historical user

* chore: reload app widget with unique key

* chore: add tooltip for user history
This commit is contained in:
Nathan.fooo
2023-08-07 22:24:04 +08:00
committed by GitHub
parent a3bea472bf
commit 3c04b72932
35 changed files with 528 additions and 123 deletions

View File

@ -6,6 +6,7 @@ use parking_lot::Mutex;
use flowy_user_deps::cloud::UserService;
use flowy_user_deps::entities::*;
use flowy_user_deps::DEFAULT_USER_NAME;
use lib_infra::box_any::BoxAny;
use lib_infra::future::FutureResult;
@ -28,9 +29,14 @@ impl UserService for LocalServerUserAuthServiceImpl {
let uid = ID_GEN.lock().next_id();
let workspace_id = uuid::Uuid::new_v4().to_string();
let user_workspace = UserWorkspace::new(&workspace_id, uid);
let user_name = if params.name.is_empty() {
DEFAULT_USER_NAME()
} else {
params.name.clone()
};
Ok(SignUpResponse {
user_id: uid,
name: params.name,
name: user_name,
latest_workspace: user_workspace.clone(),
user_workspaces: vec![user_workspace],
is_new: true,

View File

@ -102,11 +102,14 @@ where
_id: MsgId,
update: Vec<u8>,
) -> Result<(), Error> {
let postgrest = self.0.try_get_postgrest()?;
let workspace_id = object
.get_workspace_id()
.ok_or(anyhow::anyhow!("Invalid workspace id"))?;
send_update(workspace_id, object, update, &postgrest).await
if let Some(postgrest) = self.0.get_postgrest() {
let workspace_id = object
.get_workspace_id()
.ok_or(anyhow::anyhow!("Invalid workspace id"))?;
send_update(workspace_id, object, update, &postgrest).await?;
}
Ok(())
}
async fn send_init_sync(

View File

@ -68,8 +68,8 @@ impl SupabaseServerService for SupabaseServerServiceImpl {
.map(|server| server.postgrest.clone())
.ok_or_else(|| {
FlowyError::new(
ErrorCode::SupabaseSyncRequired,
"Supabase sync is disabled, please enable it first",
ErrorCode::DataSyncRequired,
"Data Sync is disabled, please enable it first",
)
.into()
})

View File

@ -6,6 +6,7 @@ use uuid::Uuid;
use flowy_user_deps::cloud::*;
use flowy_user_deps::entities::*;
use flowy_user_deps::DEFAULT_USER_NAME;
use lib_infra::box_any::BoxAny;
use lib_infra::future::FutureResult;
@ -74,9 +75,15 @@ where
.find(|user_workspace| user_workspace.id == user_profile.latest_workspace_id)
.cloned();
let user_name = if user_profile.name.is_empty() {
DEFAULT_USER_NAME()
} else {
user_profile.name
};
Ok(SignUpResponse {
user_id: user_profile.uid,
name: user_profile.name,
name: user_name,
latest_workspace: latest_workspace.unwrap(),
user_workspaces,
is_new: is_new_user,
@ -100,9 +107,10 @@ where
.iter()
.find(|user_workspace| user_workspace.id == user_profile.latest_workspace_id)
.cloned();
Ok(SignInResponse {
user_id: user_profile.uid,
name: "".to_string(),
name: DEFAULT_USER_NAME(),
latest_workspace: latest_workspace.unwrap(),
user_workspaces,
email: None,