update: 增加打点测试SDK 初始化中断逻辑
parent
219ab130d1
commit
ffff79d012
|
|
@ -213,72 +213,121 @@ namespace Guru
|
||||||
useKeywords = _appServicesConfig.KeywordsEnabled();
|
useKeywords = _appServicesConfig.KeywordsEnabled();
|
||||||
useIAP = _appServicesConfig.IsIAPEnabled();
|
useIAP = _appServicesConfig.IsIAPEnabled();
|
||||||
|
|
||||||
|
|
||||||
if (null != _appServicesConfig.adjust_settings && null != GuruSettings)
|
|
||||||
{
|
|
||||||
// 更新 Adjust Tokens
|
|
||||||
GuruSettings.UpdateAdjustTokens(
|
|
||||||
_appServicesConfig.adjust_settings.AndroidToken(),
|
|
||||||
_appServicesConfig.adjust_settings.iOSToken());
|
|
||||||
// 更新 Adjust Events
|
|
||||||
GuruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != _appServicesConfig.app_settings)
|
Try(() =>
|
||||||
{
|
{
|
||||||
if (_appServicesConfig.Tch02Value() > 0)
|
LogI($"--- Init apply services ---");
|
||||||
|
//--------------------------------
|
||||||
|
|
||||||
|
if (null != _appServicesConfig.adjust_settings && null != GuruSettings)
|
||||||
{
|
{
|
||||||
Analytics.EnableTch02Event = true;
|
// 更新 Adjust Tokens
|
||||||
Analytics.SetTch02TargetValue(_appServicesConfig.Tch02Value());
|
GuruSettings.UpdateAdjustTokens(
|
||||||
|
_appServicesConfig.adjust_settings.AndroidToken(),
|
||||||
|
_appServicesConfig.adjust_settings.iOSToken());
|
||||||
|
// 更新 Adjust Events
|
||||||
|
GuruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null != _appServicesConfig.app_settings)
|
||||||
|
{
|
||||||
|
if (_appServicesConfig.Tch02Value() > 0)
|
||||||
|
{
|
||||||
|
Analytics.EnableTch02Event = true;
|
||||||
|
Analytics.SetTch02TargetValue(_appServicesConfig.Tch02Value());
|
||||||
|
}
|
||||||
|
|
||||||
// 设置获取设备 UUID 的方法
|
// 设置获取设备 UUID 的方法
|
||||||
if (_appServicesConfig.UseUUID())
|
if (_appServicesConfig.UseUUID())
|
||||||
{
|
{
|
||||||
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
|
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
// 苹果审核标志位
|
// 苹果审核标志位
|
||||||
appleReview = _appServicesConfig.IsAppReview();
|
appleReview = _appServicesConfig.IsAppReview();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (null != GuruSettings)
|
if (null != GuruSettings)
|
||||||
{
|
{
|
||||||
// 更新和升级 GuruSettings 对应的值
|
// 更新和升级 GuruSettings 对应的值
|
||||||
GuruSettings.UpdateAppSettings(
|
GuruSettings.UpdateAppSettings(
|
||||||
_appServicesConfig.app_settings.bundle_id,
|
_appServicesConfig.app_settings.bundle_id,
|
||||||
_appServicesConfig.fb_settings?.fb_app_id ?? "",
|
_appServicesConfig.fb_settings?.fb_app_id ?? "",
|
||||||
_appServicesConfig.app_settings.support_email,
|
_appServicesConfig.app_settings.support_email,
|
||||||
_appServicesConfig.app_settings.privacy_url,
|
_appServicesConfig.app_settings.privacy_url,
|
||||||
_appServicesConfig.app_settings.terms_url,
|
_appServicesConfig.app_settings.terms_url,
|
||||||
_appServicesConfig.app_settings.android_store,
|
_appServicesConfig.app_settings.android_store,
|
||||||
_appServicesConfig.app_settings.ios_store);
|
_appServicesConfig.app_settings.ios_store);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------
|
||||||
|
}, ex =>
|
||||||
|
{
|
||||||
|
Debug.LogError($"--- ERROR on apply services: {ex.Message}");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useIAP)
|
if (useIAP)
|
||||||
{
|
{
|
||||||
InitIAP(_initConfig.GoogleKeys, _initConfig.AppleRootCerts); // 初始化IAP
|
// 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)
|
if (useKeywords)
|
||||||
{
|
{
|
||||||
KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
|
// 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 UNITY_IOS
|
||||||
if (appleReview)
|
if (appleReview)
|
||||||
{
|
{
|
||||||
StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
|
// StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
|
||||||
|
Try(() =>
|
||||||
|
{
|
||||||
|
LogI($"--- StartAppleReviewFlow ---");
|
||||||
|
StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
|
||||||
|
}, ex =>
|
||||||
|
{
|
||||||
|
Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}");
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!InitConfig.UseCustomConsent && !appleReview)
|
if (!InitConfig.UseCustomConsent && !appleReview)
|
||||||
{
|
{
|
||||||
// LogI($"--- #3 Start Consent Flow ---");
|
// LogI($"--- #3 Start Consent Flow ---");
|
||||||
StartConsentFlow();
|
// StartConsentFlow();
|
||||||
|
Try(() =>
|
||||||
|
{
|
||||||
|
LogI($"--- StartConsentFlow ---");
|
||||||
|
StartConsentFlow();
|
||||||
|
}, ex =>
|
||||||
|
{
|
||||||
|
Debug.LogError($"--- ERROR on StartConsentFlow: {ex.Message}");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,7 +340,29 @@ namespace Guru
|
||||||
}
|
}
|
||||||
return null;
|
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
|
#endregion
|
||||||
|
|
||||||
#region Apple 审核流程逻辑
|
#region Apple 审核流程逻辑
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue