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) {
Log.error('Failed to open uri: $e');
} finally {
result = false;
return false;
}
// 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');
_completer?.complete(FlowyResult.failure(AuthError.emptyDeepLink));
_completer = null;
return;
}
return _isAuthCallbackDeepLink(uri!).fold(
return _isAuthCallbackDeepLink(uri).fold(
(_) async {
final deviceId = await getDeviceId();
final payload = OauthSignInPB(
@ -101,8 +103,7 @@ class AppFlowyCloudDeepLink {
},
);
_stateNotifier?.value = DeepLinkResult(state: DeepLinkState.loading);
final result =
await UserEventOauthSignIn(payload).send().then((value) => value);
final result = await UserEventOauthSignIn(payload).send();
_stateNotifier?.value = DeepLinkResult(
state: DeepLinkState.finish,

View File

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

View File

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