diff --git a/sdk-intergration/Assets/AppsFlyer.meta b/sdk-intergration/Assets/AppsFlyer.meta index 00aa988..2a71bd2 100644 --- a/sdk-intergration/Assets/AppsFlyer.meta +++ b/sdk-intergration/Assets/AppsFlyer.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: da76ae4f9ba92124087139583d0dd929 +guid: 7863556d88b814e09ba9cfc75a91d655 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs b/sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs new file mode 100644 index 0000000..64d53de --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; + +namespace AppsFlyerSDK +{ + public enum MediationNetwork : ulong + { + GoogleAdMob = 1, + IronSource = 2, + ApplovinMax = 3, + Fyber = 4, + Appodeal = 5, + Admost = 6, + Topon = 7, + Tradplus = 8, + Yandex = 9, + ChartBoost = 10, + Unity = 11, + ToponPte = 12, + Custom = 13, + DirectMonetization = 14 + } + + public static class AdRevenueScheme + { + /** + * code ISO 3166-1 format + */ + public const string COUNTRY = "country"; + + /** + * ID of the ad unit for the impression + */ + public const string AD_UNIT = "ad_unit"; + + /** + * Format of the ad + */ + public const string AD_TYPE = "ad_type"; + + /** + * ID of the ad placement for the impression + */ + public const string PLACEMENT = "placement"; + } + + /// + // Data class representing ad revenue information. + // + // @property monetizationNetwork The name of the network that monetized the ad. + // @property mediationNetwork An instance of MediationNetwork representing the mediation service used. + // @property currencyIso4217Code The ISO 4217 currency code describing the currency of the revenue. + // @property eventRevenue The amount of revenue generated by the ad. + /// + public class AFAdRevenueData + { + public string monetizationNetwork { get; private set; } + public MediationNetwork mediationNetwork { get; private set; } + public string currencyIso4217Code { get; private set; } + public double eventRevenue { get; private set; } + + public AFAdRevenueData(string monetization, MediationNetwork mediation, string currency, double revenue) + { + monetizationNetwork = monetization; + mediationNetwork = mediation; + currencyIso4217Code = currency; + eventRevenue = revenue; + } + } + +} \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs.meta b/sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs.meta similarity index 83% rename from sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs.meta rename to sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs.meta index c20a62c..3106aae 100644 --- a/sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs.meta +++ b/sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b1a24aa01166451d804d7c03c14a3db +guid: 49e1906ae949e4bfea400bd1da9f7e39 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs b/sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs deleted file mode 100644 index 6ed2afb..0000000 --- a/sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections; -using UnityEngine; - -public class AFAdRevenueEvent { - - /** - *Pre-defined keys for non-mandatory dictionary - *Code ISO 3166-1 format - **/ - public const string COUNTRY = "country"; - - /** - *ID of the ad unit for the impression - **/ - public const string AD_UNIT = "ad_unit"; - - /** - *Format of the ad - **/ - public const string AD_TYPE = "ad_type"; - - /** - *ID of the ad placement for the impression - **/ - public const string PLACEMENT = "placement"; - - /** - *Provided by Facebook Audience Network only, and will be reported to publishers - *approved by Facebook Audience Network within the closed beta - **/ - public const string ECPM_PAYLOAD = "ecpm_payload"; - - -} diff --git a/sdk-intergration/Assets/AppsFlyer/AFInAppEvents.cs b/sdk-intergration/Assets/AppsFlyer/AFInAppEvents.cs index daa7602..1f6d1fe 100644 --- a/sdk-intergration/Assets/AppsFlyer/AFInAppEvents.cs +++ b/sdk-intergration/Assets/AppsFlyer/AFInAppEvents.cs @@ -28,7 +28,6 @@ public class AFInAppEvents { public const string LOCATION_CHANGED = "af_location_changed"; public const string LOCATION_COORDINATES = "af_location_coordinates"; public const string ORDER_ID = "af_order_id"; - public const string GA = "af_ga_event"; /** * Event Parameter Name * **/ diff --git a/sdk-intergration/Assets/AppsFlyer/AFMiniJSON.cs b/sdk-intergration/Assets/AppsFlyer/AFMiniJSON.cs old mode 100644 new mode 100755 diff --git a/sdk-intergration/Assets/AppsFlyer/AFPurchaseDetailsAndroid.cs b/sdk-intergration/Assets/AppsFlyer/AFPurchaseDetailsAndroid.cs index 6762c97..d149885 100644 --- a/sdk-intergration/Assets/AppsFlyer/AFPurchaseDetailsAndroid.cs +++ b/sdk-intergration/Assets/AppsFlyer/AFPurchaseDetailsAndroid.cs @@ -10,24 +10,19 @@ namespace AppsFlyerSDK } /// - // + /// Purchase details class matching Android SDK AFPurchaseDetails /// public class AFPurchaseDetailsAndroid - { public AFPurchaseType purchaseType { get; private set; } public string purchaseToken { get; private set; } public string productId { get; private set; } - public string price { get; private set; } - public string currency { get; private set; } - public AFPurchaseDetailsAndroid(AFPurchaseType type, String purchaseToken, String productId, String price, String currency) + public AFPurchaseDetailsAndroid(AFPurchaseType type, String purchaseToken, String productId) { this.purchaseType = type; this.purchaseToken = purchaseToken; this.productId = productId; - this.price = price; - this.currency = currency; } } diff --git a/sdk-intergration/Assets/AppsFlyer/AFSDKPurchaseDetailsIOS.cs b/sdk-intergration/Assets/AppsFlyer/AFSDKPurchaseDetailsIOS.cs index f159eea..0dcde3a 100644 --- a/sdk-intergration/Assets/AppsFlyer/AFSDKPurchaseDetailsIOS.cs +++ b/sdk-intergration/Assets/AppsFlyer/AFSDKPurchaseDetailsIOS.cs @@ -4,26 +4,33 @@ using System.Collections.Generic; namespace AppsFlyerSDK { /// - // + /// Purchase type enum matching iOS SDK AFSDKPurchaseType + /// + public enum AFSDKPurchaseType + { + Subscription, + OneTimePurchase + } + + /// + /// Purchase details class matching iOS SDK AFSDKPurchaseDetails /// public class AFSDKPurchaseDetailsIOS { public string productId { get; private set; } - public string price { get; private set; } - public string currency { get; private set; } public string transactionId { get; private set; } + public AFSDKPurchaseType purchaseType { get; private set; } - private AFSDKPurchaseDetailsIOS(string productId, string price, string currency, string transactionId) + private AFSDKPurchaseDetailsIOS(string productId, string transactionId, AFSDKPurchaseType purchaseType) { this.productId = productId; - this.price = price; - this.currency = currency; this.transactionId = transactionId; + this.purchaseType = purchaseType; } - public static AFSDKPurchaseDetailsIOS Init(string productId, string price, string currency, string transactionId) + public static AFSDKPurchaseDetailsIOS Init(string productId, string transactionId, AFSDKPurchaseType purchaseType) { - return new AFSDKPurchaseDetailsIOS(productId, price, currency, transactionId); + return new AFSDKPurchaseDetailsIOS(productId, transactionId, purchaseType); } } diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyer.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyer.cs index 670932a..f2f3678 100644 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyer.cs +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyer.cs @@ -6,8 +6,7 @@ namespace AppsFlyerSDK { public class AppsFlyer : MonoBehaviour { - - public static readonly string kAppsFlyerPluginVersion = "6.14.3"; + public static readonly string kAppsFlyerPluginVersion = "6.17.7"; public static string CallBackObjectName = null; private static EventHandler onRequestResponse; private static EventHandler onInAppResponse; @@ -333,6 +332,19 @@ namespace AppsFlyerSDK } } + /// + /// Logs ad revenue data along with additional parameters if provided. + /// + /// instance of AFAdRevenueData containing ad revenue information. + /// An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters. + public static void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary additionalParameters) + { + if (instance != null) + { + instance.logAdRevenue(adRevenueData, additionalParameters); + } + } + /// /// Manually record the location of the user. /// @@ -766,12 +778,12 @@ namespace AppsFlyerSDK } // V2 - public static void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary extraEventValues, MonoBehaviour gameObject) + public static void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject) { if (instance != null && instance is IAppsFlyerIOSBridge) { IAppsFlyerIOSBridge appsFlyeriOSInstance = (IAppsFlyerIOSBridge)instance; - appsFlyeriOSInstance.validateAndSendInAppPurchase(details, extraEventValues, gameObject); + appsFlyeriOSInstance.validateAndSendInAppPurchase(details, purchaseAdditionalDetails, gameObject); } } @@ -785,12 +797,12 @@ namespace AppsFlyerSDK } // V2 - public static void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary additionalParameters, MonoBehaviour gameObject) + public static void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject) { if (instance != null && instance is IAppsFlyerAndroidBridge) { IAppsFlyerAndroidBridge appsFlyerAndroidInstance = (IAppsFlyerAndroidBridge)instance; - appsFlyerAndroidInstance.validateAndSendInAppPurchase(details, additionalParameters, gameObject); + appsFlyerAndroidInstance.validateAndSendInAppPurchase(details, purchaseAdditionalDetails, gameObject); } } diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs deleted file mode 100644 index 1c9baf1..0000000 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using System.Runtime.InteropServices; -using System; - -namespace AppsFlyerSDK -{ - public class AppsFlyerAdRevenue : MonoBehaviour - { - - public static readonly string kAppsFlyerAdRevenueVersion = "6.14.3"; - -#if UNITY_ANDROID && !UNITY_EDITOR - private static AndroidJavaClass appsFlyerAndroid = new AndroidJavaClass("com.appsflyer.unity.afunityadrevenuegenericplugin.AdRevenueUnityWrapper"); -#endif - - public static void start() - { -#if UNITY_IOS && !UNITY_EDITOR - - _start(); - -#elif UNITY_ANDROID && !UNITY_EDITOR - - using(AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { - - using(AndroidJavaObject cls_Activity = cls_UnityPlayer.GetStatic("currentActivity")) { - - AndroidJavaObject cls_Application = cls_Activity.Call("getApplication"); - - appsFlyerAndroid.CallStatic("start", cls_Application); - } - } - -#else - -#endif - } - - - public static void setIsDebug(bool isDebug) - { -#if UNITY_IOS && !UNITY_EDITOR - _setIsDebugAdrevenue(isDebug); -#elif UNITY_ANDROID && !UNITY_EDITOR - -#else - -#endif - } - - public static void logAdRevenue(string monetizationNetwork, - AppsFlyerAdRevenueMediationNetworkType mediationNetwork, - double eventRevenue, - string revenueCurrency, - Dictionary additionalParameters) - { -#if UNITY_IOS && !UNITY_EDITOR - - _logAdRevenue(monetizationNetwork, mediationNetwork, eventRevenue, revenueCurrency, AFMiniJSON.Json.Serialize(additionalParameters)); - -#elif UNITY_ANDROID && !UNITY_EDITOR - - int mediationNetworkAndroid = setMediationNetworkTypeAndroid(mediationNetwork); - if (mediationNetworkAndroid == -1) - { - Debug.Log("Please choose a valid mediationNetwork"); - } else - { - appsFlyerAndroid.CallStatic("logAdRevenue", - monetizationNetwork, - mediationNetworkAndroid, - revenueCurrency, - eventRevenue, - convertDictionaryToJavaMap(additionalParameters)); - - } -#else - -#endif - } - -#if UNITY_IOS && !UNITY_EDITOR - - [DllImport("__Internal")] - private static extern void _start(); - - [DllImport("__Internal")] - private static extern void _setIsDebugAdrevenue(bool isDebug); - - [DllImport("__Internal")] - private static extern void _logAdRevenue(string monetizationNetwork, - AppsFlyerAdRevenueMediationNetworkType mediationNetwork, - double eventRevenue, - string revenueCurrency, - string additionalParameters); - -#elif UNITY_ANDROID && !UNITY_EDITOR - -#else - -#endif - private static int setMediationNetworkTypeAndroid(AppsFlyerAdRevenueMediationNetworkType mediationNetwork) - { - switch (mediationNetwork) - { - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeIronSource: - return 0; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeApplovinMax: - return 1; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob: - return 2; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeFyber: - return 3; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAppodeal: - return 4; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeAdmost: - return 5; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeTopon: - return 6; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeTradplus: - return 7; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeYandex: - return 8; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeChartBoost: - return 9; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeUnity: - return 10; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeCustomMediation: - return 11; - case AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypedirectMonetization: - return 12; - default: - return -1; - } - - } - private static AndroidJavaObject convertDictionaryToJavaMap(Dictionary dictionary) - { - AndroidJavaObject map = new AndroidJavaObject("java.util.HashMap"); - IntPtr putMethod = AndroidJNIHelper.GetMethodID(map.GetRawClass(), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); - jvalue[] val; - if (dictionary != null) - { - foreach (var entry in dictionary) - { - val = AndroidJNIHelper.CreateJNIArgArray(new object[] { entry.Key, entry.Value }); - AndroidJNI.CallObjectMethod(map.GetRawObject(), putMethod, val); - AndroidJNI.DeleteLocalRef(val[0].l); - AndroidJNI.DeleteLocalRef(val[1].l); - } - } - - return map; - } - } - - - public enum AppsFlyerAdRevenueMediationNetworkType - { - AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob = 1, - AppsFlyerAdRevenueMediationNetworkTypeIronSource = 2, - AppsFlyerAdRevenueMediationNetworkTypeApplovinMax = 3, - AppsFlyerAdRevenueMediationNetworkTypeFyber = 4, - AppsFlyerAdRevenueMediationNetworkTypeAppodeal = 5, - AppsFlyerAdRevenueMediationNetworkTypeAdmost = 6, - AppsFlyerAdRevenueMediationNetworkTypeTopon = 7, - AppsFlyerAdRevenueMediationNetworkTypeTradplus = 8, - AppsFlyerAdRevenueMediationNetworkTypeYandex = 9, - AppsFlyerAdRevenueMediationNetworkTypeChartBoost = 10, - AppsFlyerAdRevenueMediationNetworkTypeUnity = 11, - AppsFlyerAdRevenueMediationNetworkTypeCustomMediation = 12, - AppsFlyerAdRevenueMediationNetworkTypedirectMonetization = 13 - } - - - -} \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAndroid.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyerAndroid.cs index 0e085f6..695b4a2 100644 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAndroid.cs +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyerAndroid.cs @@ -398,7 +398,23 @@ namespace AppsFlyerSDK public void setConsentData(AppsFlyerConsent appsFlyerConsent) { #if !UNITY_EDITOR - appsFlyerAndroid.CallStatic("setConsentData", appsFlyerConsent.isUserSubjectToGDPR, appsFlyerConsent.hasConsentForDataUsage, appsFlyerConsent.hasConsentForAdsPersonalization); + string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null"; + string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null"; + string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null"; + string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null"; + + appsFlyerAndroid.CallStatic("setConsentData", isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage); +#endif + } + + /// + /// Logs ad revenue data along with additional parameters if provided. + /// instance of AFAdRevenueData containing ad revenue information. + /// An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters. + public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary additionalParameters) + { +#if !UNITY_EDITOR + appsFlyerAndroid.CallStatic("logAdRevenue", adRevenueData.monetizationNetwork, getMediationNetwork(adRevenueData.mediationNetwork), adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, convertDictionaryToJavaMap(additionalParameters)); #endif } @@ -489,11 +505,11 @@ namespace AppsFlyerSDK /// An af_purchase event with the relevant values will be automatically sent if the validation is successful. /// /// AFPurchaseDetailsAndroid instance. - /// additionalParameters Freehand parameters to be sent with the purchase (if validated). - public void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary additionalParameters, MonoBehaviour gameObject) + /// purchaseAdditionalDetails Freehand parameters to be sent with the purchase (if validated). + public void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject) { #if !UNITY_EDITOR - appsFlyerAndroid.CallStatic("validateAndTrackInAppPurchaseV2", (int)details.purchaseType, details.purchaseToken, details.productId, details.price, details.currency, convertDictionaryToJavaMap(additionalParameters), gameObject ? gameObject.name : null); + appsFlyerAndroid.CallStatic("validateAndTrackInAppPurchaseV2", (int)details.purchaseType, details.purchaseToken, details.productId, convertDictionaryToJavaMap(purchaseAdditionalDetails), gameObject ? gameObject.name : null); #endif } @@ -749,6 +765,65 @@ namespace AppsFlyerSDK return emailsCryptType; } + /// + /// Internal Helper Method. + /// + private static AndroidJavaObject getMediationNetwork(MediationNetwork mediationNetwork) + { + AndroidJavaClass mediationNetworkEnumClass = new AndroidJavaClass("com.appsflyer.MediationNetwork"); + AndroidJavaObject mediationNetworkObject; + + switch (mediationNetwork) + { + case MediationNetwork.IronSource: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("IRONSOURCE"); + break; + case MediationNetwork.ApplovinMax: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("APPLOVIN_MAX"); + break; + case MediationNetwork.GoogleAdMob: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("GOOGLE_ADMOB"); + break; + case MediationNetwork.Fyber: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("FYBER"); + break; + case MediationNetwork.Appodeal: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("APPODEAL"); + break; + case MediationNetwork.Admost: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("ADMOST"); + break; + case MediationNetwork.Topon: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("TOPON"); + break; + case MediationNetwork.Tradplus: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("TRADPLUS"); + break; + case MediationNetwork.Yandex: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("YANDEX"); + break; + case MediationNetwork.ChartBoost: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("CHARTBOOST"); + break; + case MediationNetwork.Unity: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("UNITY"); + break; + case MediationNetwork.ToponPte: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("TOPON_PTE"); + break; + case MediationNetwork.Custom: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("CUSTOM_MEDIATION"); + break; + case MediationNetwork.DirectMonetization: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("DIRECT_MONETIZATION_NETWORK"); + break; + default: + mediationNetworkObject = mediationNetworkEnumClass.GetStatic("NONE"); + break; + } + return mediationNetworkObject; + } + /// /// Internal Helper Method. /// @@ -771,9 +846,6 @@ namespace AppsFlyerSDK return map; } } - #endif - - } \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyerConsent.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyerConsent.cs index 341e530..feb448d 100644 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyerConsent.cs +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyerConsent.cs @@ -10,26 +10,45 @@ namespace AppsFlyerSDK // This class should be used to notify and record the user's applicability // under GDPR, their general consent to data usage, and their consent to personalized // advertisements based on user data. - - // Note that the consent for data usage and ads personalization pair is only applicable when the user is - // subject to GDPR guidelines. Therefore, the following factory methods should be used accordingly: - // - Use [forGDPRUser] when the user is subject to GDPR. - // - Use [forNonGDPRUser] when the user is not subject to GDPR. - // @property isUserSubjectToGDPR Indicates whether GDPR regulations apply to the user (true if the user is - // a subject of GDPR). It also serves as a flag for compliance with relevant aspects of DMA regulations. - // @property hasConsentForDataUsage Indicates whether the user has consented to the use of their data for advertising - // purposes under both GDPR and DMA guidelines (true if the user has consented, nullable if not subject to GDPR). - // @property hasConsentForAdsPersonalization Indicates whether the user has consented to the use of their data for - // personalized advertising within the boundaries of GDPR and DMA rules (true if the user has consented to - // personalized ads, nullable if not subject to GDPR). + /// ## Properties: + /// - `isUserSubjectToGDPR` (optional) - Indicates whether GDPR regulations apply to the user. + /// This may also serve as a general compliance flag for other regional regulations. + /// - `hasConsentForDataUsage` (optional) - Indicates whether the user consents to the processing + /// of their data for advertising purposes. + /// - `hasConsentForAdsPersonalization` (optional) - Indicates whether the user consents to the + /// use of their data for personalized advertising. + /// - `hasConsentForAdStorage` (optional) - Indicates whether the user consents to ad-related storage access. + /// + /// **Usage Example:** + /// ```csharp + /// var consent = new AppsFlyerConsent( + /// isUserSubjectToGDPR: true, + /// hasConsentForDataUsage: true, + /// hasConsentForAdsPersonalization: false, + /// hasConsentForAdStorage: true + /// ); + /// **Deprecated APIs:** + /// - `ForGDPRUser(...)` and `ForNonGDPRUser(...)` should no longer be used. + /// - Use `new AppsFlyerConsent(...)` instead with relevant consent fields. + /// /// public class AppsFlyerConsent { - public bool isUserSubjectToGDPR { get; private set; } - public bool hasConsentForDataUsage { get; private set; } - public bool hasConsentForAdsPersonalization { get; private set; } + public bool? isUserSubjectToGDPR { get; private set; } + public bool? hasConsentForDataUsage { get; private set; } + public bool? hasConsentForAdsPersonalization { get; private set; } + public bool? hasConsentForAdStorage { get; private set; } + public AppsFlyerConsent( bool? isUserSubjectToGDPR = null, bool? hasConsentForDataUsage = null, bool? hasConsentForAdsPersonalization = null, bool? hasConsentForAdStorage = null) + { + this.isUserSubjectToGDPR = isUserSubjectToGDPR; + this.hasConsentForDataUsage = hasConsentForDataUsage; + this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization; + this.hasConsentForAdStorage = hasConsentForAdStorage; + } + + [Obsolete("Use the new constructor with optional booleans instead.")] private AppsFlyerConsent(bool isGDPR, bool hasForDataUsage, bool hasForAdsPersonalization) { isUserSubjectToGDPR = isGDPR; @@ -37,15 +56,16 @@ namespace AppsFlyerSDK hasConsentForAdsPersonalization = hasForAdsPersonalization; } + [Obsolete("Use new AppsFlyerConsent(...) instead.")] public static AppsFlyerConsent ForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization) { return new AppsFlyerConsent(true, hasConsentForDataUsage, hasConsentForAdsPersonalization); } + [Obsolete("Use new AppsFlyerConsent(...) instead.")] public static AppsFlyerConsent ForNonGDPRUser() { - return new AppsFlyerConsent(false, false, false); + return new AppsFlyerConsent(false); } } - } \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs new file mode 100644 index 0000000..ee43009 --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs @@ -0,0 +1,426 @@ +using System.Collections.Generic; +using System.Runtime.InteropServices; +using UnityEngine; +using System; + +namespace AppsFlyerSDK +{ + + public interface IAppsFlyerPurchaseRevenueDataSource + { + Dictionary PurchaseRevenueAdditionalParametersForProducts(HashSet products, HashSet transactions); + } + + public interface IAppsFlyerPurchaseRevenueDataSourceStoreKit2 + { + Dictionary PurchaseRevenueAdditionalParametersStoreKit2ForProducts(HashSet products, HashSet transactions); + } + + public class AppsFlyerPurchaseRevenueBridge : MonoBehaviour + { + #if UNITY_IOS && !UNITY_EDITOR +[DllImport("__Internal")] +private static extern void RegisterUnityPurchaseRevenueParamsCallback(Func callback); + +[DllImport("__Internal")] +private static extern void RegisterUnityPurchaseRevenueParamsCallbackSK2(Func callback); +#endif + + private static IAppsFlyerPurchaseRevenueDataSource _dataSource; + private static IAppsFlyerPurchaseRevenueDataSourceStoreKit2 _dataSourceSK2; + + public static void RegisterDataSource(IAppsFlyerPurchaseRevenueDataSource dataSource) + { + _dataSource = dataSource; + #if UNITY_IOS && !UNITY_EDITOR + RegisterUnityPurchaseRevenueParamsCallback(GetAdditionalParameters); + #elif UNITY_ANDROID && !UNITY_EDITOR + using (AndroidJavaClass jc = new AndroidJavaClass("com.appsflyer.unity.PurchaseRevenueBridge")) + { + jc.CallStatic("setUnityBridge", new UnityPurchaseRevenueBridgeProxy()); + } + #endif + } + + public static void RegisterDataSourceStoreKit2(IAppsFlyerPurchaseRevenueDataSourceStoreKit2 dataSource) + { + #if UNITY_IOS && !UNITY_EDITOR + _dataSourceSK2 = dataSource; + RegisterUnityPurchaseRevenueParamsCallbackSK2(GetAdditionalParametersSK2); + #endif + } + + public static Dictionary GetAdditionalParametersForAndroid(HashSet products, HashSet transactions) + { + return _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions) + ?? new Dictionary(); + } + + #if UNITY_IOS && !UNITY_EDITOR + [AOT.MonoPInvokeCallback(typeof(Func))] + public static string GetAdditionalParameters(string productsJson, string transactionsJson) + { + try + { + HashSet products = new HashSet(); + HashSet transactions = new HashSet(); + + if (!string.IsNullOrEmpty(productsJson)) + { + var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary; + if (dict != null) + { + if (dict.TryGetValue("products", out var productsObj) && productsObj is List productList) + products = new HashSet(productList); + + if (dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List transactionList) + transactions = new HashSet(transactionList); + } + } + + var parameters = _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions) + ?? new Dictionary(); + return AFMiniJSON.Json.Serialize(parameters); + } + catch (Exception e) + { + Debug.LogError($"[AppsFlyer] Exception in GetAdditionalParameters: {e}"); + return "{}"; + } + } + #endif + + #if UNITY_IOS && !UNITY_EDITOR + [AOT.MonoPInvokeCallback(typeof(Func))] + public static string GetAdditionalParametersSK2(string productsJson, string transactionsJson) + { + try + { + HashSet products = new HashSet(); + HashSet transactions = new HashSet(); + + if (!string.IsNullOrEmpty(productsJson)) + { + var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary; + if (dict != null && dict.TryGetValue("products", out var productsObj) && productsObj is List productList) + products = new HashSet(productList); + } + if (!string.IsNullOrEmpty(transactionsJson)) + { + var dict = AFMiniJSON.Json.Deserialize(transactionsJson) as Dictionary; + if (dict != null && dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List transactionList) + transactions = new HashSet(transactionList); + } + + var parameters = _dataSourceSK2?.PurchaseRevenueAdditionalParametersStoreKit2ForProducts(products, transactions) + ?? new Dictionary(); + return AFMiniJSON.Json.Serialize(parameters); + } + catch (Exception e) + { + Debug.LogError($"[AppsFlyer] Exception in GetAdditionalParametersSK2: {e}"); + return "{}"; + } + } + #endif + } + + public class UnityPurchaseRevenueBridgeProxy : AndroidJavaProxy + { + public UnityPurchaseRevenueBridgeProxy() : base("com.appsflyer.unity.PurchaseRevenueBridge$UnityPurchaseRevenueBridge") { } + + public string getAdditionalParameters(string productsJson, string transactionsJson) + { + try + { + // Create empty sets if JSON is null or empty + HashSet products = new HashSet(); + HashSet transactions = new HashSet(); + + // Only try to parse if we have valid JSON + if (!string.IsNullOrEmpty(productsJson)) + { + try + { + // First try to parse as a simple array + var parsedProducts = AFMiniJSON.Json.Deserialize(productsJson); + if (parsedProducts is List productList) + { + products = new HashSet(productList); + } + else if (parsedProducts is Dictionary dict) + { + if (dict.ContainsKey("events") && dict["events"] is List eventsList) + { + products = new HashSet(eventsList); + } + else + { + // If it's a dictionary but doesn't have events, add the whole dict + products.Add(dict); + } + } + } + catch (Exception e) + { + Debug.LogError($"Error parsing products JSON: {e.Message}\nJSON: {productsJson}"); + } + } + + if (!string.IsNullOrEmpty(transactionsJson)) + { + try + { + // First try to parse as a simple array + var parsedTransactions = AFMiniJSON.Json.Deserialize(transactionsJson); + if (parsedTransactions is List transactionList) + { + transactions = new HashSet(transactionList); + } + else if (parsedTransactions is Dictionary dict) + { + if (dict.ContainsKey("events") && dict["events"] is List eventsList) + { + transactions = new HashSet(eventsList); + } + else + { + // If it's a dictionary but doesn't have events, add the whole dict + transactions.Add(dict); + } + } + } + catch (Exception e) + { + Debug.LogError($"Error parsing transactions JSON: {e.Message}\nJSON: {transactionsJson}"); + } + } + + var parameters = AppsFlyerPurchaseRevenueBridge.GetAdditionalParametersForAndroid(products, transactions); + return AFMiniJSON.Json.Serialize(parameters); + } + catch (Exception e) + { + Debug.LogError($"Error in getAdditionalParameters: {e.Message}\nProducts JSON: {productsJson}\nTransactions JSON: {transactionsJson}"); + return "{}"; + } + } + } + + + public class AppsFlyerPurchaseConnector : MonoBehaviour { + + private static AppsFlyerPurchaseConnector instance; + private Dictionary pendingParameters; + private Action> pendingCallback; + + public static AppsFlyerPurchaseConnector Instance + { + get + { + if (instance == null) + { + GameObject go = new GameObject("AppsFlyerPurchaseConnector"); + instance = go.AddComponent(); + DontDestroyOnLoad(go); + } + return instance; + } + } + + private void Awake() + { + if (instance == null) + { + instance = this; + DontDestroyOnLoad(gameObject); + } + else + { + Destroy(gameObject); + } + } + +#if UNITY_ANDROID && !UNITY_EDITOR + private static AndroidJavaClass appsFlyerAndroidConnector = new AndroidJavaClass("com.appsflyer.unity.AppsFlyerAndroidWrapper"); +#endif + + public static void init(MonoBehaviour unityObject, Store s) { +#if UNITY_IOS && !UNITY_EDITOR + _initPurchaseConnector(unityObject.name); +#elif UNITY_ANDROID && !UNITY_EDITOR + int store = mapStoreToInt(s); + appsFlyerAndroidConnector.CallStatic("initPurchaseConnector", unityObject ? unityObject.name : null, store); +#endif + } + + public static void build() { +#if UNITY_IOS && !UNITY_EDITOR + //not for iOS +#elif UNITY_ANDROID && !UNITY_EDITOR + appsFlyerAndroidConnector.CallStatic("build"); + +#else +#endif + } + + public static void startObservingTransactions() { +#if UNITY_IOS && !UNITY_EDITOR + _startObservingTransactions(); +#elif UNITY_ANDROID && !UNITY_EDITOR + appsFlyerAndroidConnector.CallStatic("startObservingTransactions"); +#else +#endif + } + + public static void stopObservingTransactions() { +#if UNITY_IOS && !UNITY_EDITOR + _stopObservingTransactions(); +#elif UNITY_ANDROID && !UNITY_EDITOR + appsFlyerAndroidConnector.CallStatic("stopObservingTransactions"); +#else +#endif + } + + public static void setIsSandbox(bool isSandbox) { +#if UNITY_IOS && !UNITY_EDITOR + _setIsSandbox(isSandbox); +#elif UNITY_ANDROID && !UNITY_EDITOR + appsFlyerAndroidConnector.CallStatic("setIsSandbox", isSandbox); +#else +#endif + } + + public static void setPurchaseRevenueValidationListeners(bool enableCallbacks) { +#if UNITY_IOS && !UNITY_EDITOR + _setPurchaseRevenueDelegate(); +#elif UNITY_ANDROID && !UNITY_EDITOR + appsFlyerAndroidConnector.CallStatic("setPurchaseRevenueValidationListeners", enableCallbacks); +#else +#endif + } + + public static void setAutoLogPurchaseRevenue(params AppsFlyerAutoLogPurchaseRevenueOptions[] autoLogPurchaseRevenueOptions) { +#if UNITY_IOS && !UNITY_EDITOR + int option = 0; + foreach (AppsFlyerAutoLogPurchaseRevenueOptions op in autoLogPurchaseRevenueOptions) { + option = option | (int)op; + } + _setAutoLogPurchaseRevenue(option); +#elif UNITY_ANDROID && !UNITY_EDITOR + if (autoLogPurchaseRevenueOptions.Length == 0) { + return; + } + foreach (AppsFlyerAutoLogPurchaseRevenueOptions op in autoLogPurchaseRevenueOptions) { + switch(op) { + case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsDisabled: + break; + case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsAutoRenewableSubscriptions: + appsFlyerAndroidConnector.CallStatic("setAutoLogSubscriptions", true); + break; + case AppsFlyerAutoLogPurchaseRevenueOptions.AppsFlyerAutoLogPurchaseRevenueOptionsInAppPurchases: + appsFlyerAndroidConnector.CallStatic("setAutoLogInApps", true); + break; + default: + break; + } + } +#else +#endif + } + + public static void setPurchaseRevenueDataSource(IAppsFlyerPurchaseRevenueDataSource dataSource) + { +#if UNITY_IOS && !UNITY_EDITOR + + if (dataSource != null) + { + _setPurchaseRevenueDataSource(dataSource.GetType().Name); + AppsFlyerPurchaseRevenueBridge.RegisterDataSource(dataSource); + } +#elif UNITY_ANDROID && !UNITY_EDITOR + if (dataSource != null) + { + AppsFlyerPurchaseRevenueBridge.RegisterDataSource(dataSource); + } +#endif + } + + + public static void setPurchaseRevenueDataSourceStoreKit2(IAppsFlyerPurchaseRevenueDataSourceStoreKit2 dataSourceSK2) + { +#if UNITY_IOS && !UNITY_EDITOR + if (dataSourceSK2 != null) + { + AppsFlyerPurchaseRevenueBridge.RegisterDataSourceStoreKit2(dataSourceSK2); + _setPurchaseRevenueDataSource("AppsFlyerObjectScript_StoreKit2"); + } +#endif + } + + + private static int mapStoreToInt(Store s) { + switch(s) { + case(Store.GOOGLE): + return 0; + default: + return -1; + } + } + + public static void setStoreKitVersion(StoreKitVersion storeKitVersion) { +#if UNITY_IOS && !UNITY_EDITOR + _setStoreKitVersion((int)storeKitVersion); +#elif UNITY_ANDROID && !UNITY_EDITOR + // Android doesn't use StoreKit +#else +#endif + } + + public static void logConsumableTransaction(string transactionJson) { +#if UNITY_IOS && !UNITY_EDITOR + _logConsumableTransaction(transactionJson); +#elif UNITY_ANDROID && !UNITY_EDITOR + // Android doesn't use StoreKit +#else +#endif + } + +#if UNITY_IOS && !UNITY_EDITOR + + [DllImport("__Internal")] + private static extern void _startObservingTransactions(); + [DllImport("__Internal")] + private static extern void _stopObservingTransactions(); + [DllImport("__Internal")] + private static extern void _setIsSandbox(bool isSandbox); + [DllImport("__Internal")] + private static extern void _setPurchaseRevenueDelegate(); + [DllImport("__Internal")] + private static extern void _setPurchaseRevenueDataSource(string dataSourceName); + [DllImport("__Internal")] + private static extern void _setAutoLogPurchaseRevenue(int option); + [DllImport("__Internal")] + private static extern void _initPurchaseConnector(string objectName); + [DllImport("__Internal")] + private static extern void _setStoreKitVersion(int storeKitVersion); + [DllImport("__Internal")] + private static extern void _logConsumableTransaction(string transactionJson); + +#endif + } + public enum Store { + GOOGLE = 0 + } + public enum AppsFlyerAutoLogPurchaseRevenueOptions + { + AppsFlyerAutoLogPurchaseRevenueOptionsDisabled = 0, + AppsFlyerAutoLogPurchaseRevenueOptionsAutoRenewableSubscriptions = 1 << 0, + AppsFlyerAutoLogPurchaseRevenueOptionsInAppPurchases = 1 << 1 + } + + public enum StoreKitVersion { + SK1 = 0, + SK2 = 1 + } +} \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs.meta b/sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs.meta similarity index 83% rename from sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs.meta rename to sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs.meta index cbcfb3e..dd85a75 100644 --- a/sdk-intergration/Assets/AppsFlyer/AFAdRevenueEvent.cs.meta +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b73b301ad8b6f4b45809980800a9358a +guid: 0636ea07d370d437183f3762280c08ce MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyeriOS.cs b/sdk-intergration/Assets/AppsFlyer/AppsFlyeriOS.cs index e117a8e..a9fd93b 100644 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyeriOS.cs +++ b/sdk-intergration/Assets/AppsFlyer/AppsFlyeriOS.cs @@ -215,7 +215,24 @@ public void startSDK(bool shouldCallback, string CallBackObjectName) public void setConsentData(AppsFlyerConsent appsFlyerConsent) { #if !UNITY_EDITOR - _setConsentData(appsFlyerConsent.isUserSubjectToGDPR, appsFlyerConsent.hasConsentForDataUsage, appsFlyerConsent.hasConsentForAdsPersonalization); + string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null"; + string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null"; + string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null"; + string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null"; + + _setConsentData(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage); +#endif + } + + /// + /// Logs ad revenue data along with additional parameters if provided. + /// + /// instance of AFAdRevenueData containing ad revenue information. + /// An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters. + public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary additionalParameters) + { +#if !UNITY_EDITOR + _logAdRevenue(adRevenueData.monetizationNetwork, adRevenueData.mediationNetwork, adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, AFMiniJSON.Json.Serialize(additionalParameters)); #endif } @@ -337,11 +354,11 @@ public void startSDK(bool shouldCallback, string CallBackObjectName) /// To send and validate in app purchases you can call this method from the processPurchase method. /// /// The AFSDKPurchaseDetailsIOS instance. - /// The extra params, which you want to receive it in the raw reports. - public void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary extraEventValues, MonoBehaviour gameObject) + /// The additional params, which you want to receive it in the raw reports. + public void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject) { #if !UNITY_EDITOR - _validateAndSendInAppPurchaseV2(details.productId, details.price, details.currency, details.transactionId, AFMiniJSON.Json.Serialize(extraEventValues), gameObject ? gameObject.name : null); + _validateAndSendInAppPurchaseV2(details.productId, details.transactionId, (int)details.purchaseType, AFMiniJSON.Json.Serialize(purchaseAdditionalDetails), gameObject ? gameObject.name : null); #endif } @@ -748,7 +765,14 @@ public void startSDK(bool shouldCallback, string CallBackObjectName) #elif UNITY_STANDALONE_OSX [DllImport("AppsFlyerBundle")] #endif - private static extern void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization); + private static extern void _setConsentData(string isUserSubjectToGDPR, string hasConsentForDataUsage, string hasConsentForAdsPersonalization, string hasConsentForAdStorage); + +#if UNITY_IOS + [DllImport("__Internal")] +#elif UNITY_STANDALONE_OSX + [DllImport("AppsFlyerBundle")] +#endif + private static extern void _logAdRevenue(string monetizationNetwork, MediationNetwork mediationNetwork, string currencyIso4217Code, double eventRevenue, string additionalParameters); #if UNITY_IOS [DllImport("__Internal")] @@ -819,7 +843,7 @@ public void startSDK(bool shouldCallback, string CallBackObjectName) #elif UNITY_STANDALONE_OSX [DllImport("AppsFlyerBundle")] #endif - private static extern void _validateAndSendInAppPurchaseV2(string product, string price, string currency, string transactionId, string extraEventValues, string objectName); + private static extern void _validateAndSendInAppPurchaseV2(string product, string transactionId, int purchaseType, string purchaseAdditionalDetails, string objectName); #if UNITY_IOS [DllImport("__Internal")] diff --git a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml b/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml deleted file mode 100644 index 4a7f376..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml.meta b/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml.meta deleted file mode 100644 index b48efbb..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6110ce30bf7674268814dc9e0395f8b0 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml b/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml index 458e853..a2b8e95 100644 --- a/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml +++ b/sdk-intergration/Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml @@ -2,17 +2,15 @@ - - - - - - + + + + - - + + diff --git a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerAndroidBridge.cs b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerAndroidBridge.cs index b4c8188..3a83bc3 100644 --- a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerAndroidBridge.cs +++ b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerAndroidBridge.cs @@ -22,7 +22,7 @@ namespace AppsFlyerSDK string getAttributionId(); void handlePushNotifications(); void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary additionalParameters, MonoBehaviour gameObject); - void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary additionalParameters, MonoBehaviour gameObject); + void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject); void setCollectOaid(bool isCollect); void setDisableAdvertisingIdentifiers(bool disable); void setDisableNetworkData(bool disable); diff --git a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerIOSBridge.cs b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerIOSBridge.cs index 86211fb..4de6fd4 100644 --- a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerIOSBridge.cs +++ b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerIOSBridge.cs @@ -14,7 +14,7 @@ namespace AppsFlyerSDK void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox); void setUseUninstallSandbox(bool useUninstallSandbox); void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, Dictionary additionalParameters, MonoBehaviour gameObject); - void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary extraEventValues, MonoBehaviour gameObject); + void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary purchaseAdditionalDetails, MonoBehaviour gameObject); void registerUninstall(byte[] deviceToken); void handleOpenUrl(string url, string sourceApplication, string annotation); void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval); diff --git a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerNativeBridge.cs b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerNativeBridge.cs index fb1a9cf..23a107c 100644 --- a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerNativeBridge.cs +++ b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerNativeBridge.cs @@ -43,6 +43,8 @@ namespace AppsFlyerSDK void setConsentData(AppsFlyerConsent appsFlyerConsent); + void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary additionalParameters); + void setMinTimeBetweenSessions(int seconds); void setHost(string hostPrefixName, string hostName); diff --git a/sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs new file mode 100644 index 0000000..73591a3 --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs @@ -0,0 +1,8 @@ +namespace AppsFlyerSDK +{ + public interface IAppsFlyerPurchaseValidation + { + void didReceivePurchaseRevenueValidationInfo(string validationInfo); + void didReceivePurchaseRevenueError(string error); + } +} \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs.meta b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs.meta similarity index 83% rename from sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs.meta rename to sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs.meta index af22f2f..3e453b7 100644 --- a/sdk-intergration/Assets/AppsFlyer/AppsFlyerAdRevenue.cs.meta +++ b/sdk-intergration/Assets/AppsFlyer/IAppsFlyerPurchaseValidation.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 644005ac4602e4b78ad3a8d4d29e329d +guid: 7c60f499ae0d048b1be8ffd6878a184c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents.meta deleted file mode 100644 index 4b06604..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 28175da64865f4e398b3b9ddfbe97b24 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/Info.plist.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/Info.plist.meta deleted file mode 100644 index dac263e..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/Info.plist.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 58a86b0b376564c06bf8ce29e1dbfb04 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS.meta deleted file mode 100644 index b55a757..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 218a2e7ff5a4c461981bc41f7d7bfeba -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle old mode 100644 new mode 100755 diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle.meta deleted file mode 100644 index a6e35c7..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0889edee891d84a8eb0b7cc87071b91e -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature.meta deleted file mode 100644 index d3cac98..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 16068f30788004029bd487756623799b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature/CodeResources.meta b/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature/CodeResources.meta deleted file mode 100644 index 4cbf196..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature/CodeResources.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 724b52b308e9a4a6d889d7bf3945a2ca -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift new file mode 100644 index 0000000..e44f781 --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift @@ -0,0 +1,79 @@ +import Foundation +import StoreKit + +#if canImport(PurchaseConnector) +import PurchaseConnector + +@available(iOS 15.0, *) +@objc +public class AFUnityStoreKit2Bridge: NSObject { + @objc + public static func fetchAFSDKTransactionSK2(withTransactionId transactionId: String, completion: @escaping (AFSDKTransactionSK2?) -> Void) { + guard let transactionIdUInt64 = UInt64(transactionId) else { + print("Invalid transaction ID format.") + completion(nil) + return + } + Task { + for await result in StoreKit.Transaction.all { + if case .verified(let transaction) = result, transaction.id == transactionIdUInt64 { + let afTransaction = AFSDKTransactionSK2(transaction: transaction) + DispatchQueue.main.async { + completion(afTransaction) + } + return + } + } + DispatchQueue.main.async { + completion(nil) + } + } + } + + @objc + public static func extractSK2ProductInfo(_ products: [AFSDKProductSK2]) -> NSArray { + var result: [[String: Any]] = [] + + for product in products { + if let swiftProduct = Mirror(reflecting: product).children.first(where: { $0.label == "product" })?.value { + let productId = (swiftProduct as? NSObject)?.value(forKey: "id") as? String ?? "" + let title = (swiftProduct as? NSObject)?.value(forKey: "displayName") as? String ?? "" + let desc = (swiftProduct as? NSObject)?.value(forKey: "description") as? String ?? "" + let price = (swiftProduct as? NSObject)?.value(forKey: "price") as? NSDecimalNumber ?? 0 + + result.append([ + "productIdentifier": productId, + "localizedTitle": title, + "localizedDescription": desc, + "price": price + ]) + } + } + + return result as NSArray + } + + @objc + public static func extractSK2TransactionInfo(_ transactions: [AFSDKTransactionSK2]) -> NSArray { + var result: [[String: Any]] = [] + + for txn in transactions { + guard let mirrorChild = Mirror(reflecting: txn).children.first(where: { $0.label == "transaction" }), + let swiftTxn = mirrorChild.value as? StoreKit.Transaction else { + continue + } + + let transactionId = "\(swiftTxn.id)" + let date = NSNumber(value: swiftTxn.purchaseDate.timeIntervalSince1970) + + result.append([ + "transactionIdentifier": transactionId, + "transactionState": "verified", // or skip this line + "transactionDate": date + ]) + } + + return result as NSArray + } +} +#endif diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta new file mode 100644 index 0000000..41ea24f --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5652805602a6b4273a6e527b00aea272 \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h index c838a93..d3fec43 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h @@ -17,6 +17,8 @@ static NSArray *NSArrayFromCArray(int length, const char **arr); static char* getCString(const char* string); static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator); static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt); +static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetwork); +static NSNumber *intFromNullableBool(const char *cStr); static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult); static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result); diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm index 59e0163..611f269 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm @@ -108,6 +108,72 @@ static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt){ return emailCryptType; } +static NSNumber *intFromNullableBool(const char *cStr) { + if (!cStr) return nil; + NSString *str = [NSString stringWithUTF8String:cStr]; + + if ([str caseInsensitiveCompare:@"true"] == NSOrderedSame) { + return @YES; + } else if ([str caseInsensitiveCompare:@"false"] == NSOrderedSame) { + return @NO; + } + return nil; +} + +static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetworkInt){ + + AppsFlyerAdRevenueMediationNetworkType mediationNetworkType; + switch (mediationNetworkInt){ + case 1: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob; + break; + case 2: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeIronSource; + break; + case 3: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeApplovinMax; + break; + case 4: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeFyber; + break; + case 5: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeAppodeal; + break; + case 6: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeAdmost; + break; + case 7: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeTopon; + break; + case 8: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeTradplus; + break; + case 9: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeYandex; + break; + case 10: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeChartBoost; + break; + case 11: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeUnity; + break; + case 12: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeToponPte; + break; + case 13: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeCustom; + break; + case 14: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeDirectMonetization; + break; + default: + mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeCustom; + break; + } + + return mediationNetworkType; +} + static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult){ NSString* result; switch (deepLinkResult){ diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m index 017a1c7..f877576 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m @@ -29,6 +29,34 @@ static IMP __original_openUrl_Imp __unused; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ +#if !AFSDK_SHOULD_SWIZZLE + + id swizzleFlag = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppsFlyerShouldSwizzle"]; + BOOL shouldSwizzle = swizzleFlag ? [swizzleFlag boolValue] : NO; + + if(shouldSwizzle){ + + Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:)); + __original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive); + + Method method2 = class_getInstanceMethod([self class], @selector(applicationDidEnterBackground:)); + __original_applicationDidEnterBackground_Imp = method_setImplementation(method2, (IMP)__swizzled_applicationDidEnterBackground); + + + Method method3 = class_getInstanceMethod([self class], @selector(didReceiveRemoteNotification:)); + __original_didReceiveRemoteNotification_Imp = method_setImplementation(method3, (IMP)__swizzled_didReceiveRemoteNotification); + + + Method method4 = class_getInstanceMethod([self class], @selector(application:openURL:options:)); + __original_openUrl_Imp = method_setImplementation(method4, (IMP)__swizzled_openURL); + + if (_AppsFlyerdelegate == nil) { + _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; + } + + [self swizzleContinueUserActivity:[self class]]; + } +#elif AFSDK_SHOULD_SWIZZLE Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:)); __original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive); @@ -48,6 +76,10 @@ static IMP __original_openUrl_Imp __unused; } [self swizzleContinueUserActivity:[self class]]; + +#endif + + }); } diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h deleted file mode 100644 index 879168d..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppsFlyerAdRevenueWrapper.h -// Unity-iPhone -// -// Created by Jonathan Wesfield on 01/12/2019. -// - -#import - -#if __has_include() -#import -#endif - -@interface AppsFlyerAdRevenueWrapper : NSObject - -@end diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h.meta b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h.meta deleted file mode 100644 index c7301b1..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.h.meta +++ /dev/null @@ -1,27 +0,0 @@ -fileFormatVersion: 2 -guid: 7fa891a95d71c459daa1e92ee7a653ab -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm deleted file mode 100644 index c2ff0ec..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm +++ /dev/null @@ -1,51 +0,0 @@ -// -// AppsFlyerAdRevenueWrapper.mm -// Unity-iPhone -// -// Created by Jonathan Wesfield on 25/11/2019. -// - -#import "AppsFlyerAdRevenueWrapper.h" - - -@implementation AppsFlyerAdRevenueWrapper - - -extern "C" { - - NSString* stringFromChar(const char *str) { - return str ? [NSString stringWithUTF8String:str] : nil; - } - - NSDictionary* dictionaryFromJson(const char *jsonString) { - if(jsonString){ - NSData *jsonData = [[NSData alloc] initWithBytes:jsonString length:strlen(jsonString)]; - NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; - return dictionary; - } - return nil; - } - - - const void _start(int length, int* adRevenueTypes){ - [AppsFlyerAdRevenue start]; - } - const void _setIsDebugAdrevenue(bool isDebug){ - [[AppsFlyerAdRevenue shared] setIsDebug:isDebug]; - } - - const void _logAdRevenue(const char* monetizationNetwork, - int mediationNetwork, - double eventRevenue, - const char* revenueCurrency, - const char* additionalParameters){ - [[AppsFlyerAdRevenue shared] logAdRevenueWithMonetizationNetwork:stringFromChar(monetizationNetwork) - mediationNetwork:(AppsFlyerAdRevenueMediationNetworkType) mediationNetwork - eventRevenue:[NSNumber numberWithDouble:eventRevenue] - revenueCurrency:stringFromChar(revenueCurrency) - additionalParameters:dictionaryFromJson(additionalParameters)]; - - } -} - -@end diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm.meta b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm.meta deleted file mode 100644 index b864f3c..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAdRevenueWrapper.mm.meta +++ /dev/null @@ -1,37 +0,0 @@ -fileFormatVersion: 2 -guid: 84d99cf0f930e4c80b4bc1858e042b70 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: {} - - first: - tvOS: tvOS - second: - enabled: 1 - settings: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm index e722cdd..3e492c0 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm @@ -101,6 +101,11 @@ @end +#if !(AFSDK_SHOULD_SWIZZLE) + +IMPL_APP_CONTROLLER_SUBCLASS(AppsFlyerAppController) + +#endif /** Note if you would not like to use IMPL_APP_CONTROLLER_SUBCLASS you can replace it with the code below. diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h index d4cd3c3..cf73afe 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h @@ -13,10 +13,27 @@ #else #import "AppsFlyerLib.h" #endif +#if __has_include() +#import +#else +#import "PurchaseConnector.h" +#endif +#import + +// Add StoreKit 2 support +#if __has_include() +#import +#endif + +@interface AppsFlyeriOSWarpper : NSObject -@interface AppsFlyeriOSWarpper : NSObject + (BOOL) didCallStart; + (void) setDidCallStart:(BOOL)val; + +// Add StoreKit 2 methods +- (void)setStoreKitVersion:(int)storeKitVersion; +- (void)logConsumableTransaction:(id)transaction; + @end @@ -48,3 +65,7 @@ static NSString* startRequestObjectName = @""; static NSString* inAppRequestObjectName = @""; static NSString* onDeeplinkingObjectName = @""; +static const char* PURCHASE_REVENUE_VALIDATION_CALLBACK = "didReceivePurchaseRevenueValidationInfo"; +static const char* PURCHASE_REVENUE_ERROR_CALLBACK = "didReceivePurchaseRevenueError"; + +static NSString* onPurchaseValidationObjectName = @""; diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm index 1af3464..89a23e6 100644 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm +++ b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm @@ -6,7 +6,22 @@ // #import "AppsFlyeriOSWrapper.h" +#import +#import +#import "UnityFramework/UnityFramework-Swift.h" + +#if __has_include() +#import +#elif __has_include("PurchaseConnector-Swift.h") +#import "PurchaseConnector-Swift.h" +#endif + +#if __has_include() +#import +#elif __has_include("UnityFramework-Swift.h") +#import "UnityFramework-Swift.h" +#endif static void unityCallBack(NSString* objectName, const char* method, const char* msg) { if(objectName){ @@ -18,7 +33,7 @@ extern "C" { const void _startSDK(bool shouldCallback, const char* objectName) { [[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity - pluginVersion:@"6.14.3" + pluginVersion:@"6.17.7" additionalParams:nil]; startRequestObjectName = stringFromChar(objectName); AppsFlyeriOSWarpper.didCallStart = YES; @@ -87,14 +102,26 @@ extern "C" { [[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData]; } - const void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization) { - AppsFlyerConsent *consentData = nil; - if (isUserSubjectToGDPR) { - consentData = [[AppsFlyerConsent alloc] initForGDPRUserWithHasConsentForDataUsage:hasConsentForDataUsage hasConsentForAdsPersonalization:hasConsentForAdsPersonalization]; - } else { - consentData = [[AppsFlyerConsent alloc] initNonGDPRUser]; - } - [[AppsFlyerLib shared] setConsentData:consentData]; + const void _setConsentData(const char* isUserSubjectToGDPR, const char* hasConsentForDataUsage, const char* hasConsentForAdsPersonalization, const char* hasConsentForAdStorage) { + + NSNumber *gdpr = intFromNullableBool(isUserSubjectToGDPR); + NSNumber *dataUsage = intFromNullableBool(hasConsentForDataUsage); + NSNumber *adsPersonalization = intFromNullableBool(hasConsentForAdsPersonalization); + NSNumber *adStorage = intFromNullableBool(hasConsentForAdStorage); + + AppsFlyerConsent *consentData = [[AppsFlyerConsent alloc] initWithIsUserSubjectToGDPR:gdpr + hasConsentForDataUsage:dataUsage + hasConsentForAdsPersonalization:adsPersonalization + hasConsentForAdStorage:adStorage]; + + [[AppsFlyerLib shared] setConsentData:consentData]; + } + + const void _logAdRevenue(const char* monetizationNetwork, int mediationNetworkInt, const char* currencyIso4217Code, double eventRevenue, const char* additionalParameters) { + AppsFlyerAdRevenueMediationNetworkType mediationNetwork = mediationNetworkTypeFromInt(mediationNetworkInt); + NSNumber *number = [NSNumber numberWithDouble:eventRevenue]; + AFAdRevenueData *adRevenue = [[AFAdRevenueData alloc] initWithMonetizationNetwork:stringFromChar(monetizationNetwork) mediationNetwork:mediationNetwork currencyIso4217Code:stringFromChar(currencyIso4217Code) eventRevenue:number]; + [[AppsFlyerLib shared] logAdRevenue: adRevenue additionalParameters:dictionaryFromJson(additionalParameters)]; } const void _setDisableCollectIAd (bool disableCollectASA) { @@ -261,21 +288,38 @@ extern "C" { }]; } - const void _validateAndSendInAppPurchaseV2 (const char* product, const char* price, const char* currency, const char* transactionId, const char* extraEventValues, const char* objectName) { + const void _validateAndSendInAppPurchaseV2 (const char* product, const char* transactionId, int purchaseType, const char* purchaseAdditionalDetails, const char* objectName) { validateAndLogObjectName = stringFromChar(objectName); - AFSDKPurchaseDetails *details = [[AFSDKPurchaseDetails alloc] initWithProductId:stringFromChar(product) price:stringFromChar(price) currency:stringFromChar(currency) transactionId:stringFromChar(transactionId)]; + AFSDKPurchaseDetails *details = [[AFSDKPurchaseDetails alloc] initWithProductId:stringFromChar(product) transactionId:stringFromChar(transactionId) purchaseType:(AFSDKPurchaseType)purchaseType]; [[AppsFlyerLib shared] validateAndLogInAppPurchase:details - extraEventValues:dictionaryFromJson(extraEventValues) - completionHandler:^(AFSDKValidateAndLogResult * _Nullable result) { - if (result.status == AFSDKValidateAndLogStatusSuccess) { - unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.result)); - } else if (result.status == AFSDKValidateAndLogStatusFailure) { - unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.errorData)); + purchaseAdditionalDetails:dictionaryFromJson(purchaseAdditionalDetails) + completion:^(NSDictionary * _Nullable response, NSError * _Nullable error) { + if (error) { + unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(dictionaryFromNSError(error))); } else { - unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(dictionaryFromNSError(result.error))); + // Check if the response indicates validation failure + BOOL isValidationFailure = NO; + if (response && [response isKindOfClass:[NSDictionary class]]) { + NSDictionary *resultDict = response[@"result"]; + if (resultDict && [resultDict isKindOfClass:[NSDictionary class]]) { + NSDictionary *responseForProduct = resultDict.allValues.firstObject; + if (responseForProduct && [responseForProduct isKindOfClass:[NSDictionary class]]) { + BOOL validationResult = [responseForProduct[@"result"] boolValue]; + if (!validationResult) { + isValidationFailure = YES; + } + } + } + } + + if (isValidationFailure) { + unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(response)); + } else { + unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(response)); + } } }]; @@ -325,6 +369,97 @@ extern "C" { [AppsFlyerLib shared].disableIDFVCollection = isDisabled; } + // Purchase connector + const void _startObservingTransactions() { + [[PurchaseConnector shared] startObservingTransactions]; + } + + const void _stopObservingTransactions() { + [[PurchaseConnector shared] stopObservingTransactions]; + } + + const void _setIsSandbox(bool isSandBox) { + [[PurchaseConnector shared] setIsSandbox:isSandBox]; + } + + const void _setPurchaseRevenueDelegate() { + if (_AppsFlyerdelegate== nil) { + _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; + } + [[PurchaseConnector shared] setPurchaseRevenueDelegate:_AppsFlyerdelegate]; + } + + const void _setAutoLogPurchaseRevenue(int option) { + [[PurchaseConnector shared] setAutoLogPurchaseRevenue:option]; + + } + + const void _initPurchaseConnector(const char* objectName) { + if (_AppsFlyerdelegate == nil) { + _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; + } + onPurchaseValidationObjectName = stringFromChar(objectName); + } + + const void _setPurchaseRevenueDataSource(const char* objectName) { + if (_AppsFlyerdelegate == nil) { + _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; + } + + if (strstr(objectName, "StoreKit2") != NULL) { + + // Force protocol conformance + Protocol *sk2Protocol = @protocol(AppsFlyerPurchaseRevenueDataSourceStoreKit2); + class_addProtocol([_AppsFlyerdelegate class], sk2Protocol); + + if (![_AppsFlyerdelegate conformsToProtocol:@protocol(AppsFlyerPurchaseRevenueDataSourceStoreKit2)]) { + NSLog(@"[AppsFlyer] Warning: SK2 protocol not conformed!"); + } + } + + [PurchaseConnector shared].purchaseRevenueDataSource = _AppsFlyerdelegate; + } + + const void _setStoreKitVersion(int storeKitVersion) { + [[PurchaseConnector shared] setStoreKitVersion:(AFSDKStoreKitVersion)storeKitVersion]; + } + + const void _logConsumableTransaction(const char* transactionId) { + if (@available(iOS 15.0, *)) { + NSString *transactionIdStr = [NSString stringWithUTF8String:transactionId]; + [AFUnityStoreKit2Bridge fetchAFSDKTransactionSK2WithTransactionId:transactionIdStr completion:^(AFSDKTransactionSK2 *afTransaction) { + if (afTransaction) { + [[PurchaseConnector shared] logConsumableTransaction:afTransaction]; + } else { + NSLog(@"No AFSDKTransactionSK2 found for id %@", transactionIdStr); + } + }]; + } + } + + #ifdef __cplusplus + extern "C" { + #endif + + typedef const char *(*UnityPurchaseCallback)(const char *, const char *); + + UnityPurchaseCallback UnityPurchasesGetAdditionalParamsCallback = NULL; + UnityPurchaseCallback UnityPurchasesGetAdditionalParamsCallbackSK2 = NULL; + + __attribute__((visibility("default"))) + void RegisterUnityPurchaseRevenueParamsCallback(UnityPurchaseCallback callback) { + UnityPurchasesGetAdditionalParamsCallback = callback; + } + + __attribute__((visibility("default"))) + void RegisterUnityPurchaseRevenueParamsCallbackSK2(UnityPurchaseCallback callback) { + UnityPurchasesGetAdditionalParamsCallbackSK2 = callback; + } + + + #ifdef __cplusplus + } + #endif } @implementation AppsFlyeriOSWarpper @@ -366,5 +501,120 @@ static BOOL didCallStart; unityCallBack(onDeeplinkingObjectName, ON_DEEPLINKING, stringFromdictionary(dict)); } +// Purchase Connector +- (void)didReceivePurchaseRevenueValidationInfo:(NSDictionary *)validationInfo error:(NSError *)error { + if (error != nil) { + unityCallBack(onPurchaseValidationObjectName, PURCHASE_REVENUE_ERROR_CALLBACK, [[error localizedDescription] UTF8String]); + } else { + unityCallBack(onPurchaseValidationObjectName, PURCHASE_REVENUE_VALIDATION_CALLBACK, stringFromdictionary(validationInfo)); + } +} + +- (NSDictionary *)purchaseRevenueAdditionalParametersForProducts:(NSSet *)products + transactions:(NSSet *)transactions { + + NSMutableArray *productsArray = [NSMutableArray array]; + for (SKProduct *product in products) { + [productsArray addObject:@{ + @"productIdentifier": product.productIdentifier ?: @"", + @"localizedTitle": product.localizedTitle ?: @"", + @"localizedDescription": product.localizedDescription ?: @"", + @"price": [product.price stringValue] ?: @"" + }]; + } + + NSMutableArray *transactionsArray = [NSMutableArray array]; + for (SKPaymentTransaction *txn in transactions) { + [transactionsArray addObject:@{ + @"transactionIdentifier": txn.transactionIdentifier ?: @"", + @"transactionState": @(txn.transactionState), + @"transactionDate": txn.transactionDate ? [@(txn.transactionDate.timeIntervalSince1970) stringValue] : @"" + }]; + } + + NSDictionary *input = @{ + @"products": productsArray, + @"transactions": transactionsArray + }; + + NSError *error = nil; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:input options:0 error:&error]; + if (error || !jsonData) { + NSLog(@"[AppsFlyer] Failed to serialize Unity purchase data: %@", error); + return @{}; + } + + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + if (!jsonString || !UnityPurchasesGetAdditionalParamsCallback) { + NSLog(@"[AppsFlyer] Unity callback not registered"); + return @{}; + } + + const char *resultCStr = UnityPurchasesGetAdditionalParamsCallback([jsonString UTF8String], ""); + if (!resultCStr) { + NSLog(@"[AppsFlyer] Unity callback returned null"); + return @{}; + } + + NSString *resultJson = [NSString stringWithUTF8String:resultCStr]; + NSData *resultData = [resultJson dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *parsedResult = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&error]; + + if (error || ![parsedResult isKindOfClass:[NSDictionary class]]) { + NSLog(@"[AppsFlyer] Failed to parse Unity response: %@", error); + return @{}; + } + + return parsedResult; +} + +#pragma mark - AppsFlyerPurchaseRevenueDataSourceStoreKit2 +- (NSDictionary *)purchaseRevenueAdditionalParametersStoreKit2ForProducts:(NSSet *)products transactions:(NSSet *)transactions { + if (@available(iOS 15.0, *)) { + NSArray *productInfoArray = [AFUnityStoreKit2Bridge extractSK2ProductInfo:[products allObjects]]; + NSArray *transactionInfoArray = [AFUnityStoreKit2Bridge extractSK2TransactionInfo:[transactions allObjects]]; + + NSDictionary *input = @{ + @"products": productInfoArray, + @"transactions": transactionInfoArray + }; + + if (UnityPurchasesGetAdditionalParamsCallbackSK2) { + NSError *error = nil; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:input options:0 error:&error]; + if (error || !jsonData) { + NSLog(@"[AppsFlyer] Failed to serialize Unity purchase data: %@", error); + return @{}; + } + + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + + const char *resultCStr = UnityPurchasesGetAdditionalParamsCallbackSK2([jsonString UTF8String], ""); + if (!resultCStr) { + NSLog(@"[AppsFlyer] Unity callback returned null"); + return @{}; + } + + NSString *resultJson = [NSString stringWithUTF8String:resultCStr]; + + NSData *resultData = [resultJson dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *parsedResult = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&error]; + + if (error || ![parsedResult isKindOfClass:[NSDictionary class]]) { + NSLog(@"[AppsFlyer] Failed to parse Unity response: %@", error); + return @{}; + } + + return parsedResult; + } else { + NSLog(@"[AppsFlyer] SK2 - Unity callback is NOT registered"); + } + } else { + NSLog(@"[AppsFlyer] SK2 - iOS version not supported"); + } + return @{}; +} + @end + diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift deleted file mode 100644 index 521d0e4..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift +++ /dev/null @@ -1 +0,0 @@ -import Foundation \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift.meta b/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift.meta deleted file mode 100644 index b24f741..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Plugins/iOS/SwiftForUnity.swift.meta +++ /dev/null @@ -1,37 +0,0 @@ -fileFormatVersion: 2 -guid: a631431c30cca4ac2bb4b40fc67e4005 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: {} - - first: - tvOS: tvOS - second: - enabled: 1 - settings: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs b/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs new file mode 100644 index 0000000..536190f --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs @@ -0,0 +1,184 @@ +#nullable enable + +using System.Collections; +using System.Collections.Generic; +using System; +using UnityEngine; + +[System.Serializable] +public class InAppPurchaseValidationResult : EventArgs +{ + public bool success; + public ProductPurchase? productPurchase; + public ValidationFailureData? failureData; + public string? token; +} + +[System.Serializable] +public class ProductPurchase +{ + public string? kind; + public string? purchaseTimeMillis; + public int purchaseState; + public int consumptionState; + public string? developerPayload; + public string? orderId; + public int purchaseType; + public int acknowledgementState; + public string? purchaseToken; + public string? productId; + public int quantity; + public string? obfuscatedExternalAccountId; + public string? obfuscatedExternalProfil; + public string? regionCode; +} + +[System.Serializable] +public class ValidationFailureData +{ + public int status; + public string? description; +} + +[System.Serializable] +public class SubscriptionValidationResult +{ + public bool success; + public SubscriptionPurchase? subscriptionPurchase; + public ValidationFailureData? failureData; + public string? token; +} + +[System.Serializable] +public class SubscriptionPurchase +{ + public string? acknowledgementState; + public CanceledStateContext? canceledStateContext; + public ExternalAccountIdentifiers? externalAccountIdentifiers; + public string? kind; + public string? latestOrderId; + public List? lineItems; + public string? linkedPurchaseToken; + public PausedStateContext? pausedStateContext; + public string? regionCode; + public string? startTime; + public SubscribeWithGoogleInfo? subscribeWithGoogleInfo; + public string? subscriptionState; + public TestPurchase? testPurchase; +} + +[System.Serializable] +public class CanceledStateContext +{ + public DeveloperInitiatedCancellation? developerInitiatedCancellation; + public ReplacementCancellation? replacementCancellation; + public SystemInitiatedCancellation? systemInitiatedCancellation; + public UserInitiatedCancellation? userInitiatedCancellation; + +} + +[System.Serializable] +public class ExternalAccountIdentifiers +{ + public string? externalAccountId; + public string? obfuscatedExternalAccountId; + public string? obfuscatedExternalProfileId; +} + +[System.Serializable] +public class SubscriptionPurchaseLineItem +{ + public AutoRenewingPlan? autoRenewingPlan; + public DeferredItemReplacement? deferredItemReplacement; + public string? expiryTime; + public OfferDetails? offerDetails; + public PrepaidPlan? prepaidPlan; + public string? productId; +} + +[System.Serializable] +public class PausedStateContext +{ + public string? autoResumeTime; +} + +[System.Serializable] +public class SubscribeWithGoogleInfo +{ + public string? emailAddress; + public string? familyName; + public string? givenName; + public string? profileId; + public string? profileName; +} + +[System.Serializable] +public class TestPurchase{} + +[System.Serializable] +public class DeveloperInitiatedCancellation{} + +[System.Serializable] +public class ReplacementCancellation{} + +[System.Serializable] +public class SystemInitiatedCancellation{} + +[System.Serializable] +public class UserInitiatedCancellation +{ + public CancelSurveyResult? cancelSurveyResult; + public string? cancelTime; +} + +[System.Serializable] +public class AutoRenewingPlan +{ + public string? autoRenewEnabled; + public SubscriptionItemPriceChangeDetails? priceChangeDetails; +} + +[System.Serializable] +public class DeferredItemReplacement +{ + public string? productId; +} + +[System.Serializable] +public class OfferDetails +{ + public List? offerTags; + public string? basePlanId; + public string? offerId; +} + +[System.Serializable] +public class PrepaidPlan +{ + public string? allowExtendAfterTime; +} + +[System.Serializable] +public class CancelSurveyResult +{ + public string? reason; + public string? reasonUserInput; +} + +[System.Serializable] +public class SubscriptionItemPriceChangeDetails +{ + public string? expectedNewPriceChargeTime; + public Money? newPrice; + public string? priceChangeMode; + public string? priceChangeState; +} + +[System.Serializable] + public class Money + { + public string? currencyCode; + public long nanos; + public long units; + } + \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs.meta b/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs.meta new file mode 100644 index 0000000..7fdbf37 --- /dev/null +++ b/sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a1435104a69d4c8ebcc6f237cc29a54 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests.meta b/sdk-intergration/Assets/AppsFlyer/Tests.meta deleted file mode 100644 index 8217a6a..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1f19f272c71674582bed1d93925da003 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll b/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll deleted file mode 100644 index 268e311..0000000 Binary files a/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll and /dev/null differ diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll.meta b/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll.meta deleted file mode 100644 index 14cc646..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/Castle.Core.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 7b5b4579db85b4cfd8395bfb19aa309e -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll b/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll deleted file mode 100644 index f32e491..0000000 Binary files a/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll and /dev/null differ diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll.meta b/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll.meta deleted file mode 100644 index b716f6a..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/NSubstitute.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 642cf65ed2573419bab7e7d44fc73181 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll b/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll deleted file mode 100644 index c5ba4e4..0000000 Binary files a/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll and /dev/null differ diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll.meta b/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll.meta deleted file mode 100644 index fca3770..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/System.Runtime.CompilerServices.Unsafe.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 3a5ccbd864ba94a9a9ba47895ff14922 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll b/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll deleted file mode 100644 index dfc4cdf..0000000 Binary files a/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll and /dev/null differ diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll.meta b/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll.meta deleted file mode 100644 index cb661ca..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/System.Threading.Tasks.Extensions.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: ee45ae2608f3c44d08fc6e21a94d133f -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef b/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef deleted file mode 100644 index 4d10363..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Tests", - "references": [ - "UnityEngine.TestRunner", - "UnityEditor.TestRunner", - "AppsFlyer" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": true, - "precompiledReferences": [ - "nunit.framework.dll", - "NSubstitute.dll", - "Castle.Core.dll", - "System.Threading.Tasks.Extensions.dll" - ], - "autoReferenced": false, - "defineConstraints": [ - "UNITY_INCLUDE_TESTS" - ], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef.meta b/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef.meta deleted file mode 100644 index 2778008..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/Tests.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 1f155a0e4c9ab48eeb4b54b2dc0aeba7 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs b/sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs deleted file mode 100644 index 9523131..0000000 --- a/sdk-intergration/Assets/AppsFlyer/Tests/Tests_Suite.cs +++ /dev/null @@ -1,810 +0,0 @@ -using System.Collections.Generic; -using NUnit.Framework; -using UnityEngine; -using NSubstitute; - -namespace AppsFlyerSDK.Tests -{ - public class NewTestScript - { - - [Test] - public void test_startSDK_called() - { - var AppsFlyerMOCKInterface = Substitute.For(); - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.startSDK(); - AppsFlyerMOCKInterface.Received().startSDK(Arg.Any(), Arg.Any()); - - } - - [Test] - public void test_sendEvent_withValues() - { - var AppsFlyerMOCKInterface = Substitute.For(); - AppsFlyer.instance = AppsFlyerMOCKInterface; - var eventParams = new Dictionary(); - eventParams.Add("key", "value"); - AppsFlyer.sendEvent("testevent", eventParams); - AppsFlyerMOCKInterface.Received().sendEvent("testevent", eventParams, false, null); - } - - [Test] - public void test_sendEvent_withNullParams() - { - var AppsFlyerMOCKInterface = Substitute.For(); - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.sendEvent("testevent", null); - AppsFlyerMOCKInterface.Received().sendEvent("testevent", null,false, null); - } - - - [Test] - public void test_isSDKStopped_true() - { - var AppsFlyerMOCKInterface = Substitute.For(); - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.stopSDK(true); - - AppsFlyerMOCKInterface.Received().stopSDK(true); - - } - - [Test] - public void test_isSDKStopped_false() - { - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - AppsFlyer.stopSDK(false); - - AppsFlyerMOCKInterface.Received().stopSDK(false); - - } - - [Test] - public void test_isSDKStopped_called() - { - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - var isSDKStopped = AppsFlyer.isSDKStopped(); - - AppsFlyerMOCKInterface.Received().isSDKStopped(); - - } - - [Test] - public void test_isSDKStopped_receveivedFalse() - { - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - var isSDKStopped = AppsFlyer.isSDKStopped(); - - Assert.AreEqual(AppsFlyerMOCKInterface.Received().isSDKStopped(), false); - - - } - - - [Test] - public void test_getSdkVersion_called() - { - var AppsFlyerMOCKInterface = Substitute.For(); - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.getSdkVersion(); - AppsFlyerMOCKInterface.Received().getSdkVersion(); - } - - [Test] - public void test_setCustomerUserId_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCustomerUserId("test"); - AppsFlyerMOCKInterface.Received().setCustomerUserId("test"); - - } - - [Test] - public void Test_setAppInviteOneLinkID_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setAppInviteOneLinkID("2f36"); - AppsFlyerMOCKInterface.Received().setAppInviteOneLinkID("2f36"); - - } - - [Test] - public void Test_setAdditionalData_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - var customData = new Dictionary(); - customData.Add("test", "test"); - AppsFlyer.setAdditionalData(customData); - AppsFlyerMOCKInterface.Received().setAdditionalData(customData); - } - - [Test] - public void Test_setResolveDeepLinkURLs_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setResolveDeepLinkURLs("url1", "url2"); - AppsFlyerMOCKInterface.Received().setResolveDeepLinkURLs("url1", "url2"); - - } - - [Test] - public void Test_setOneLinkCustomDomain_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setOneLinkCustomDomain("url1", "url2"); - AppsFlyerMOCKInterface.Received().setOneLinkCustomDomain("url1", "url2"); - - } - - [Test] - public void Test_setCurrencyCode_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCurrencyCode("usd"); - AppsFlyerMOCKInterface.Received().setCurrencyCode("usd"); - - } - - [Test] - public void Test_recordLocation_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.recordLocation(0.3, 5.2); - AppsFlyerMOCKInterface.Received().recordLocation(0.3, 5.2); - - } - - [Test] - public void Test_anonymizeUser_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.anonymizeUser(true); - AppsFlyerMOCKInterface.Received().anonymizeUser(true); - - } - - [Test] - public void Test_anonymizeUser_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.anonymizeUser(false); - AppsFlyerMOCKInterface.Received().anonymizeUser(false); - - } - - [Test] - public void Test_getAppsFlyerId_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.getAppsFlyerId(); - AppsFlyerMOCKInterface.Received().getAppsFlyerId(); - - } - - [Test] - public void Test_setMinTimeBetweenSessions_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setMinTimeBetweenSessions(3); - AppsFlyerMOCKInterface.Received().setMinTimeBetweenSessions(3); - - } - - [Test] - public void Test_setHost_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setHost("prefix", "name"); - AppsFlyerMOCKInterface.Received().setHost("prefix", "name"); - - } - - [Test] - public void Test_setPhoneNumber_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setPhoneNumber("002"); - AppsFlyerMOCKInterface.Received().setPhoneNumber("002"); - - } - - - [Test] - [System.Obsolete] - public void Test_setSharingFilterForAllPartners_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setSharingFilterForAllPartners(); - AppsFlyerMOCKInterface.Received().setSharingFilterForAllPartners(); - - } - - [Test] - [System.Obsolete] - public void Test_setSharingFilter_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - - AppsFlyer.setSharingFilter("filter1", "filter2"); - AppsFlyerMOCKInterface.Received().setSharingFilter("filter1", "filter2"); - - } - - [Test] - public void Test_getConversionData_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - AppsFlyer.getConversionData("ObjectName"); - AppsFlyerMOCKInterface.Received().getConversionData("ObjectName"); - - } - - [Test] - public void Test_attributeAndOpenStore_called_withParams() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - Dictionary parameters = new Dictionary(); - parameters.Add("af_sub1", "val"); - parameters.Add("custom_param", "val2"); - AppsFlyer.attributeAndOpenStore("appid", "campaign", parameters, new MonoBehaviour()); - AppsFlyerMOCKInterface.Received().attributeAndOpenStore("appid", "campaign", parameters, Arg.Any()); - - } - - [Test] - public void Test_attributeAndOpenStore_called_nullParams() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - AppsFlyer.attributeAndOpenStore("appid", "campaign", null, new MonoBehaviour()); - AppsFlyerMOCKInterface.Received().attributeAndOpenStore("appid", "campaign", null, Arg.Any()); - - } - - [Test] - public void Test_recordCrossPromoteImpression_calledWithParameters() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - Dictionary parameters = new Dictionary(); - parameters.Add("af_sub1", "val"); - parameters.Add("custom_param", "val2"); - AppsFlyer.recordCrossPromoteImpression("appid", "campaign", parameters); - AppsFlyerMOCKInterface.Received().recordCrossPromoteImpression("appid", "campaign", parameters); - - } - - - - [Test] - public void Test_recordCrossPromoteImpression_calledWithoutParameters() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.recordCrossPromoteImpression("appid", "campaign", null); - AppsFlyerMOCKInterface.Received().recordCrossPromoteImpression("appid", "campaign", null); - - } - - [Test] - public void Test_generateUserInviteLink_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - - AppsFlyer.generateUserInviteLink(new Dictionary(), new MonoBehaviour()); - AppsFlyerMOCKInterface.Received().generateUserInviteLink(Arg.Any>(), Arg.Any()); - - } - - - [Test] - public void Test_addPushNotificationDeepLinkPath_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.addPushNotificationDeepLinkPath("path1", "path2"); - AppsFlyerMOCKInterface.Received().addPushNotificationDeepLinkPath("path1", "path2"); - - } - -#if UNITY_ANDROID - [Test] - public void updateServerUninstallToken_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.updateServerUninstallToken("tokenTest"); - AppsFlyerMOCKInterface.Received().updateServerUninstallToken("tokenTest"); - - } - - [Test] - public void setImeiData_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setImeiData("imei"); - AppsFlyerMOCKInterface.Received().setImeiData("imei"); - - } - - [Test] - public void setAndroidIdData_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setAndroidIdData("androidId"); - AppsFlyerMOCKInterface.Received().setAndroidIdData("androidId"); - - } - - [Test] - public void waitForCustomerUserId_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.waitForCustomerUserId(true); - AppsFlyerMOCKInterface.Received().waitForCustomerUserId(true); - - } - - [Test] - public void setCustomerIdAndStartSDK_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCustomerIdAndStartSDK("01234"); - AppsFlyerMOCKInterface.Received().setCustomerIdAndStartSDK("01234"); - - } - - - [Test] - public void getOutOfStore_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.getOutOfStore(); - AppsFlyerMOCKInterface.Received().getOutOfStore(); - - } - - [Test] - public void setOutOfStore_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setOutOfStore("test"); - AppsFlyerMOCKInterface.Received().setOutOfStore("test"); - - } - - [Test] - public void setCollectAndroidID_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCollectAndroidID(true); - AppsFlyerMOCKInterface.Received().setCollectAndroidID(true); - - } - - [Test] - public void setCollectIMEI_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCollectIMEI(true); - AppsFlyerMOCKInterface.Received().setCollectIMEI(true); - - } - - [Test] - public void setIsUpdate_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setIsUpdate(true); - AppsFlyerMOCKInterface.Received().setIsUpdate(true); - - } - - [Test] - public void setPreinstallAttribution_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setPreinstallAttribution("mediaSourceTestt", "campaign", "sideId"); - AppsFlyerMOCKInterface.Received().setPreinstallAttribution("mediaSourceTestt", "campaign", "sideId"); - - } - - [Test] - public void isPreInstalledApp_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.isPreInstalledApp(); - AppsFlyerMOCKInterface.Received().isPreInstalledApp(); - - } - - [Test] - public void getAttributionId_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.getAttributionId(); - AppsFlyerMOCKInterface.Received().getAttributionId(); - - } - - [Test] - public void handlePushNotifications_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.handlePushNotifications(); - AppsFlyerMOCKInterface.Received().handlePushNotifications(); - - } - - [Test] - public void validateAndSendInAppPurchase_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.validateAndSendInAppPurchase("ewjkekwjekw","hewjehwj", "purchaseData", "3.0", "USD", null, null); - AppsFlyerMOCKInterface.Received().validateAndSendInAppPurchase("ewjkekwjekw", "hewjehwj", "purchaseData", "3.0", "USD", null, null); - - } - - [Test] - public void setCollectOaid_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCollectOaid(true); - AppsFlyerMOCKInterface.Received().setCollectOaid(true); - - } - - [Test] - public void setDisableAdvertisingIdentifiers_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableAdvertisingIdentifiers(true); - AppsFlyerMOCKInterface.Received().setDisableAdvertisingIdentifiers(true); - - } - - [Test] - public void setDisableNetworkData_called() { - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableNetworkData(true); - AppsFlyerMOCKInterface.Received().setDisableNetworkData(true); - } -#elif UNITY_IOS - - [Test] - public void setDisableCollectAppleAdSupport_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableCollectAppleAdSupport(true); - AppsFlyerMOCKInterface.Received().setDisableCollectAppleAdSupport(true); - - } - - [Test] - public void setDisableCollectAppleAdSupport_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableCollectAppleAdSupport(false); - AppsFlyerMOCKInterface.Received().setDisableCollectAppleAdSupport(false); - - } - - [Test] - [System.Obsolete] - public void setShouldCollectDeviceName_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setShouldCollectDeviceName(true); - AppsFlyerMOCKInterface.Received().setShouldCollectDeviceName(true); - - } - - [Test] - [System.Obsolete] - public void setShouldCollectDeviceName_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setShouldCollectDeviceName(false); - AppsFlyerMOCKInterface.Received().setShouldCollectDeviceName(false); - - } - - [Test] - public void setDisableCollectIAd_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableCollectIAd(true); - AppsFlyerMOCKInterface.Received().setDisableCollectIAd(true); - - } - - [Test] - public void setDisableCollectIAd_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setDisableCollectIAd(false); - AppsFlyerMOCKInterface.Received().setDisableCollectIAd(false); - - } - - [Test] - public void setUseReceiptValidationSandbox_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setUseReceiptValidationSandbox(true); - AppsFlyerMOCKInterface.Received().setUseReceiptValidationSandbox(true); - - } - - [Test] - public void setUseReceiptValidationSandbox_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setUseReceiptValidationSandbox(false); - AppsFlyerMOCKInterface.Received().setUseReceiptValidationSandbox(false); - - } - - [Test] - public void ssetUseUninstallSandbox_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setUseUninstallSandbox(true); - AppsFlyerMOCKInterface.Received().setUseUninstallSandbox(true); - - } - - [Test] - public void setUseUninstallSandbox_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setUseUninstallSandbox(false); - AppsFlyerMOCKInterface.Received().setUseUninstallSandbox(false); - - } - - [Test] - public void validateAndSendInAppPurchase_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.validateAndSendInAppPurchase("3d2", "5.0","USD", "45", null, null); - AppsFlyerMOCKInterface.Received().validateAndSendInAppPurchase("3d2", "5.0", "USD", "45", null, null); - - } - - [Test] - public void registerUninstall_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - byte[] token = System.Text.Encoding.UTF8.GetBytes("740f4707 bebcf74f 9b7c25d4 8e335894 5f6aa01d a5ddb387 462c7eaf 61bb78ad"); - AppsFlyer.registerUninstall(token); - AppsFlyerMOCKInterface.Received().registerUninstall(token); - - } - - [Test] - public void handleOpenUrl_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.handleOpenUrl("www.test.com", "appTest", "test"); - AppsFlyerMOCKInterface.Received().handleOpenUrl("www.test.com", "appTest", "test"); - - } - - [Test] - public void waitForATTUserAuthorizationWithTimeoutInterval_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(30); - AppsFlyerMOCKInterface.Received().waitForATTUserAuthorizationWithTimeoutInterval(30); - - } - - [Test] - public void setCurrentDeviceLanguage_called() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.setCurrentDeviceLanguage("en"); - AppsFlyerMOCKInterface.Received().setCurrentDeviceLanguage("en"); - - } - - [Test] - public void disableSKAdNetwork_called_true() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.disableSKAdNetwork(true); - AppsFlyerMOCKInterface.Received().disableSKAdNetwork(true); - - } - - [Test] - public void disableSKAdNetwork_called_false() - { - - var AppsFlyerMOCKInterface = Substitute.For(); - - AppsFlyer.instance = AppsFlyerMOCKInterface; - AppsFlyer.disableSKAdNetwork(false); - AppsFlyerMOCKInterface.Received().disableSKAdNetwork(false); - - } - -#endif - } -} diff --git a/sdk-intergration/Assets/AppsFlyer/package.json b/sdk-intergration/Assets/AppsFlyer/package.json index ab16c90..1443643 100644 --- a/sdk-intergration/Assets/AppsFlyer/package.json +++ b/sdk-intergration/Assets/AppsFlyer/package.json @@ -2,7 +2,7 @@ "name": "appsflyer-unity-plugin", "displayName": "AppsFlyer", "description": "AppsFlyer Unity plugin", - "version": "6.14.0", + "version": "6.17.5", "unity": "2019.4", "license": "MIT" } diff --git a/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle index 64f72fa..ff45e4d 100644 --- a/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle +++ b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle @@ -60,7 +60,7 @@ dependencies { implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1" // Android Resolver Dependencies Start - implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:10 + implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7 implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8 implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4 implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5 @@ -68,10 +68,9 @@ dependencies { implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4 implementation 'com.applovin.mediation:vungle-adapter:7.4.2.2' // Assets/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml:4 implementation 'com.applovin:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4 - implementation 'com.appsflyer:adrevenue:6.9.1' // Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml:4 - implementation 'com.appsflyer:af-android-sdk:6.14.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6 - implementation 'com.appsflyer:unity-adrevenue-generic-wrapper:6.9.1' // Assets/AppsFlyer/Editor/AppsFlyerAdRevenueDependencies.xml:5 - implementation 'com.appsflyer:unity-wrapper:6.14.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8 + implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5 + implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8 + implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6 implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5 // Android Resolver Dependencies End **DEPS**} diff --git a/sdk-intergration/Assets/Scripts/AFDeepLinkHelper.cs b/sdk-intergration/Assets/Scripts/AFDeepLinkHelper.cs index 680e184..2480a09 100644 --- a/sdk-intergration/Assets/Scripts/AFDeepLinkHelper.cs +++ b/sdk-intergration/Assets/Scripts/AFDeepLinkHelper.cs @@ -75,7 +75,7 @@ public class AFDeepLinkHelper : MonoBehaviour, IAppsFlyerConversionData, IAppsFl #endif AppsFlyer.startSDK(); - AppsFlyerSDK.AppsFlyerAdRevenue.start(); + // AppsFlyerSDK.AppsFlyerAdRevenue.start(); } public async Task GenInviteLink(string referrerUID, string referrerPID) diff --git a/sdk-intergration/Assets/Scripts/SDKTest.cs b/sdk-intergration/Assets/Scripts/SDKTest.cs index 40d7ad8..12a2d37 100644 --- a/sdk-intergration/Assets/Scripts/SDKTest.cs +++ b/sdk-intergration/Assets/Scripts/SDKTest.cs @@ -105,7 +105,7 @@ public class SDKTest : MonoBehaviour AppsFlyer.initSDK("rSySeWtvKabfbPZE7Lmx7C", null); #endif AppsFlyer.startSDK(); - AppsFlyerAdRevenue.start(); + // AppsFlyerAdRevenue.start(); InitializeRewardedAds(); diff --git a/sdk-intergration/ProjectSettings/AndroidResolverDependencies.xml b/sdk-intergration/ProjectSettings/AndroidResolverDependencies.xml index aa43bd3..ac4214a 100644 --- a/sdk-intergration/ProjectSettings/AndroidResolverDependencies.xml +++ b/sdk-intergration/ProjectSettings/AndroidResolverDependencies.xml @@ -8,10 +8,9 @@ com.applovin.mediation:unityads-adapter:4.12.3.0 com.applovin.mediation:vungle-adapter:7.4.2.2 com.applovin:applovin-sdk:13.5.1 - com.appsflyer:adrevenue:6.9.1 - com.appsflyer:af-android-sdk:6.14.0 - com.appsflyer:unity-adrevenue-generic-wrapper:6.9.1 - com.appsflyer:unity-wrapper:6.14.3 + com.appsflyer:af-android-sdk:6.17.3 + com.appsflyer:purchase-connector:2.2.0 + com.appsflyer:unity-wrapper:6.17.7 com.google.android.ump:user-messaging-platform:2.1.0