diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs index 1700194..ef2b31c 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs @@ -32,17 +32,23 @@ namespace Guru FirebaseAuth.DefaultInstance.SignInWithCustomTokenAsync(authToken) .ContinueWithOnMainThread(task => { + // ----- Task failed ----- if (task.IsCanceled || task.IsFaulted) { Log.E(LOG_TAG,"[Auth] SignInWithCustomTokenAsync encountered an error: " + task.Exception); - CoroutineHelper.Instance.StartDelayed(_wait, AuthUser); 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); + CoroutineHelper.Instance.StartDelayed(_wait, AuthUser); + return; } + // ----- Success ----- + OnFirebaseAuthResult?.Invoke(true); // 最后判定是成功的 }); } }