Skip to content

Commit

Permalink
Fix: init state (#4672)
Browse files Browse the repository at this point in the history
* chore: fix login state

* chore: change log

* chore: fix flutter version
  • Loading branch information
appflowy authored Feb 18, 2024
1 parent d5ee372 commit b2e55c4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 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
### Bug Fixes
- Fixed a possible error when loading workspaces
Expand Down
2 changes: 1 addition & 1 deletion frontend/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi"
LIB_NAME = "dart_ffi"
APPFLOWY_VERSION = "0.4.8"
APPFLOWY_VERSION = "0.4.9"
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite"
PRODUCT_NAME = "AppFlowy"
MACOSX_DEPLOYMENT_TARGET = "11.0"
Expand Down
2 changes: 1 addition & 1 deletion frontend/appflowy_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.4.8
version: 0.4.9

environment:
flutter: ">=3.18.0-0.2.pre"
Expand Down
6 changes: 3 additions & 3 deletions frontend/rust-lib/flowy-server/src/af_cloud/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl AppFlowyServer for AppFlowyCloudServer {

fn subscribe_token_state(&self) -> Option<WatchStream<UserTokenState>> {
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);
af_spawn(async move {
while let Ok(token_state) = token_state_rx.recv().await {
Expand Down Expand Up @@ -265,7 +265,7 @@ fn spawn_ws_conn(
event!(tracing::Level::INFO, "🟢reconnecting websocket");
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),
}
}
}
Expand All @@ -288,14 +288,14 @@ fn spawn_ws_conn(
let weak_api_client = Arc::downgrade(api_client);
af_spawn(async move {
while let Ok(token_state) = token_state_rx.recv().await {
info!("🟢token state: {:?}", token_state);
match token_state {
TokenState::Refresh => {
if let (Some(api_client), Some(ws_client)) =
(weak_api_client.upgrade(), weak_ws_client.upgrade())
{
match api_client.ws_url(&device_id).await {
Ok(ws_addr) => {
info!("🟢token state: {:?}, reconnecting websocket", token_state);
let _ = ws_client.connect(ws_addr, &device_id).await;
},
Err(err) => error!("Failed to get ws url: {}", err),
Expand Down
1 change: 1 addition & 0 deletions frontend/rust-lib/flowy-user-pub/src/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ pub struct AFCloudOAuthParams {

#[derive(Clone, Debug)]
pub enum UserTokenState {
Init,
Refresh { token: String },
Invalid,
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/rust-lib/flowy-user/src/user_manager/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ impl UserManager {
{
error!("Sign out when token invalid failed: {:?}", err);
}
// Force user to sign out when the token is invalid
},
UserTokenState::Init => {},
}
}
});
Expand Down

0 comments on commit b2e55c4

Please sign in to comment.