12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using UnityEngine;
- using UniFramework.Event;
- namespace GFGGame.Launcher
- {
- public static class QDAppStoreManagerInit
- {
- public static int AppTrackingAuthorizationStatus;
- private const string ATTStatusLocalKey = "ATTStatusLocalKey";
- public static void InitPlatform()
- {
- #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});
- }
- private static void AddIOSMethod()
- {
- string objName = "IOSMethod";
- var obj = GameObject.Find(objName);
- if(obj == null)
- {
- obj = new GameObject(objName);
- GameObject.DontDestroyOnLoad(obj);
- }
- obj.AddComponent<ATTAuth>();
- }
- }
- }
|