update: deeplink 接口代码 Review
--story=1021116 --user=yufei.hu 【中台】【SDK】新增 Adjust Deeplink 接口 https://www.tapd.cn/33527076/s/1160715dev
parent
ecf615598c
commit
4da06c8f96
|
|
@ -18,13 +18,14 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class App
|
public static class App
|
||||||
{
|
{
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onAppPaused;
|
internal static Action<bool> _onAppPaused;
|
||||||
public static event Action<bool> OnAppPaused
|
public static event Action<bool> OnAppPaused
|
||||||
{
|
{
|
||||||
add => _onAppPaused += value;
|
add => _onAppPaused += value;
|
||||||
remove => _onAppPaused -= value;
|
remove => _onAppPaused -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onAppQuit;
|
internal static Action _onAppQuit;
|
||||||
public static event Action OnAppQuit
|
public static event Action OnAppQuit
|
||||||
{
|
{
|
||||||
|
|
@ -47,6 +48,7 @@ namespace Guru
|
||||||
add => _onConsentResult += value;
|
add => _onConsentResult += value;
|
||||||
remove => _onConsentResult -= value;
|
remove => _onConsentResult -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<int> _onConsentResult;
|
internal static Action<int> _onConsentResult;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -57,6 +59,7 @@ namespace Guru
|
||||||
add => _onAttResult += value;
|
add => _onAttResult += value;
|
||||||
remove => _onAttResult -= value;
|
remove => _onAttResult -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<int> _onAttResult;
|
internal static Action<int> _onAttResult;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +69,7 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Ads
|
public static class Ads
|
||||||
{
|
{
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onAdsInitComplete;
|
internal static Action _onAdsInitComplete;
|
||||||
public static event Action OnAdsInitComplete
|
public static event Action OnAdsInitComplete
|
||||||
{
|
{
|
||||||
|
|
@ -73,6 +77,7 @@ namespace Guru
|
||||||
remove => _onAdsInitComplete -= value;
|
remove => _onAdsInitComplete -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
//------------ BANNER -----------------
|
//------------ BANNER -----------------
|
||||||
internal static Action<string> _onBannerADStartLoad;
|
internal static Action<string> _onBannerADStartLoad;
|
||||||
public static event Action<string> OnBannerADStartLoad
|
public static event Action<string> OnBannerADStartLoad
|
||||||
|
|
@ -80,7 +85,7 @@ namespace Guru
|
||||||
add => _onBannerADStartLoad += value;
|
add => _onBannerADStartLoad += value;
|
||||||
remove => _onBannerADStartLoad -= value;
|
remove => _onBannerADStartLoad -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onBannerADLoaded;
|
internal static Action _onBannerADLoaded;
|
||||||
public static event Action OnBannerADLoaded
|
public static event Action OnBannerADLoaded
|
||||||
{
|
{
|
||||||
|
|
@ -89,27 +94,28 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------ INTER -----------------
|
//------------ INTER -----------------
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<string> _onInterstitialADStartLoad;
|
internal static Action<string> _onInterstitialADStartLoad;
|
||||||
public static event Action<string> OnInterstitialADStartLoad
|
public static event Action<string> OnInterstitialADStartLoad
|
||||||
{
|
{
|
||||||
add => _onInterstitialADStartLoad += value;
|
add => _onInterstitialADStartLoad += value;
|
||||||
remove => _onInterstitialADStartLoad -= value;
|
remove => _onInterstitialADStartLoad -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onInterstitialADLoaded;
|
internal static Action _onInterstitialADLoaded;
|
||||||
public static event Action OnInterstitialADLoaded
|
public static event Action OnInterstitialADLoaded
|
||||||
{
|
{
|
||||||
add => _onInterstitialADLoaded += value;
|
add => _onInterstitialADLoaded += value;
|
||||||
remove => _onInterstitialADLoaded -= value;
|
remove => _onInterstitialADLoaded -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onInterstitialADFailed;
|
internal static Action _onInterstitialADFailed;
|
||||||
public static event Action OnInterstitialADFailed
|
public static event Action OnInterstitialADFailed
|
||||||
{
|
{
|
||||||
add => _onInterstitialADFailed += value;
|
add => _onInterstitialADFailed += value;
|
||||||
remove => _onInterstitialADFailed -= value;
|
remove => _onInterstitialADFailed -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onInterstitialADClosed;
|
internal static Action _onInterstitialADClosed;
|
||||||
public static event Action OnInterstitialADClosed
|
public static event Action OnInterstitialADClosed
|
||||||
{
|
{
|
||||||
|
|
@ -118,27 +124,28 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------ REWARD -----------------
|
//------------ REWARD -----------------
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<string> _onRewardedADStartLoad;
|
internal static Action<string> _onRewardedADStartLoad;
|
||||||
public static event Action<string> OnRewardedADStartLoad
|
public static event Action<string> OnRewardedADStartLoad
|
||||||
{
|
{
|
||||||
add => _onRewardedADStartLoad += value;
|
add => _onRewardedADStartLoad += value;
|
||||||
remove => _onRewardedADStartLoad -= value;
|
remove => _onRewardedADStartLoad -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onRewardedADLoaded;
|
internal static Action _onRewardedADLoaded;
|
||||||
public static event Action OnRewardedADLoaded
|
public static event Action OnRewardedADLoaded
|
||||||
{
|
{
|
||||||
add => _onRewardedADLoaded += value;
|
add => _onRewardedADLoaded += value;
|
||||||
remove => _onRewardedADLoaded -= value;
|
remove => _onRewardedADLoaded -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onRewardADClosed;
|
internal static Action _onRewardADClosed;
|
||||||
public static event Action OnRewardedADClosed
|
public static event Action OnRewardedADClosed
|
||||||
{
|
{
|
||||||
add => _onRewardADClosed += value;
|
add => _onRewardADClosed += value;
|
||||||
remove => _onRewardADClosed -= value;
|
remove => _onRewardADClosed -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onRewardADFailed;
|
internal static Action _onRewardADFailed;
|
||||||
public static event Action OnRewardADFailed
|
public static event Action OnRewardADFailed
|
||||||
{
|
{
|
||||||
|
|
@ -152,6 +159,7 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Remote
|
public static class Remote
|
||||||
{
|
{
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onRemoteFetchComplete;
|
internal static Action<bool> _onRemoteFetchComplete;
|
||||||
public static event Action<bool> OnRemoteFetchComplete
|
public static event Action<bool> OnRemoteFetchComplete
|
||||||
{
|
{
|
||||||
|
|
@ -165,41 +173,42 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class IAP
|
public static class IAP
|
||||||
{
|
{
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onIAPInitStart;
|
internal static Action _onIAPInitStart;
|
||||||
public static event Action OnIAPInitStart
|
public static event Action OnIAPInitStart
|
||||||
{
|
{
|
||||||
add => _onIAPInitStart += value;
|
add => _onIAPInitStart += value;
|
||||||
remove => _onIAPInitStart -= value;
|
remove => _onIAPInitStart -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onIAPInitComplete;
|
internal static Action<bool> _onIAPInitComplete;
|
||||||
public static event Action<bool> OnIAPInitComplete
|
public static event Action<bool> OnIAPInitComplete
|
||||||
{
|
{
|
||||||
add => _onIAPInitComplete += value;
|
add => _onIAPInitComplete += value;
|
||||||
remove => _onIAPInitComplete -= value;
|
remove => _onIAPInitComplete -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<string> _onPurchaseStart;
|
internal static Action<string> _onPurchaseStart;
|
||||||
public static event Action<string> OnPurchaseStart
|
public static event Action<string> OnPurchaseStart
|
||||||
{
|
{
|
||||||
add => _onPurchaseStart += value;
|
add => _onPurchaseStart += value;
|
||||||
remove => _onPurchaseStart -= value;
|
remove => _onPurchaseStart -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<string, bool> _onPurchaseEnd;
|
internal static Action<string, bool> _onPurchaseEnd;
|
||||||
public static event Action<string, bool> OnPurchaseEnd
|
public static event Action<string, bool> OnPurchaseEnd
|
||||||
{
|
{
|
||||||
add => _onPurchaseEnd += value;
|
add => _onPurchaseEnd += value;
|
||||||
remove => _onPurchaseEnd -= value;
|
remove => _onPurchaseEnd -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<string, string> _onPurchaseFailed;
|
internal static Action<string, string> _onPurchaseFailed;
|
||||||
public static event Action<string, string> OnPurchaseFailed
|
public static event Action<string, string> OnPurchaseFailed
|
||||||
{
|
{
|
||||||
add => _onPurchaseFailed += value;
|
add => _onPurchaseFailed += value;
|
||||||
remove => _onPurchaseFailed -= value;
|
remove => _onPurchaseFailed -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool, string> _onIAPRestored;
|
internal static Action<bool, string> _onIAPRestored;
|
||||||
public static event Action<bool, string> OnIAPRestored
|
public static event Action<bool, string> OnIAPRestored
|
||||||
{
|
{
|
||||||
|
|
@ -213,34 +222,35 @@ namespace Guru
|
||||||
|
|
||||||
public static class SDK
|
public static class SDK
|
||||||
{
|
{
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onFirebaseReady;
|
internal static Action<bool> _onFirebaseReady;
|
||||||
public static event Action<bool> OnFirebaseReady
|
public static event Action<bool> OnFirebaseReady
|
||||||
{
|
{
|
||||||
add => _onFirebaseReady += value;
|
add => _onFirebaseReady += value;
|
||||||
remove => _onFirebaseReady -= value;
|
remove => _onFirebaseReady -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action _onGuruServiceReady;
|
internal static Action _onGuruServiceReady;
|
||||||
public static event Action OnGuruServiceReady
|
public static event Action OnGuruServiceReady
|
||||||
{
|
{
|
||||||
add => _onGuruServiceReady += value;
|
add => _onGuruServiceReady += value;
|
||||||
remove => _onGuruServiceReady -= value;
|
remove => _onGuruServiceReady -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onDebuggerDisplayed;
|
internal static Action<bool> _onDebuggerDisplayed;
|
||||||
public static event Action<bool> OnDisplayDebugger
|
public static event Action<bool> OnDisplayDebugger
|
||||||
{
|
{
|
||||||
add => _onDebuggerDisplayed += value;
|
add => _onDebuggerDisplayed += value;
|
||||||
remove => _onDebuggerDisplayed -= value;
|
remove => _onDebuggerDisplayed -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onUserAuthResult;
|
internal static Action<bool> _onUserAuthResult;
|
||||||
public static event Action<bool> OnUserAuthResult
|
public static event Action<bool> OnUserAuthResult
|
||||||
{
|
{
|
||||||
add => _onUserAuthResult += value;
|
add => _onUserAuthResult += value;
|
||||||
remove => _onUserAuthResult -= value;
|
remove => _onUserAuthResult -= value;
|
||||||
}
|
}
|
||||||
|
// TODO: 改为 Invoke 方法
|
||||||
internal static Action<bool> _onFirebaseAuthResult;
|
internal static Action<bool> _onFirebaseAuthResult;
|
||||||
public static event Action<bool> OnFirebaseAuthResult
|
public static event Action<bool> OnFirebaseAuthResult
|
||||||
{
|
{
|
||||||
|
|
@ -248,14 +258,18 @@ namespace Guru
|
||||||
remove => _onFirebaseAuthResult -= value;
|
remove => _onFirebaseAuthResult -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: 改为 Inovk 方法
|
||||||
// DeepLink 回调
|
// DeepLink 回调
|
||||||
internal static Action<string> _onDeeplinkCallback;
|
private static Action<string> _onDeeplinkCallback;
|
||||||
public static event Action<string> OnDeeplinkCallback
|
public static event Action<string> OnDeeplinkCallback
|
||||||
{
|
{
|
||||||
add => _onDeeplinkCallback += value;
|
add => _onDeeplinkCallback += value;
|
||||||
remove => _onDeeplinkCallback -= value;
|
remove => _onDeeplinkCallback -= value;
|
||||||
}
|
}
|
||||||
|
internal static void InvokeDeeplinkCallback(string deeplink)
|
||||||
|
{
|
||||||
|
_onDeeplinkCallback?.Invoke(deeplink);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,10 @@ namespace Guru
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : 下个版本需要将 整个 GuruSDK 做功能性的拆分
|
||||||
|
// GuruSDk.Callbacks -> GuruSDkCallbacks 所有的内置回调改为成员变量,
|
||||||
|
// 去掉所有的内部类, 去掉所有的 Static
|
||||||
|
// Static 只用于常量
|
||||||
public static GuruSDKInitConfig BuildConfig(
|
public static GuruSDKInitConfig BuildConfig(
|
||||||
bool useCustomConsent = false,
|
bool useCustomConsent = false,
|
||||||
bool autoLoadAds = true,
|
bool autoLoadAds = true,
|
||||||
|
|
@ -95,6 +99,7 @@ namespace Guru
|
||||||
bool autoRecordFinishedLevels = true,
|
bool autoRecordFinishedLevels = true,
|
||||||
bool debugMode = false,
|
bool debugMode = false,
|
||||||
bool isBuyNoAds = false,
|
bool isBuyNoAds = false,
|
||||||
|
// TODO 直接在此处设置回调
|
||||||
bool useAdjustDeeplink = false,
|
bool useAdjustDeeplink = false,
|
||||||
string bannerColor = "#00000000",
|
string bannerColor = "#00000000",
|
||||||
Dictionary<string, object> defaultRemoteData = null,
|
Dictionary<string, object> defaultRemoteData = null,
|
||||||
|
|
@ -186,6 +191,7 @@ namespace Guru
|
||||||
FirebaseUtil.OnUserAuthResult += OnUserAuthResult;
|
FirebaseUtil.OnUserAuthResult += OnUserAuthResult;
|
||||||
FirebaseUtil.OnFirebaseAuthResult += OnFirebaseAuthResult;
|
FirebaseUtil.OnFirebaseAuthResult += OnFirebaseAuthResult;
|
||||||
|
|
||||||
|
// TODO: 应该直接判断 Callback 是否存在
|
||||||
if (InitConfig.UseAdjustDeeplink)
|
if (InitConfig.UseAdjustDeeplink)
|
||||||
{
|
{
|
||||||
FirebaseUtil.OnAdjustDeeplinkCallback = OnDeeplinkCallback; // 挂载 Deeplink 的回调
|
FirebaseUtil.OnAdjustDeeplinkCallback = OnDeeplinkCallback; // 挂载 Deeplink 的回调
|
||||||
|
|
@ -783,7 +789,7 @@ namespace Guru
|
||||||
/// <param name="deeplink"></param>
|
/// <param name="deeplink"></param>
|
||||||
private void OnDeeplinkCallback(string deeplink)
|
private void OnDeeplinkCallback(string deeplink)
|
||||||
{
|
{
|
||||||
Callbacks.SDK._onDeeplinkCallback?.Invoke(deeplink); // 尝试调用回调
|
Callbacks.SDK.InvokeDeeplinkCallback(deeplink); // 尝试调用回调
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue