update: 更新 Banner 背景, 更新 Firebase 回调

deeplink
胡宇飞 2024-03-31 17:16:45 +08:00
parent 97d472beaa
commit e4ce0fb408
3 changed files with 24 additions and 2 deletions

View File

@ -268,6 +268,15 @@ namespace Guru
MaxSdk.HideBanner(GetBannerID()); MaxSdk.HideBanner(GetBannerID());
} }
/// <summary>
/// 设置 Banner 背景颜色
/// </summary>
/// <param name="color"></param>
public virtual void SetBannerBackgroundColor(Color color)
{
_backColor = color;
}
private void OnBannerLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) private void OnBannerLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{ {
// Analytics.ADBadsLoaded(adUnitId, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory); // Analytics.ADBadsLoaded(adUnitId, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory);

View File

@ -15,15 +15,17 @@ namespace Guru
//FirebaseAuth获取用户验证并同步用户数据 //FirebaseAuth获取用户验证并同步用户数据
if (CurrentUser != null) if (CurrentUser != null)
{ {
Log.I(LOG_TAG, "[Auth]之前验证没过期CurrentUser: " + CurrentUser.UserId); Log.I(LOG_TAG, $"[Auth] user existsUserId:{CurrentUser.UserId}");
OnFirebaseAuthResult?.Invoke(true);
return; return;
} }
string authToken = IPMConfig.IPM_FIREBASE_TOKEN; string authToken = IPMConfig.IPM_FIREBASE_TOKEN;
Log.I(LOG_TAG, $"[Auth]AuthToken:{authToken}"); Log.I(LOG_TAG, $"[Auth] Firebase Token:{authToken}");
if (string.IsNullOrEmpty(authToken) || !NetworkUtil.IsNetAvaliable) if (string.IsNullOrEmpty(authToken) || !NetworkUtil.IsNetAvaliable)
{ {
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser); CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
OnFirebaseAuthResult?.Invoke(false);
return; return;
} }
@ -34,10 +36,12 @@ namespace Guru
{ {
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); CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
OnFirebaseAuthResult?.Invoke(false);
} }
else if (CurrentUser == null) else if (CurrentUser == null)
{ {
CoroutineHelper.Instance.StartDelayed(_wait, AuthUser); CoroutineHelper.Instance.StartDelayed(_wait, AuthUser);
OnFirebaseAuthResult?.Invoke(false);
} }
}); });
} }

View File

@ -16,6 +16,11 @@ namespace Guru
public static DependencyStatus DependencyStatus = DependencyStatus.UnavailableOther; public static DependencyStatus DependencyStatus = DependencyStatus.UnavailableOther;
public static bool IsFirebaseInitialized => DependencyStatus == DependencyStatus.Available; public static bool IsFirebaseInitialized => DependencyStatus == DependencyStatus.Available;
public static Action<bool> onInitComplete; public static Action<bool> onInitComplete;
public static Action<bool> OnFirebaseAuthResult;
public static Action<bool> OnUserAuthResult;
public static void InitFirebase(Action callback, bool isDebug = false) public static void InitFirebase(Action callback, bool isDebug = false)
{ {
@ -53,8 +58,12 @@ namespace Guru
.SetRetryTimes(-1) .SetRetryTimes(-1)
.SetSuccessCallBack(() => .SetSuccessCallBack(() =>
{ {
OnUserAuthResult?.Invoke(true);
InitializeMessage(); InitializeMessage();
AuthUser(); AuthUser();
}).SetFailCallBack(() =>
{
OnUserAuthResult?.Invoke(false);
}) })
.Send(); .Send();
} }