fix: sign in toast issue (#4895)

This commit is contained in:
Lucas.Xu 2024-03-14 09:17:59 +08:00 committed by GitHub
parent b57a870242
commit 80e210b34a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View File

@ -27,8 +27,7 @@ Future<bool> afLaunchUrl(
); );
} on PlatformException catch (e) { } on PlatformException catch (e) {
Log.error('Failed to open uri: $e'); Log.error('Failed to open uri: $e');
} finally { return false;
result = false;
} }
// if the uri is not a valid url, try to launch it with http scheme // if the uri is not a valid url, try to launch it with http scheme

View File

@ -89,8 +89,10 @@ class AppFlowyCloudDeepLink {
Log.error('onDeepLinkError: Unexpected empty deep link callback'); Log.error('onDeepLinkError: Unexpected empty deep link callback');
_completer?.complete(FlowyResult.failure(AuthError.emptyDeepLink)); _completer?.complete(FlowyResult.failure(AuthError.emptyDeepLink));
_completer = null; _completer = null;
return;
} }
return _isAuthCallbackDeepLink(uri!).fold(
return _isAuthCallbackDeepLink(uri).fold(
(_) async { (_) async {
final deviceId = await getDeviceId(); final deviceId = await getDeviceId();
final payload = OauthSignInPB( final payload = OauthSignInPB(
@ -101,8 +103,7 @@ class AppFlowyCloudDeepLink {
}, },
); );
_stateNotifier?.value = DeepLinkResult(state: DeepLinkState.loading); _stateNotifier?.value = DeepLinkResult(state: DeepLinkState.loading);
final result = final result = await UserEventOauthSignIn(payload).send();
await UserEventOauthSignIn(payload).send().then((value) => value);
_stateNotifier?.value = DeepLinkResult( _stateNotifier?.value = DeepLinkResult(
state: DeepLinkState.finish, state: DeepLinkState.finish,

View File

@ -72,8 +72,9 @@ class AppFlowyCloudAuthService implements AuthService {
throw Exception('AppFlowyCloudDeepLink is not registered'); throw Exception('AppFlowyCloudDeepLink is not registered');
} }
} else { } else {
completer completer.complete(
.complete(FlowyResult.failure(AuthError.signInWithOauthError)); FlowyResult.failure(AuthError.unableToGetDeepLink),
);
} }
return completer.future; return completer.future;

View File

@ -29,4 +29,8 @@ class AuthError {
static final deepLinkError = FlowyError() static final deepLinkError = FlowyError()
..msg = 'DeepLink error' ..msg = 'DeepLink error'
..code = ErrorCode.Internal; ..code = ErrorCode.Internal;
static final unableToGetDeepLink = FlowyError()
..msg = 'Unable to get the deep link'
..code = ErrorCode.Internal;
} }