/* * Request App Tracking authorization on iOS using Apple's App Tracking Transparency API. A callback * action is triggered based on whether the user approves or rejects tracking */ static public void RequestAppTrackingTransparencyAuthorization(Action onApproved, Action onRejected) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnAttApprovedCallback = onApproved; FGLEnhance_Callbacks.OnAttRejectedCallback = onRejected; #if UNITY_EDITOR if (onApproved != null) { onApproved(); } #elif UNITY_ANDROID if (onApproved != null) { onApproved(); } #elif UNITY_IOS FGLiOSInternals.RequestAppTrackingTransparencyAuthorization(FGLEnhance_Callbacks.CallbackObjectName); #endif }
private static void _SetSdkConfiguration(string sdkId, string configurationKey, string configurationValue) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_IOS FGLiOSInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #endif }
/** * Disable local notifications */ static public void DisableLocalNotification() { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.DisableLocalNotifications(); #elif UNITY_ANDROID FGLAndroidInternals.DisableLocalNotifications(); #elif UNITY_IOS FGLiOSInternals.DisableLocalNotifications(); #endif }
private static string _GetDisplayDescription(string sku, string defaultDescription) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(defaultDescription); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayDescription(sku, defaultDescription)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayDescription(sku, defaultDescription)); #endif }
/** * Enable local notifications * * @param title notification title * @param message notification message * @param delay notification delay in seconds */ public static void EnableLocalNotification(string title, string message, int delay) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_ANDROID FGLAndroidInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_IOS FGLiOSInternals.EnableLocalNotifications(title, message, delay); #endif }
/** * Set current screen * * @param name name of the currently displayed screen */ public static void SetCurrentScreen(string name) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetCurrentScreen(name); #elif UNITY_ANDROID FGLAndroidInternals.SetCurrentScreen(name); #elif UNITY_IOS FGLiOSInternals.SetCurrentScreen(name); #endif }
/** * Update the value of a particular SDK key * * @param id ID of sdk to set key for * @param key key to set * @param value new value */ public static void SetSdkValue(string sdkId, string key, string value) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkValue(sdkId, key, value); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkValue(sdkId, key, value); #elif UNITY_IOS FGLiOSInternals.SetSdkValue(sdkId, key, value); #endif }
///// PUBLIC ///// /** * Log debug message to the console * * @param tag tag to use * @param message message to log */ public static void LogMessage(string tag, string message) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.LogMessage(tag, message); #elif UNITY_ANDROID FGLAndroidInternals.LogMessage(tag, message); #elif UNITY_IOS FGLiOSInternals.LogMessage(tag, message); #endif }
static public void ServiceTermsOptOut() { Enhance.InitializeEnhance(); #if UNITY_EDITOR Debug.Log("[Enhance] ServiceTermsOptOut - runned in Unity Editor, nothing to do"); #elif UNITY_ANDROID FGLAndroidInternals.ServiceTermsOptOut(); #elif UNITY_IOS FGLiOSInternals.ServiceTermsOptOut(); #endif }
private static bool _IsItemOwned(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsItemOwned(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsItemOwned(sku)); #elif UNITY_IOS return(FGLiOSInternals.IsItemOwned(sku)); #else return(false); #endif }
private static bool _IsProductStatusPending(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsProductStatusPending(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsProductStatusPending(sku)); #elif UNITY_IOS return(false); //iOS doesn't need pending transations #else return(false); #endif }
///// PUBLIC ///// private static bool _IsSupported() { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsPurchasingSupported()); #elif UNITY_ANDROID return(FGLAndroidInternals.IsPurchasingSupported()); #elif UNITY_IOS return(FGLiOSInternals.IsPurchasingSupported()); #else return(false); #endif }
private static string _GetDisplayPrice(string sku, string defaultPrice) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayPrice(sku, defaultPrice)); #else return(defaultPrice); #endif }
private static int _GetOwnedItemCount(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetOwnedItemCount(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetOwnedItemCount(sku)); #elif UNITY_IOS return(FGLiOSInternals.GetOwnedItemCount(sku)); #else return(0); #endif }
private static void _ManuallyRestorePurchases(Action onRestoreSuccessCallback, Action onRestoreFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnRestorePurchasesSuccessCallback = onRestoreSuccessCallback; FGLEnhance_Callbacks.OnRestorePurchasesFailedCallback = onRestoreFailedCallback; Enhance.InitializeEnhance(); #if UNITY_ANDROID FGLAndroidInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #endif }
static public void ShowServiceOptInDialogs(string[] requestedSdks, Action onDialogComplete) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnDialogCompleteCallback = onDialogComplete; #if UNITY_EDITOR Debug.Log("[Enhance] ShowServiceOptInDialogs - runned in Unity Editor, nothing to do"); #elif UNITY_ANDROID FGLAndroidInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #endif }
private static void _AttemptPurchase(string sku, Action onPurchaseSuccessCallback, Action onPurchaseFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnPurchaseSuccessCallback = onPurchaseSuccessCallback; FGLEnhance_Callbacks.OnPurchaseFailedCallback = onPurchaseFailedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Request permission from the user to show local notifications * * @param onPermissionGrantedCallback executed when the permission is granted * @param onPermissionRefusedCallback executed when the permission is refused */ public static void RequestLocalNotificationPermission(Action onPermissionGrantedCallback, Action onPermissionRefusedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnLocalNotificationPermissionGrantedCallback = onPermissionGrantedCallback; FGLEnhance_Callbacks.OnLocalNotificationPermissionRefused = onPermissionRefusedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #endif }
static public void RequiresDataConsentOptIn(Action onRequired, Action onNotRequired) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnOptInRequiredCallback = onRequired; FGLEnhance_Callbacks.OnOptInNotRequiredCallback = onNotRequired; #if UNITY_EDITOR if (onNotRequired != null) { onNotRequired(); } #elif UNITY_ANDROID FGLAndroidInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #endif }