|
@@ -6,23 +6,41 @@ namespace GFGGame.Launcher
|
|
|
|
|
|
public static class QDAppStoreManagerInit
|
|
|
{
|
|
|
+ public static int AppTrackingAuthorizationStatus;
|
|
|
+ private const string ATTStatusLocalKey = "ATTStatusLocalKey";
|
|
|
+
|
|
|
public static void InitPlatform()
|
|
|
{
|
|
|
- AppTrackingTransparency.RequestTrackingAuthorization();
|
|
|
+#if !UNITY_EDITOR && UNITY_IOS
|
|
|
+ AppTrackingAuthorizationStatus = ATTAuth.GetAppTrackingAuthorizationStatus();
|
|
|
+ if (AppTrackingAuthorizationStatus == 0)
|
|
|
+ {
|
|
|
+ bool requested = LocalCache.GetBool(ATTStatusLocalKey, false);
|
|
|
+ if(!requested)
|
|
|
+ {
|
|
|
+ AddIOSMethod();
|
|
|
+ ATTAuth.RequestTrackingAuthorizationWithCompletionHandler((status) =>
|
|
|
+ {
|
|
|
+ Debug.Log("ATT status :" + status);
|
|
|
+ AppTrackingAuthorizationStatus = status;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
UniEvent.SendMessage(new LauncherEvent.InitPlatformResult() { success = true});
|
|
|
}
|
|
|
|
|
|
- public static void UpdateApp()
|
|
|
+
|
|
|
+ private static void AddIOSMethod()
|
|
|
{
|
|
|
- if (string.IsNullOrEmpty(LauncherConfig.updateAppPrompt))
|
|
|
+ string objName = "IOSMethod";
|
|
|
+ var obj = GameObject.Find(objName);
|
|
|
+ if(obj == null)
|
|
|
{
|
|
|
- LauncherConfig.updateAppPrompt = "需要安装新的安装包。";
|
|
|
+ obj = new GameObject(objName);
|
|
|
+ GameObject.DontDestroyOnLoad(obj);
|
|
|
}
|
|
|
- Alert.Show(LauncherConfig.updateAppPrompt)
|
|
|
- .SetLeftButton(true, "前往更新", (data) =>
|
|
|
- {
|
|
|
- Application.OpenURL("");
|
|
|
- });
|
|
|
+ obj.AddComponent<ATTAuth>();
|
|
|
}
|
|
|
}
|
|
|
}
|