fix: 修复 Auth User 的状态问题, 返回正确的任务状态

deeplink
胡宇飞 2024-04-01 12:33:29 +08:00
parent ba059e9995
commit de58e5f6dd
1 changed files with 9 additions and 3 deletions

View File

@ -32,17 +32,23 @@ namespace Guru
FirebaseAuth.DefaultInstance.SignInWithCustomTokenAsync(authToken) FirebaseAuth.DefaultInstance.SignInWithCustomTokenAsync(authToken)
.ContinueWithOnMainThread(task => .ContinueWithOnMainThread(task =>
{ {
// ----- Task failed -----
if (task.IsCanceled || task.IsFaulted) if (task.IsCanceled || task.IsFaulted)
{ {
Log.E(LOG_TAG,"[Auth] SignInWithCustomTokenAsync encountered an error: " + task.Exception); Log.E(LOG_TAG,"[Auth] SignInWithCustomTokenAsync encountered an error: " + task.Exception);
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
OnFirebaseAuthResult?.Invoke(false); OnFirebaseAuthResult?.Invoke(false);
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
return;
} }
else if (CurrentUser == null) // ----- User is NULL -----
if (CurrentUser == null)
{ {
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
OnFirebaseAuthResult?.Invoke(false); OnFirebaseAuthResult?.Invoke(false);
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
return;
} }
// ----- Success -----
OnFirebaseAuthResult?.Invoke(true); // 最后判定是成功的
}); });
} }
} }