mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Fix: init state (#4672)
* chore: fix login state * chore: change log * chore: fix flutter version
This commit is contained in:
parent
d5ee372131
commit
b2e55c4e2e
@ -1,4 +1,8 @@
|
|||||||
# Release Notes
|
# Release Notes
|
||||||
|
## Version 0.4.9 - 02/17/2024
|
||||||
|
### Bug Fixes
|
||||||
|
- Resolved the issue that caused users to be redirected to the Sign In page
|
||||||
|
-
|
||||||
## Version 0.4.8 - 02/13/2024
|
## Version 0.4.8 - 02/13/2024
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
- Fixed a possible error when loading workspaces
|
- Fixed a possible error when loading workspaces
|
||||||
|
@ -26,7 +26,7 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
|||||||
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
|
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
|
||||||
CARGO_MAKE_CRATE_NAME = "dart-ffi"
|
CARGO_MAKE_CRATE_NAME = "dart-ffi"
|
||||||
LIB_NAME = "dart_ffi"
|
LIB_NAME = "dart_ffi"
|
||||||
APPFLOWY_VERSION = "0.4.8"
|
APPFLOWY_VERSION = "0.4.9"
|
||||||
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite"
|
||||||
PRODUCT_NAME = "AppFlowy"
|
PRODUCT_NAME = "AppFlowy"
|
||||||
MACOSX_DEPLOYMENT_TARGET = "11.0"
|
MACOSX_DEPLOYMENT_TARGET = "11.0"
|
||||||
|
@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 0.4.8
|
version: 0.4.9
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
flutter: ">=3.18.0-0.2.pre"
|
flutter: ">=3.18.0-0.2.pre"
|
||||||
|
@ -110,7 +110,7 @@ impl AppFlowyServer for AppFlowyCloudServer {
|
|||||||
|
|
||||||
fn subscribe_token_state(&self) -> Option<WatchStream<UserTokenState>> {
|
fn subscribe_token_state(&self) -> Option<WatchStream<UserTokenState>> {
|
||||||
let mut token_state_rx = self.client.subscribe_token_state();
|
let mut token_state_rx = self.client.subscribe_token_state();
|
||||||
let (watch_tx, watch_rx) = watch::channel(UserTokenState::Invalid);
|
let (watch_tx, watch_rx) = watch::channel(UserTokenState::Init);
|
||||||
let weak_client = Arc::downgrade(&self.client);
|
let weak_client = Arc::downgrade(&self.client);
|
||||||
af_spawn(async move {
|
af_spawn(async move {
|
||||||
while let Ok(token_state) = token_state_rx.recv().await {
|
while let Ok(token_state) = token_state_rx.recv().await {
|
||||||
@ -265,7 +265,7 @@ fn spawn_ws_conn(
|
|||||||
event!(tracing::Level::INFO, "🟢reconnecting websocket");
|
event!(tracing::Level::INFO, "🟢reconnecting websocket");
|
||||||
let _ = ws_client.connect(ws_addr, &cloned_device_id).await;
|
let _ = ws_client.connect(ws_addr, &cloned_device_id).await;
|
||||||
},
|
},
|
||||||
Err(err) => error!("Failed to get ws url: {}", err),
|
Err(err) => error!("Failed to get ws url: {}, connect state:{:?}", err, state),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,6 +288,7 @@ fn spawn_ws_conn(
|
|||||||
let weak_api_client = Arc::downgrade(api_client);
|
let weak_api_client = Arc::downgrade(api_client);
|
||||||
af_spawn(async move {
|
af_spawn(async move {
|
||||||
while let Ok(token_state) = token_state_rx.recv().await {
|
while let Ok(token_state) = token_state_rx.recv().await {
|
||||||
|
info!("🟢token state: {:?}", token_state);
|
||||||
match token_state {
|
match token_state {
|
||||||
TokenState::Refresh => {
|
TokenState::Refresh => {
|
||||||
if let (Some(api_client), Some(ws_client)) =
|
if let (Some(api_client), Some(ws_client)) =
|
||||||
@ -295,7 +296,6 @@ fn spawn_ws_conn(
|
|||||||
{
|
{
|
||||||
match api_client.ws_url(&device_id).await {
|
match api_client.ws_url(&device_id).await {
|
||||||
Ok(ws_addr) => {
|
Ok(ws_addr) => {
|
||||||
info!("🟢token state: {:?}, reconnecting websocket", token_state);
|
|
||||||
let _ = ws_client.connect(ws_addr, &device_id).await;
|
let _ = ws_client.connect(ws_addr, &device_id).await;
|
||||||
},
|
},
|
||||||
Err(err) => error!("Failed to get ws url: {}", err),
|
Err(err) => error!("Failed to get ws url: {}", err),
|
||||||
|
@ -375,6 +375,7 @@ pub struct AFCloudOAuthParams {
|
|||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum UserTokenState {
|
pub enum UserTokenState {
|
||||||
|
Init,
|
||||||
Refresh { token: String },
|
Refresh { token: String },
|
||||||
Invalid,
|
Invalid,
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,8 @@ impl UserManager {
|
|||||||
{
|
{
|
||||||
error!("Sign out when token invalid failed: {:?}", err);
|
error!("Sign out when token invalid failed: {:?}", err);
|
||||||
}
|
}
|
||||||
// Force user to sign out when the token is invalid
|
|
||||||
},
|
},
|
||||||
|
UserTokenState::Init => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user