diff --git a/Editor/GuruManager/Config/EditorGuruServiceIO.cs b/Editor/GuruManager/Config/EditorGuruServiceIO.cs
index 601f1fe..c111ec8 100644
--- a/Editor/GuruManager/Config/EditorGuruServiceIO.cs
+++ b/Editor/GuruManager/Config/EditorGuruServiceIO.cs
@@ -80,6 +80,7 @@ namespace Guru.Editor
cfg.ad_settings = new GuruAdSettings();
cfg.adjust_settings = new GuruAdjustSettings();
cfg.fb_settings = new GuruFbSettings();
+ cfg.parameters = new GuruParameters();
return cfg;
}
diff --git a/Editor/GuruManager/Helper/GuruServiceConverterHelper.cs b/Editor/GuruManager/Helper/GuruServiceConverterHelper.cs
index d3d1ec7..a64fc80 100644
--- a/Editor/GuruManager/Helper/GuruServiceConverterHelper.cs
+++ b/Editor/GuruManager/Helper/GuruServiceConverterHelper.cs
@@ -137,14 +137,6 @@ namespace Guru.Editor
{
settings.app_settings.ios_store = value;
}
- else if (GetValue(line, "level_end_success_num", out value))
- {
- settings.app_settings.level_end_success_num = GetInt(value);
- }
- else if (GetValue(line, "enable_keywords", out value))
- {
- settings.app_settings.enable_keywords = GetBool(value);
- }
else if (GetValue(line, "enable_firebase", out value))
{
settings.app_settings.enable_firebase = GetBool(value);
@@ -161,17 +153,9 @@ namespace Guru.Editor
{
settings.app_settings.enable_iap = GetBool(value);
}
- else if (GetValue(line, "tch_020", out value))
- {
- settings.app_settings.tch_020 = GetDouble(value);
- }
- else if (GetValue(line, "using_uuid", out value))
- {
- settings.app_settings.using_uuid = GetBool(value);
- }
-
}
+
///
/// AdjustSettings 填充
///
@@ -183,7 +167,7 @@ namespace Guru.Editor
string[] list = null;
string line = lines[index];
bool pass = false;
- List events = new List(20);
+ List events = new List(40);
while (!lines[index].StartsWith(K_FB_SETTINGS))
{
@@ -255,7 +239,8 @@ namespace Guru.Editor
string[] pubmatic_ids_ios = new string[3];
string[] moloco_ids_android = new string[3];
string[] moloco_ids_ios = new string[3];
-
+ string[] tradplus_ids_android = new string[3];
+ string[] tradplus_ids_ios = new string[3];
//------- 开始记录广告配置;
@@ -350,6 +335,24 @@ namespace Guru.Editor
moloco_ids_android[2] = arr[0];
moloco_ids_ios[2] = arr[1];
}
+ else if (line.StartsWith("tradplus_bads"))
+ {
+ arr = GetStringArray(line, 1, 2);
+ tradplus_ids_android[0] = arr[0];
+ tradplus_ids_ios[0] = arr[1];
+ }
+ else if (line.StartsWith("tradplus_iads"))
+ {
+ arr = GetStringArray(line, 1, 2);
+ tradplus_ids_android[1] = arr[0];
+ tradplus_ids_ios[1] = arr[1];
+ }
+ else if (line.StartsWith("tradplus_rads"))
+ {
+ arr = GetStringArray(line, 1, 2);
+ tradplus_ids_android[2] = arr[0];
+ tradplus_ids_ios[2] = arr[1];
+ }
index++;
}
@@ -362,6 +365,8 @@ namespace Guru.Editor
settings.ad_settings.pubmatic_ids_ios = pubmatic_ids_ios;
settings.ad_settings.moloco_ids_android = moloco_ids_android;
settings.ad_settings.moloco_ids_ios = moloco_ids_ios;
+ settings.ad_settings.tradplus_ids_android = tradplus_ids_android;
+ settings.ad_settings.tradplus_ids_ios = tradplus_ids_ios;
index--;
}
diff --git a/Editor/GuruManager/Manager/GuruSDKManager.cs b/Editor/GuruManager/Manager/GuruSDKManager.cs
index c208abd..bcbd3ce 100644
--- a/Editor/GuruManager/Manager/GuruSDKManager.cs
+++ b/Editor/GuruManager/Manager/GuruSDKManager.cs
@@ -240,6 +240,18 @@ namespace Guru.Editor
AddResultLine($"{MARK_INDENT}{mk_warn} Moloco iOS Test IDs is missing!", CheckStatus.Warning);
_serviceNormalFail++;
}
+ if (!IsArrayNotEmpty(_servicesConfig.ad_settings.tradplus_ids_android))
+ {
+ passed = false;
+ AddResultLine($"{MARK_INDENT}{mk_warn} Tradplus Android Test IDs is missing!", CheckStatus.Warning);
+ _serviceNormalFail++;
+ }
+ if (!IsArrayNotEmpty(_servicesConfig.ad_settings.tradplus_ids_ios))
+ {
+ passed = false;
+ AddResultLine($"{MARK_INDENT}{mk_warn} Tradplus iOS Test IDs is missing!", CheckStatus.Warning);
+ _serviceNormalFail++;
+ }
}
if (passed) AddResultLine(check_passed);
@@ -532,10 +544,10 @@ namespace Guru.Editor
p = n.serializedObject.FindProperty("IPMSetting.bundleId");
p.stringValue = _servicesConfig.app_settings.bundle_id;
// tokenValidTime
- if (_servicesConfig.app_settings.token_vaild_time > 0)
+ if (_servicesConfig.TokenValidTime() > 0)
{
p = n.serializedObject.FindProperty("IPMSetting.tokenValidTime");
- p.intValue = _servicesConfig.app_settings.token_vaild_time;
+ p.intValue = _servicesConfig.TokenValidTime();
}
if (_servicesConfig.fb_settings != null)
{
@@ -648,6 +660,33 @@ namespace Guru.Editor
}
}
+ //---------- TRADPLUS -----------------------
+ n = so.FindProperty("TradplusSetting");
+ if (null != n)
+ {
+ arr = _servicesConfig.ad_settings.tradplus_ids_android;
+ if (IsArrayHasLength(arr, 3))
+ {
+ p = n.serializedObject.FindProperty("TradplusSetting.Android.bannerUnitID");
+ p.stringValue = arr[0];
+ p = n.serializedObject.FindProperty("TradplusSetting.Android.interUnitID");
+ p.stringValue = arr[1];
+ p = n.serializedObject.FindProperty("TradplusSetting.Android.rewardUnitID");
+ p.stringValue = arr[2];
+ }
+
+ arr = _servicesConfig.ad_settings.tradplus_ids_ios;
+ if (IsArrayHasLength(arr, 3))
+ {
+ p = n.serializedObject.FindProperty("TradplusSetting.iOS.bannerUnitID");
+ p.stringValue = arr[0];
+ p = n.serializedObject.FindProperty("TradplusSetting.iOS.interUnitID");
+ p.stringValue = arr[1];
+ p = n.serializedObject.FindProperty("TradplusSetting.iOS.rewardUnitID");
+ p.stringValue = arr[2];
+ }
+ }
+
//----------- ADSettings -------------------
n = so.FindProperty("ADSetting");
if (null != n)
@@ -695,13 +734,13 @@ namespace Guru.Editor
if (null != n)
{
p = n.serializedObject.FindProperty("AnalyticsSetting.levelEndSuccessNum");
- p.intValue = _servicesConfig.app_settings.level_end_success_num;
+ p.intValue = _servicesConfig.LevelEndSuccessNum();
p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeFirebaseAnalytics");
- p.boolValue = _servicesConfig.app_settings.enable_firebase;
+ p.boolValue = _servicesConfig.IsFirebaseEnabled();
p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeFacebookAnalytics");
- p.boolValue = _servicesConfig.app_settings.enable_facebook;
+ p.boolValue = _servicesConfig.IsFacebookEnabled();
p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeAdjustAnalytics");
- p.boolValue = _servicesConfig.app_settings.enable_adjust;
+ p.boolValue = _servicesConfig.IsAdjustEnabled();
p = n.serializedObject.FindProperty("AnalyticsSetting.adjustEventList");
if (null != p && IsArrayNotEmpty(_servicesConfig.adjust_settings.events))
{
diff --git a/Runtime/Code/Config/GuruServicesConfig.cs b/Runtime/Code/Config/GuruServicesConfig.cs
index 5b0db5e..fa0963e 100644
--- a/Runtime/Code/Config/GuruServicesConfig.cs
+++ b/Runtime/Code/Config/GuruServicesConfig.cs
@@ -9,6 +9,7 @@ namespace Guru
{
public long version = 0;
public GuruAppSettings app_settings;
+ public GuruParameters parameters;
public GuruAdjustSettings adjust_settings;
public GuruFbSettings fb_settings;
public GuruAdSettings ad_settings;
@@ -33,11 +34,35 @@ namespace Guru
public bool IsMolocoIOSEnabled() => ad_settings != null &&
ad_settings.moloco_ids_ios != null &&
ad_settings.moloco_ids_ios.Length > 0;
+ public bool IsTradplusAndroidEnabled() => ad_settings != null &&
+ ad_settings.tradplus_ids_android != null &&
+ ad_settings.tradplus_ids_android.Length > 0;
+ public bool IsTradplusIOSEnabled() => ad_settings != null &&
+ ad_settings.tradplus_ids_ios != null &&
+ ad_settings.tradplus_ids_ios.Length > 0;
public bool IsIAPEnabled() => app_settings != null && app_settings.enable_iap
&& products != null && products.Length > 0;
- public bool IsKeywordsEnabled() => app_settings != null && app_settings.enable_keywords;
+
+ public bool IsFirebaseEnabled() => app_settings?.enable_firebase ?? true;
+ public bool IsFacebookEnabled() => app_settings?.enable_facebook ?? true;
+ public bool IsAdjustEnabled() => app_settings?.enable_adjust ?? true;
+
//-------------------------------- 配置检测 -------------------------------
+
+
+ //-------------------------------- Parameters --------------------------------
+ public double Tch02Value() => parameters?.tch_020 ?? 0;
+ public bool IsAppReview() => parameters?.apple_review ?? false;
+ public bool DMACountryCheck() => parameters?.dma_country_check ?? false;
+ public string DMAMapRule() => parameters?.dma_map_rule ?? "";
+ public bool UseUUID() => parameters?.using_uuid ?? false;
+ public bool KeywordsEnabled() => parameters?.enable_keywords ?? false;
+ public int TokenValidTime() => parameters?.token_vaild_time ?? 604800;
+ public int LevelEndSuccessNum() => parameters?.level_end_success_num ?? 50;
+ //-------------------------------- Parameters --------------------------------
+
+
}
[Serializable]
@@ -51,17 +76,25 @@ namespace Guru
public string terms_url;
public string android_store;
public string ios_store;
- public int token_vaild_time = 604800;
- public int level_end_success_num = 50;
- public bool enable_keywords = true;
public bool enable_firebase = true;
public bool enable_facebook = true;
public bool enable_adjust = true;
public bool enable_iap = false;
- public double tch_020 = 0;
- public bool using_uuid = false;
}
-
+
+ [Serializable]
+ public class GuruParameters
+ {
+ public int token_vaild_time = 604800;
+ public int level_end_success_num = 50;
+ public bool enable_keywords = false;
+ public double tch_020 = 0;
+ public bool using_uuid = true;
+ public string dma_map_rule = "";
+ public bool dma_country_check = false;
+ public bool apple_review = false; // 苹果审核标志位
+ }
+
[Serializable]
public class GuruAdjustSettings
{
@@ -92,6 +125,8 @@ namespace Guru
public string[] pubmatic_ids_ios;
public string[] moloco_ids_android;
public string[] moloco_ids_ios;
+ public string[] tradplus_ids_android;
+ public string[] tradplus_ids_ios;
}
}
\ No newline at end of file
diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs
index 986f9d3..db9f637 100644
--- a/Runtime/Code/SDK/GuruSDK.Ads.cs
+++ b/Runtime/Code/SDK/GuruSDK.Ads.cs
@@ -53,16 +53,26 @@ namespace Guru
#region Guru Consent
-
+
+ private bool _hasConsentCalled = false;
+
///
/// 启动Consent流程
+ /// 因为之后规划广告流程会放在 Consent 初始化之后, 因此请求广告的时候会需要先请求 Consent
///
private void StartConsentFlow()
{
- LogI($"StartConsentFlow");
- GuruConsent.StartConsent(OnConsentOver);
+ if (_hasConsentCalled) return;
+ _hasConsentCalled = true;
+
+ bool enableCountryCheck = _appServicesConfig.DMACountryCheck();
+ string dmaMapRule = _appServicesConfig.DMAMapRule();
+
+ Debug.Log($"{Tag} --- StartConsentFlow ---");
+ GuruConsent.StartConsent(OnConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck);
}
+
private void OnConsentOver(int code)
{
#if UNITY_IOS
@@ -73,10 +83,10 @@ namespace Guru
{
case GuruConsent.StatusCode.OBTAINED:
case GuruConsent.StatusCode.NOT_AVAILABLE:
- // 已获取授权, 或者地区不可用
-#if UNITY_IOS
- CheckAttStatus();
-#endif
+ // 已获取授权, 或者地区不可用, ATT 尚未启动
+// #if UNITY_IOS
+// CheckAttStatus(); // 删除主动触发的逻辑
+// #endif
break;
}
diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs
index 1143379..7c09a13 100644
--- a/Runtime/Code/SDK/GuruSDK.cs
+++ b/Runtime/Code/SDK/GuruSDK.cs
@@ -144,12 +144,6 @@ namespace Guru
private void OnFirebaseReady()
{
IsInitialSuccess = true;
-
- if (!InitConfig.UseCustomConsent)
- {
- // LogI($"--- #3 Start Consent Flow ---");
- StartConsentFlow();
- }
if(!string.IsNullOrEmpty(IPMConfig.IPM_UID)) SetUID(IPMConfig.IPM_UID);
@@ -198,12 +192,13 @@ namespace Guru
{
bool useKeywords = false;
bool useIAP = true;
+ bool appleReview = false;
var services = GetRemoteServicesConfig();
if (services != null)
{
_appServicesConfig = services;
- useKeywords = _appServicesConfig.IsKeywordsEnabled();
+ useKeywords = _appServicesConfig.KeywordsEnabled();
useIAP = _appServicesConfig.IsIAPEnabled();
@@ -219,18 +214,23 @@ namespace Guru
if (null != _appServicesConfig.app_settings)
{
- if (_appServicesConfig.app_settings.tch_020 > 0)
+ if (_appServicesConfig.Tch02Value() > 0)
{
Analytics.EnableTch02Event = true;
- Analytics.SetTch02TargetValue(_appServicesConfig.app_settings.tch_020);
+ Analytics.SetTch02TargetValue(_appServicesConfig.Tch02Value());
}
// 设置获取设备 UUID 的方法
- if (_appServicesConfig.app_settings.using_uuid)
+ if (_appServicesConfig.UseUUID())
{
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
}
+#if UNITY_IOS
+ // 苹果审核标志位
+ appleReview = _appServicesConfig.IsAppReview();
+#endif
+
if (null != GuruSettings)
{
// 更新和升级 GuruSettings 对应的值
@@ -255,6 +255,19 @@ namespace Guru
{
KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
}
+
+#if UNITY_IOS
+ if (appleReview)
+ {
+ StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
+ return;
+ }
+#endif
+ if (!InitConfig.UseCustomConsent && !appleReview)
+ {
+ // LogI($"--- #3 Start Consent Flow ---");
+ StartConsentFlow();
+ }
}
private GuruServicesConfig GetRemoteServicesConfig()
@@ -266,8 +279,24 @@ namespace Guru
}
return null;
}
+
+
+
+
+
+
#endregion
+ #region Apple 审核流程逻辑
+
+#if UNITY_IOS
+ private void StartAppleReviewFlow()
+ {
+ CheckAttStatus();
+ }
+#endif
+ #endregion
+
#region 数据
private void OnBLevelChanged(int blevel)