update: 增加打点测试SDK 初始化中断逻辑

deeplink
胡宇飞 2024-03-08 17:05:36 +08:00
parent 219ab130d1
commit ffff79d012
1 changed files with 107 additions and 36 deletions

View File

@ -214,6 +214,11 @@ namespace Guru
useIAP = _appServicesConfig.IsIAPEnabled();
Try(() =>
{
LogI($"--- Init apply services ---");
//--------------------------------
if (null != _appServicesConfig.adjust_settings && null != GuruSettings)
{
// 更新 Adjust Tokens
@ -256,29 +261,73 @@ namespace Guru
_appServicesConfig.app_settings.ios_store);
}
}
//---------------------------------
}, ex =>
{
Debug.LogError($"--- ERROR on apply services: {ex.Message}");
});
}
if (useIAP)
{
// InitIAP(_initConfig.GoogleKeys, _initConfig.AppleRootCerts); // 初始化IAP
Try(() =>
{
LogI($"--- Init IAP ---");
InitIAP(_initConfig.GoogleKeys, _initConfig.AppleRootCerts); // 初始化IAP
}, ex =>
{
Debug.LogError($"--- ERROR on useIAP: {ex.Message}");
});
}
if (useKeywords)
{
// KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
Try(() =>
{
LogI($"--- Init Keywords ---");
KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
}, ex =>
{
Debug.LogError($"--- ERROR on Keywords: {ex.Message}");
});
}
#if UNITY_IOS
if (appleReview)
{
// StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
Try(() =>
{
LogI($"--- StartAppleReviewFlow ---");
StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
}, ex =>
{
Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}");
});
}
return;
}
#endif
if (!InitConfig.UseCustomConsent && !appleReview)
{
// LogI($"--- #3 Start Consent Flow ---");
// StartConsentFlow();
Try(() =>
{
LogI($"--- StartConsentFlow ---");
StartConsentFlow();
}, ex =>
{
Debug.LogError($"--- ERROR on StartConsentFlow: {ex.Message}");
});
}
}
@ -292,6 +341,28 @@ namespace Guru
return null;
}
private void Try(Action method, Action<Exception> onException = null, Action onFinal = null)
{
if (method == null) return;
try
{
method.Invoke();
}
catch (Exception ex)
{
LogException(ex);
// ignored
onException?.Invoke(ex);
}
finally
{
// Finally
onFinal?.Invoke();
}
}
#endregion
#region Apple 审核流程逻辑