From de58e5f6dd7ad416daa65f082d8998d48847c552 Mon Sep 17 00:00:00 2001 From: huyufei Date: Mon, 1 Apr 2024 12:33:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Auth=20User=20=20?= =?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98,=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=AD=A3=E7=A1=AE=E7=9A=84=E4=BB=BB=E5=8A=A1=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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); // 最后判定是成功的 }); } }