Compare commits
10 Commits
c81301e476
...
1d7d224682
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d7d224682 | |||
| 7d479b7758 | |||
| 79f989f4ed | |||
| abe11029cc | |||
| 6ec1b20d36 | |||
| fa1aa0662a | |||
| 1bdfb5f820 | |||
| 086d862cba | |||
| 5b3dfd98c2 | |||
| 4da1b3290e |
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: da76ae4f9ba92124087139583d0dd929
|
guid: 7863556d88b814e09ba9cfc75a91d655
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
71
sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs
Normal file
71
sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs
Normal file
@@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
// 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.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs.meta
Normal file
11
sdk-intergration/Assets/AppsFlyer/AFAdRevenueData.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 49e1906ae949e4bfea400bd1da9f7e39
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -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";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b73b301ad8b6f4b45809980800a9358a
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -28,7 +28,6 @@ public class AFInAppEvents {
|
|||||||
public const string LOCATION_CHANGED = "af_location_changed";
|
public const string LOCATION_CHANGED = "af_location_changed";
|
||||||
public const string LOCATION_COORDINATES = "af_location_coordinates";
|
public const string LOCATION_COORDINATES = "af_location_coordinates";
|
||||||
public const string ORDER_ID = "af_order_id";
|
public const string ORDER_ID = "af_order_id";
|
||||||
public const string GA = "af_ga_event";
|
|
||||||
/**
|
/**
|
||||||
* Event Parameter Name
|
* Event Parameter Name
|
||||||
* **/
|
* **/
|
||||||
|
|||||||
0
sdk-intergration/Assets/AppsFlyer/AFMiniJSON.cs
Normal file → Executable file
0
sdk-intergration/Assets/AppsFlyer/AFMiniJSON.cs
Normal file → Executable file
@@ -10,24 +10,19 @@ namespace AppsFlyerSDK
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
//
|
/// Purchase details class matching Android SDK AFPurchaseDetails
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AFPurchaseDetailsAndroid
|
public class AFPurchaseDetailsAndroid
|
||||||
|
|
||||||
{
|
{
|
||||||
public AFPurchaseType purchaseType { get; private set; }
|
public AFPurchaseType purchaseType { get; private set; }
|
||||||
public string purchaseToken { get; private set; }
|
public string purchaseToken { get; private set; }
|
||||||
public string productId { 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.purchaseType = type;
|
||||||
this.purchaseToken = purchaseToken;
|
this.purchaseToken = purchaseToken;
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
this.price = price;
|
|
||||||
this.currency = currency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,26 +4,33 @@ using System.Collections.Generic;
|
|||||||
namespace AppsFlyerSDK
|
namespace AppsFlyerSDK
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
//
|
/// Purchase type enum matching iOS SDK AFSDKPurchaseType
|
||||||
|
/// </summary>
|
||||||
|
public enum AFSDKPurchaseType
|
||||||
|
{
|
||||||
|
Subscription,
|
||||||
|
OneTimePurchase
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Purchase details class matching iOS SDK AFSDKPurchaseDetails
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AFSDKPurchaseDetailsIOS
|
public class AFSDKPurchaseDetailsIOS
|
||||||
{
|
{
|
||||||
public string productId { get; private set; }
|
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 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.productId = productId;
|
||||||
this.price = price;
|
|
||||||
this.currency = currency;
|
|
||||||
this.transactionId = transactionId;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ namespace AppsFlyerSDK
|
|||||||
{
|
{
|
||||||
public class AppsFlyer : MonoBehaviour
|
public class AppsFlyer : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public static readonly string kAppsFlyerPluginVersion = "6.17.7";
|
||||||
public static readonly string kAppsFlyerPluginVersion = "6.14.3";
|
|
||||||
public static string CallBackObjectName = null;
|
public static string CallBackObjectName = null;
|
||||||
private static EventHandler onRequestResponse;
|
private static EventHandler onRequestResponse;
|
||||||
private static EventHandler onInAppResponse;
|
private static EventHandler onInAppResponse;
|
||||||
@@ -333,6 +332,19 @@ namespace AppsFlyerSDK
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs ad revenue data along with additional parameters if provided.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name = "adRevenueData" >instance of AFAdRevenueData containing ad revenue information.</param>
|
||||||
|
/// <param name = "additionalParameters" >An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters.</param>
|
||||||
|
public static void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||||
|
{
|
||||||
|
if (instance != null)
|
||||||
|
{
|
||||||
|
instance.logAdRevenue(adRevenueData, additionalParameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manually record the location of the user.
|
/// Manually record the location of the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -766,12 +778,12 @@ namespace AppsFlyerSDK
|
|||||||
}
|
}
|
||||||
|
|
||||||
// V2
|
// V2
|
||||||
public static void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> extraEventValues, MonoBehaviour gameObject)
|
public static void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject)
|
||||||
{
|
{
|
||||||
if (instance != null && instance is IAppsFlyerIOSBridge)
|
if (instance != null && instance is IAppsFlyerIOSBridge)
|
||||||
{
|
{
|
||||||
IAppsFlyerIOSBridge appsFlyeriOSInstance = (IAppsFlyerIOSBridge)instance;
|
IAppsFlyerIOSBridge appsFlyeriOSInstance = (IAppsFlyerIOSBridge)instance;
|
||||||
appsFlyeriOSInstance.validateAndSendInAppPurchase(details, extraEventValues, gameObject);
|
appsFlyeriOSInstance.validateAndSendInAppPurchase(details, purchaseAdditionalDetails, gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,12 +797,12 @@ namespace AppsFlyerSDK
|
|||||||
}
|
}
|
||||||
|
|
||||||
// V2
|
// V2
|
||||||
public static void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
public static void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject)
|
||||||
{
|
{
|
||||||
if (instance != null && instance is IAppsFlyerAndroidBridge)
|
if (instance != null && instance is IAppsFlyerAndroidBridge)
|
||||||
{
|
{
|
||||||
IAppsFlyerAndroidBridge appsFlyerAndroidInstance = (IAppsFlyerAndroidBridge)instance;
|
IAppsFlyerAndroidBridge appsFlyerAndroidInstance = (IAppsFlyerAndroidBridge)instance;
|
||||||
appsFlyerAndroidInstance.validateAndSendInAppPurchase(details, additionalParameters, gameObject);
|
appsFlyerAndroidInstance.validateAndSendInAppPurchase(details, purchaseAdditionalDetails, gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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<AndroidJavaObject>("currentActivity")) {
|
|
||||||
|
|
||||||
AndroidJavaObject cls_Application = cls_Activity.Call<AndroidJavaObject>("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<string, string> 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<string, string> 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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 644005ac4602e4b78ad3a8d4d29e329d
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -398,7 +398,23 @@ namespace AppsFlyerSDK
|
|||||||
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
||||||
{
|
{
|
||||||
#if !UNITY_EDITOR
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs ad revenue data along with additional parameters if provided.
|
||||||
|
/// <param name = "adRevenueData" >instance of AFAdRevenueData containing ad revenue information.</param>
|
||||||
|
/// <param name = "additionalParameters" >An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters.</param>
|
||||||
|
public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||||
|
{
|
||||||
|
#if !UNITY_EDITOR
|
||||||
|
appsFlyerAndroid.CallStatic("logAdRevenue", adRevenueData.monetizationNetwork, getMediationNetwork(adRevenueData.mediationNetwork), adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, convertDictionaryToJavaMap(additionalParameters));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,11 +505,11 @@ namespace AppsFlyerSDK
|
|||||||
/// An af_purchase event with the relevant values will be automatically sent if the validation is successful.
|
/// An af_purchase event with the relevant values will be automatically sent if the validation is successful.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="details">AFPurchaseDetailsAndroid instance.</param>
|
/// <param name="details">AFPurchaseDetailsAndroid instance.</param>
|
||||||
/// <param name="additionalParameters">additionalParameters Freehand parameters to be sent with the purchase (if validated).</param>
|
/// <param name="purchaseAdditionalDetails">purchaseAdditionalDetails Freehand parameters to be sent with the purchase (if validated).</param>
|
||||||
public void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject)
|
public void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject)
|
||||||
{
|
{
|
||||||
#if !UNITY_EDITOR
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,6 +765,65 @@ namespace AppsFlyerSDK
|
|||||||
return emailsCryptType;
|
return emailsCryptType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal Helper Method.
|
||||||
|
/// </summary>
|
||||||
|
private static AndroidJavaObject getMediationNetwork(MediationNetwork mediationNetwork)
|
||||||
|
{
|
||||||
|
AndroidJavaClass mediationNetworkEnumClass = new AndroidJavaClass("com.appsflyer.MediationNetwork");
|
||||||
|
AndroidJavaObject mediationNetworkObject;
|
||||||
|
|
||||||
|
switch (mediationNetwork)
|
||||||
|
{
|
||||||
|
case MediationNetwork.IronSource:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("IRONSOURCE");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.ApplovinMax:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("APPLOVIN_MAX");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.GoogleAdMob:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("GOOGLE_ADMOB");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Fyber:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("FYBER");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Appodeal:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("APPODEAL");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Admost:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("ADMOST");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Topon:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TOPON");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Tradplus:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TRADPLUS");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Yandex:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("YANDEX");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.ChartBoost:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("CHARTBOOST");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Unity:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("UNITY");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.ToponPte:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("TOPON_PTE");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.Custom:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("CUSTOM_MEDIATION");
|
||||||
|
break;
|
||||||
|
case MediationNetwork.DirectMonetization:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("DIRECT_MONETIZATION_NETWORK");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mediationNetworkObject = mediationNetworkEnumClass.GetStatic<AndroidJavaObject>("NONE");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return mediationNetworkObject;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal Helper Method.
|
/// Internal Helper Method.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -771,9 +846,6 @@ namespace AppsFlyerSDK
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,25 +11,44 @@ namespace AppsFlyerSDK
|
|||||||
// under GDPR, their general consent to data usage, and their consent to personalized
|
// under GDPR, their general consent to data usage, and their consent to personalized
|
||||||
// advertisements based on user data.
|
// advertisements based on user data.
|
||||||
|
|
||||||
// Note that the consent for data usage and ads personalization pair is only applicable when the user is
|
/// ## Properties:
|
||||||
// subject to GDPR guidelines. Therefore, the following factory methods should be used accordingly:
|
/// - `isUserSubjectToGDPR` (optional) - Indicates whether GDPR regulations apply to the user.
|
||||||
// - Use [forGDPRUser] when the user is subject to GDPR.
|
/// This may also serve as a general compliance flag for other regional regulations.
|
||||||
// - Use [forNonGDPRUser] when the user is not subject to GDPR.
|
/// - `hasConsentForDataUsage` (optional) - Indicates whether the user consents to the processing
|
||||||
|
/// of their data for advertising purposes.
|
||||||
// @property isUserSubjectToGDPR Indicates whether GDPR regulations apply to the user (true if the user is
|
/// - `hasConsentForAdsPersonalization` (optional) - Indicates whether the user consents to the
|
||||||
// a subject of GDPR). It also serves as a flag for compliance with relevant aspects of DMA regulations.
|
/// use of their data for personalized advertising.
|
||||||
// @property hasConsentForDataUsage Indicates whether the user has consented to the use of their data for advertising
|
/// - `hasConsentForAdStorage` (optional) - Indicates whether the user consents to ad-related storage access.
|
||||||
// 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
|
/// **Usage Example:**
|
||||||
// personalized advertising within the boundaries of GDPR and DMA rules (true if the user has consented to
|
/// ```csharp
|
||||||
// personalized ads, nullable if not subject to GDPR).
|
/// 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.
|
||||||
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AppsFlyerConsent
|
public class AppsFlyerConsent
|
||||||
{
|
{
|
||||||
public bool isUserSubjectToGDPR { get; private set; }
|
public bool? isUserSubjectToGDPR { get; private set; }
|
||||||
public bool hasConsentForDataUsage { get; private set; }
|
public bool? hasConsentForDataUsage { get; private set; }
|
||||||
public bool hasConsentForAdsPersonalization { 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)
|
private AppsFlyerConsent(bool isGDPR, bool hasForDataUsage, bool hasForAdsPersonalization)
|
||||||
{
|
{
|
||||||
isUserSubjectToGDPR = isGDPR;
|
isUserSubjectToGDPR = isGDPR;
|
||||||
@@ -37,15 +56,16 @@ namespace AppsFlyerSDK
|
|||||||
hasConsentForAdsPersonalization = hasForAdsPersonalization;
|
hasConsentForAdsPersonalization = hasForAdsPersonalization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
|
||||||
public static AppsFlyerConsent ForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization)
|
public static AppsFlyerConsent ForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization)
|
||||||
{
|
{
|
||||||
return new AppsFlyerConsent(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);
|
return new AppsFlyerConsent(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
|
||||||
public static AppsFlyerConsent ForNonGDPRUser()
|
public static AppsFlyerConsent ForNonGDPRUser()
|
||||||
{
|
{
|
||||||
return new AppsFlyerConsent(false, false, false);
|
return new AppsFlyerConsent(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
426
sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs
Normal file
426
sdk-intergration/Assets/AppsFlyer/AppsFlyerPurchaseConnector.cs
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface IAppsFlyerPurchaseRevenueDataSource
|
||||||
|
{
|
||||||
|
Dictionary<string, object> PurchaseRevenueAdditionalParametersForProducts(HashSet<object> products, HashSet<object> transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IAppsFlyerPurchaseRevenueDataSourceStoreKit2
|
||||||
|
{
|
||||||
|
Dictionary<string, object> PurchaseRevenueAdditionalParametersStoreKit2ForProducts(HashSet<object> products, HashSet<object> transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AppsFlyerPurchaseRevenueBridge : MonoBehaviour
|
||||||
|
{
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern void RegisterUnityPurchaseRevenueParamsCallback(Func<string, string, string> callback);
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern void RegisterUnityPurchaseRevenueParamsCallbackSK2(Func<string, string, string> 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<string, object> GetAdditionalParametersForAndroid(HashSet<object> products, HashSet<object> transactions)
|
||||||
|
{
|
||||||
|
return _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions)
|
||||||
|
?? new Dictionary<string, object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
[AOT.MonoPInvokeCallback(typeof(Func<string, string, string>))]
|
||||||
|
public static string GetAdditionalParameters(string productsJson, string transactionsJson)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HashSet<object> products = new HashSet<object>();
|
||||||
|
HashSet<object> transactions = new HashSet<object>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(productsJson))
|
||||||
|
{
|
||||||
|
var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary<string, object>;
|
||||||
|
if (dict != null)
|
||||||
|
{
|
||||||
|
if (dict.TryGetValue("products", out var productsObj) && productsObj is List<object> productList)
|
||||||
|
products = new HashSet<object>(productList);
|
||||||
|
|
||||||
|
if (dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List<object> transactionList)
|
||||||
|
transactions = new HashSet<object>(transactionList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameters = _dataSource?.PurchaseRevenueAdditionalParametersForProducts(products, transactions)
|
||||||
|
?? new Dictionary<string, object>();
|
||||||
|
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<string, string, string>))]
|
||||||
|
public static string GetAdditionalParametersSK2(string productsJson, string transactionsJson)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HashSet<object> products = new HashSet<object>();
|
||||||
|
HashSet<object> transactions = new HashSet<object>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(productsJson))
|
||||||
|
{
|
||||||
|
var dict = AFMiniJSON.Json.Deserialize(productsJson) as Dictionary<string, object>;
|
||||||
|
if (dict != null && dict.TryGetValue("products", out var productsObj) && productsObj is List<object> productList)
|
||||||
|
products = new HashSet<object>(productList);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(transactionsJson))
|
||||||
|
{
|
||||||
|
var dict = AFMiniJSON.Json.Deserialize(transactionsJson) as Dictionary<string, object>;
|
||||||
|
if (dict != null && dict.TryGetValue("transactions", out var transactionsObj) && transactionsObj is List<object> transactionList)
|
||||||
|
transactions = new HashSet<object>(transactionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameters = _dataSourceSK2?.PurchaseRevenueAdditionalParametersStoreKit2ForProducts(products, transactions)
|
||||||
|
?? new Dictionary<string, object>();
|
||||||
|
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<object> products = new HashSet<object>();
|
||||||
|
HashSet<object> transactions = new HashSet<object>();
|
||||||
|
|
||||||
|
// 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<object> productList)
|
||||||
|
{
|
||||||
|
products = new HashSet<object>(productList);
|
||||||
|
}
|
||||||
|
else if (parsedProducts is Dictionary<string, object> dict)
|
||||||
|
{
|
||||||
|
if (dict.ContainsKey("events") && dict["events"] is List<object> eventsList)
|
||||||
|
{
|
||||||
|
products = new HashSet<object>(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<object> transactionList)
|
||||||
|
{
|
||||||
|
transactions = new HashSet<object>(transactionList);
|
||||||
|
}
|
||||||
|
else if (parsedTransactions is Dictionary<string, object> dict)
|
||||||
|
{
|
||||||
|
if (dict.ContainsKey("events") && dict["events"] is List<object> eventsList)
|
||||||
|
{
|
||||||
|
transactions = new HashSet<object>(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<string, object> pendingParameters;
|
||||||
|
private Action<Dictionary<string, object>> pendingCallback;
|
||||||
|
|
||||||
|
public static AppsFlyerPurchaseConnector Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
GameObject go = new GameObject("AppsFlyerPurchaseConnector");
|
||||||
|
instance = go.AddComponent<AppsFlyerPurchaseConnector>();
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0636ea07d370d437183f3762280c08ce
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -215,7 +215,24 @@ public void startSDK(bool shouldCallback, string CallBackObjectName)
|
|||||||
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
|
||||||
{
|
{
|
||||||
#if !UNITY_EDITOR
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs ad revenue data along with additional parameters if provided.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name = "adRevenueData" >instance of AFAdRevenueData containing ad revenue information.</param>
|
||||||
|
/// <param name = "additionalParameters" >An optional map of additional parameters to be logged with ad revenue data. This can be null if there are no additional parameters.</param>
|
||||||
|
public void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||||
|
{
|
||||||
|
#if !UNITY_EDITOR
|
||||||
|
_logAdRevenue(adRevenueData.monetizationNetwork, adRevenueData.mediationNetwork, adRevenueData.currencyIso4217Code, adRevenueData.eventRevenue, AFMiniJSON.Json.Serialize(additionalParameters));
|
||||||
#endif
|
#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.
|
/// To send and validate in app purchases you can call this method from the processPurchase method.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="details">The AFSDKPurchaseDetailsIOS instance.</param>
|
/// <param name="details">The AFSDKPurchaseDetailsIOS instance.</param>
|
||||||
/// <param name="extraEventValues">The extra params, which you want to receive it in the raw reports.</param>
|
/// <param name="purchaseAdditionalDetails">The additional params, which you want to receive it in the raw reports.</param>
|
||||||
public void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> extraEventValues, MonoBehaviour gameObject)
|
public void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject)
|
||||||
{
|
{
|
||||||
#if !UNITY_EDITOR
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,7 +765,14 @@ public void startSDK(bool shouldCallback, string CallBackObjectName)
|
|||||||
#elif UNITY_STANDALONE_OSX
|
#elif UNITY_STANDALONE_OSX
|
||||||
[DllImport("AppsFlyerBundle")]
|
[DllImport("AppsFlyerBundle")]
|
||||||
#endif
|
#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
|
#if UNITY_IOS
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
@@ -819,7 +843,7 @@ public void startSDK(bool shouldCallback, string CallBackObjectName)
|
|||||||
#elif UNITY_STANDALONE_OSX
|
#elif UNITY_STANDALONE_OSX
|
||||||
[DllImport("AppsFlyerBundle")]
|
[DllImport("AppsFlyerBundle")]
|
||||||
#endif
|
#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
|
#if UNITY_IOS
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<dependencies>
|
|
||||||
<androidPackages>
|
|
||||||
<androidPackage spec="com.appsflyer:adrevenue:6.9.1"></androidPackage>
|
|
||||||
<androidPackage spec="com.appsflyer:unity-adrevenue-generic-wrapper:6.9.1"></androidPackage>
|
|
||||||
</androidPackages>
|
|
||||||
|
|
||||||
<iosPods>
|
|
||||||
<iosPod name="AppsFlyer-AdRevenue" version="6.14.3" minTargetSdk="12.0">
|
|
||||||
</iosPod>
|
|
||||||
</iosPods>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6110ce30bf7674268814dc9e0395f8b0
|
|
||||||
TextScriptImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -2,17 +2,15 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<androidPackages>
|
<androidPackages>
|
||||||
<androidPackage spec="com.appsflyer:af-android-sdk:6.14.0">
|
<androidPackage spec="com.appsflyer:af-android-sdk:6.17.3"></androidPackage>
|
||||||
</androidPackage>
|
<androidPackage spec="com.appsflyer:unity-wrapper:6.17.7"></androidPackage>
|
||||||
<androidPackage spec="com.appsflyer:unity-wrapper:6.14.3">
|
<androidPackage spec="com.android.installreferrer:installreferrer:2.1"></androidPackage>
|
||||||
</androidPackage>
|
<androidPackage spec="com.appsflyer:purchase-connector:2.2.0"></androidPackage>
|
||||||
<androidPackage spec="com.android.installreferrer:installreferrer:2.1">
|
|
||||||
</androidPackage>
|
|
||||||
</androidPackages>
|
</androidPackages>
|
||||||
|
|
||||||
<iosPods>
|
<iosPods>
|
||||||
<iosPod name="AppsFlyerFramework" version="6.14.3" minTargetSdk="12.0">
|
<iosPod name="AppsFlyerFramework" version="6.17.7" minTargetSdk="12.0"></iosPod>
|
||||||
</iosPod>
|
<iosPod name="PurchaseConnector" version="6.17.7" minTargetSdk="12.0"></iosPod>
|
||||||
</iosPods>
|
</iosPods>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AppsFlyerSDK
|
|||||||
string getAttributionId();
|
string getAttributionId();
|
||||||
void handlePushNotifications();
|
void handlePushNotifications();
|
||||||
void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
void validateAndSendInAppPurchase(string publicKey, string signature, string purchaseData, string price, string currency, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
||||||
void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
void validateAndSendInAppPurchase(AFPurchaseDetailsAndroid details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject);
|
||||||
void setCollectOaid(bool isCollect);
|
void setCollectOaid(bool isCollect);
|
||||||
void setDisableAdvertisingIdentifiers(bool disable);
|
void setDisableAdvertisingIdentifiers(bool disable);
|
||||||
void setDisableNetworkData(bool disable);
|
void setDisableNetworkData(bool disable);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace AppsFlyerSDK
|
|||||||
void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox);
|
void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox);
|
||||||
void setUseUninstallSandbox(bool useUninstallSandbox);
|
void setUseUninstallSandbox(bool useUninstallSandbox);
|
||||||
void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
void validateAndSendInAppPurchase(string productIdentifier, string price, string currency, string transactionId, Dictionary<string, string> additionalParameters, MonoBehaviour gameObject);
|
||||||
void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> extraEventValues, MonoBehaviour gameObject);
|
void validateAndSendInAppPurchase(AFSDKPurchaseDetailsIOS details, Dictionary<string, string> purchaseAdditionalDetails, MonoBehaviour gameObject);
|
||||||
void registerUninstall(byte[] deviceToken);
|
void registerUninstall(byte[] deviceToken);
|
||||||
void handleOpenUrl(string url, string sourceApplication, string annotation);
|
void handleOpenUrl(string url, string sourceApplication, string annotation);
|
||||||
void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval);
|
void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutInterval);
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ namespace AppsFlyerSDK
|
|||||||
|
|
||||||
void setConsentData(AppsFlyerConsent appsFlyerConsent);
|
void setConsentData(AppsFlyerConsent appsFlyerConsent);
|
||||||
|
|
||||||
|
void logAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters);
|
||||||
|
|
||||||
void setMinTimeBetweenSessions(int seconds);
|
void setMinTimeBetweenSessions(int seconds);
|
||||||
|
|
||||||
void setHost(string hostPrefixName, string hostName);
|
void setHost(string hostPrefixName, string hostName);
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
public interface IAppsFlyerPurchaseValidation
|
||||||
|
{
|
||||||
|
void didReceivePurchaseRevenueValidationInfo(string validationInfo);
|
||||||
|
void didReceivePurchaseRevenueError(string error);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7c60f499ae0d048b1be8ffd6878a184c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 28175da64865f4e398b3b9ddfbe97b24
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 58a86b0b376564c06bf8ce29e1dbfb04
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 218a2e7ff5a4c461981bc41f7d7bfeba
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
0
sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle
Normal file → Executable file
0
sdk-intergration/Assets/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle
Normal file → Executable file
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0889edee891d84a8eb0b7cc87071b91e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 16068f30788004029bd487756623799b
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 724b52b308e9a4a6d889d7bf3945a2ca
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5652805602a6b4273a6e527b00aea272
|
||||||
|
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:
|
||||||
|
VisionOS: VisionOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
- first:
|
||||||
|
tvOS: tvOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -17,6 +17,8 @@ static NSArray<NSString*> *NSArrayFromCArray(int length, const char **arr);
|
|||||||
static char* getCString(const char* string);
|
static char* getCString(const char* string);
|
||||||
static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator);
|
static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator);
|
||||||
static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt);
|
static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt);
|
||||||
|
static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetwork);
|
||||||
|
static NSNumber *intFromNullableBool(const char *cStr);
|
||||||
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult);
|
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult);
|
||||||
static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result);
|
static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result);
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,72 @@ static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt){
|
|||||||
return emailCryptType;
|
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){
|
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult){
|
||||||
NSString* result;
|
NSString* result;
|
||||||
switch (deepLinkResult){
|
switch (deepLinkResult){
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ static IMP __original_openUrl_Imp __unused;
|
|||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&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:));
|
Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:));
|
||||||
__original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive);
|
__original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive);
|
||||||
|
|
||||||
@@ -48,6 +55,31 @@ static IMP __original_openUrl_Imp __unused;
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self swizzleContinueUserActivity:[self class]];
|
[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);
|
||||||
|
|
||||||
|
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]];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
//
|
|
||||||
// AppsFlyerAdRevenueWrapper.h
|
|
||||||
// Unity-iPhone
|
|
||||||
//
|
|
||||||
// Created by Jonathan Wesfield on 01/12/2019.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
#if __has_include(<AppsFlyerAdRevenue/AppsFlyerAdRevenue.h>)
|
|
||||||
#import <AppsFlyerAdRevenue/AppsFlyerAdRevenue.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@interface AppsFlyerAdRevenueWrapper : NSObject
|
|
||||||
|
|
||||||
@end
|
|
||||||
@@ -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:
|
|
||||||
@@ -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
|
|
||||||
@@ -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:
|
|
||||||
@@ -101,6 +101,11 @@
|
|||||||
|
|
||||||
@end
|
@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.
|
Note if you would not like to use IMPL_APP_CONTROLLER_SUBCLASS you can replace it with the code below.
|
||||||
<code>
|
<code>
|
||||||
|
|||||||
@@ -13,10 +13,27 @@
|
|||||||
#else
|
#else
|
||||||
#import "AppsFlyerLib.h"
|
#import "AppsFlyerLib.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if __has_include(<PurchaseConnector/PurchaseConnector.h>)
|
||||||
|
#import <PurchaseConnector/PurchaseConnector.h>
|
||||||
|
#else
|
||||||
|
#import "PurchaseConnector.h"
|
||||||
|
#endif
|
||||||
|
#import <PurchaseConnector/PurchaseConnector-Swift.h>
|
||||||
|
|
||||||
|
// Add StoreKit 2 support
|
||||||
|
#if __has_include(<StoreKit/StoreKit.h>)
|
||||||
|
#import <StoreKit/StoreKit.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface AppsFlyeriOSWarpper : NSObject <AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate, AppsFlyerPurchaseRevenueDelegate, AppsFlyerPurchaseRevenueDataSource, AppsFlyerPurchaseRevenueDataSourceStoreKit2>
|
||||||
|
|
||||||
@interface AppsFlyeriOSWarpper : NSObject <AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate>
|
|
||||||
+ (BOOL) didCallStart;
|
+ (BOOL) didCallStart;
|
||||||
+ (void) setDidCallStart:(BOOL)val;
|
+ (void) setDidCallStart:(BOOL)val;
|
||||||
|
|
||||||
|
// Add StoreKit 2 methods
|
||||||
|
- (void)setStoreKitVersion:(int)storeKitVersion;
|
||||||
|
- (void)logConsumableTransaction:(id)transaction;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@@ -48,3 +65,7 @@ static NSString* startRequestObjectName = @"";
|
|||||||
static NSString* inAppRequestObjectName = @"";
|
static NSString* inAppRequestObjectName = @"";
|
||||||
static NSString* onDeeplinkingObjectName = @"";
|
static NSString* onDeeplinkingObjectName = @"";
|
||||||
|
|
||||||
|
static const char* PURCHASE_REVENUE_VALIDATION_CALLBACK = "didReceivePurchaseRevenueValidationInfo";
|
||||||
|
static const char* PURCHASE_REVENUE_ERROR_CALLBACK = "didReceivePurchaseRevenueError";
|
||||||
|
|
||||||
|
static NSString* onPurchaseValidationObjectName = @"";
|
||||||
|
|||||||
@@ -6,7 +6,22 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "AppsFlyeriOSWrapper.h"
|
#import "AppsFlyeriOSWrapper.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
|
#import <StoreKit/StoreKit.h>
|
||||||
|
#import "UnityFramework/UnityFramework-Swift.h"
|
||||||
|
|
||||||
|
#if __has_include(<PurchaseConnector/PurchaseConnector-Swift.h>)
|
||||||
|
#import <PurchaseConnector/PurchaseConnector-Swift.h>
|
||||||
|
#elif __has_include("PurchaseConnector-Swift.h")
|
||||||
|
#import "PurchaseConnector-Swift.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_include(<UnityFramework/UnityFramework-Swift.h>)
|
||||||
|
#import <UnityFramework/UnityFramework-Swift.h>
|
||||||
|
#elif __has_include("UnityFramework-Swift.h")
|
||||||
|
#import "UnityFramework-Swift.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static void unityCallBack(NSString* objectName, const char* method, const char* msg) {
|
static void unityCallBack(NSString* objectName, const char* method, const char* msg) {
|
||||||
if(objectName){
|
if(objectName){
|
||||||
@@ -18,7 +33,7 @@ extern "C" {
|
|||||||
|
|
||||||
const void _startSDK(bool shouldCallback, const char* objectName) {
|
const void _startSDK(bool shouldCallback, const char* objectName) {
|
||||||
[[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity
|
[[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity
|
||||||
pluginVersion:@"6.14.3"
|
pluginVersion:@"6.17.7"
|
||||||
additionalParams:nil];
|
additionalParams:nil];
|
||||||
startRequestObjectName = stringFromChar(objectName);
|
startRequestObjectName = stringFromChar(objectName);
|
||||||
AppsFlyeriOSWarpper.didCallStart = YES;
|
AppsFlyeriOSWarpper.didCallStart = YES;
|
||||||
@@ -87,16 +102,28 @@ extern "C" {
|
|||||||
[[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData];
|
[[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData];
|
||||||
}
|
}
|
||||||
|
|
||||||
const void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization) {
|
const void _setConsentData(const char* isUserSubjectToGDPR, const char* hasConsentForDataUsage, const char* hasConsentForAdsPersonalization, const char* hasConsentForAdStorage) {
|
||||||
AppsFlyerConsent *consentData = nil;
|
|
||||||
if (isUserSubjectToGDPR) {
|
NSNumber *gdpr = intFromNullableBool(isUserSubjectToGDPR);
|
||||||
consentData = [[AppsFlyerConsent alloc] initForGDPRUserWithHasConsentForDataUsage:hasConsentForDataUsage hasConsentForAdsPersonalization:hasConsentForAdsPersonalization];
|
NSNumber *dataUsage = intFromNullableBool(hasConsentForDataUsage);
|
||||||
} else {
|
NSNumber *adsPersonalization = intFromNullableBool(hasConsentForAdsPersonalization);
|
||||||
consentData = [[AppsFlyerConsent alloc] initNonGDPRUser];
|
NSNumber *adStorage = intFromNullableBool(hasConsentForAdStorage);
|
||||||
}
|
|
||||||
|
AppsFlyerConsent *consentData = [[AppsFlyerConsent alloc] initWithIsUserSubjectToGDPR:gdpr
|
||||||
|
hasConsentForDataUsage:dataUsage
|
||||||
|
hasConsentForAdsPersonalization:adsPersonalization
|
||||||
|
hasConsentForAdStorage:adStorage];
|
||||||
|
|
||||||
[[AppsFlyerLib shared] setConsentData:consentData];
|
[[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) {
|
const void _setDisableCollectIAd (bool disableCollectASA) {
|
||||||
[AppsFlyerLib shared].disableCollectASA = disableCollectASA;
|
[AppsFlyerLib shared].disableCollectASA = 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);
|
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]
|
[[AppsFlyerLib shared]
|
||||||
validateAndLogInAppPurchase:details
|
validateAndLogInAppPurchase:details
|
||||||
extraEventValues:dictionaryFromJson(extraEventValues)
|
purchaseAdditionalDetails:dictionaryFromJson(purchaseAdditionalDetails)
|
||||||
completionHandler:^(AFSDKValidateAndLogResult * _Nullable result) {
|
completion:^(NSDictionary * _Nullable response, NSError * _Nullable error) {
|
||||||
if (result.status == AFSDKValidateAndLogStatusSuccess) {
|
if (error) {
|
||||||
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.result));
|
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(dictionaryFromNSError(error)));
|
||||||
} else if (result.status == AFSDKValidateAndLogStatusFailure) {
|
|
||||||
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.errorData));
|
|
||||||
} else {
|
} 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;
|
[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
|
@implementation AppsFlyeriOSWarpper
|
||||||
@@ -366,5 +501,120 @@ static BOOL didCallStart;
|
|||||||
unityCallBack(onDeeplinkingObjectName, ON_DEEPLINKING, stringFromdictionary(dict));
|
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<SKProduct *> *)products
|
||||||
|
transactions:(NSSet<SKPaymentTransaction *> *)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<AFSDKProductSK2 *> *)products transactions:(NSSet<AFSDKTransactionSK2 *> *)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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
import Foundation
|
|
||||||
@@ -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:
|
|
||||||
184
sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs
Normal file
184
sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs
Normal file
@@ -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<SubscriptionPurchaseLineItem>? 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<string>? 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;
|
||||||
|
}
|
||||||
|
|
||||||
11
sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs.meta
Normal file
11
sdk-intergration/Assets/AppsFlyer/ProductPurchase.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9a1435104a69d4c8ebcc6f237cc29a54
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1f19f272c71674582bed1d93925da003
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
@@ -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:
|
|
||||||
Binary file not shown.
@@ -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:
|
|
||||||
Binary file not shown.
@@ -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:
|
|
||||||
Binary file not shown.
@@ -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:
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1f155a0e4c9ab48eeb4b54b2dc0aeba7
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -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<IAppsFlyerNativeBridge>();
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.startSDK();
|
|
||||||
AppsFlyerMOCKInterface.Received().startSDK(Arg.Any<bool>(), Arg.Any<string>());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_sendEvent_withValues()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
var eventParams = new Dictionary<string, string>();
|
|
||||||
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<IAppsFlyerNativeBridge>();
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.sendEvent("testevent", null);
|
|
||||||
AppsFlyerMOCKInterface.Received().sendEvent("testevent", null,false, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_isSDKStopped_true()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.stopSDK(true);
|
|
||||||
|
|
||||||
AppsFlyerMOCKInterface.Received().stopSDK(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_isSDKStopped_false()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
AppsFlyer.stopSDK(false);
|
|
||||||
|
|
||||||
AppsFlyerMOCKInterface.Received().stopSDK(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_isSDKStopped_called()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
var isSDKStopped = AppsFlyer.isSDKStopped();
|
|
||||||
|
|
||||||
AppsFlyerMOCKInterface.Received().isSDKStopped();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_isSDKStopped_receveivedFalse()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
var isSDKStopped = AppsFlyer.isSDKStopped();
|
|
||||||
|
|
||||||
Assert.AreEqual(AppsFlyerMOCKInterface.Received().isSDKStopped(), false);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_getSdkVersion_called()
|
|
||||||
{
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.getSdkVersion();
|
|
||||||
AppsFlyerMOCKInterface.Received().getSdkVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void test_setCustomerUserId_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCustomerUserId("test");
|
|
||||||
AppsFlyerMOCKInterface.Received().setCustomerUserId("test");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setAppInviteOneLinkID_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setAppInviteOneLinkID("2f36");
|
|
||||||
AppsFlyerMOCKInterface.Received().setAppInviteOneLinkID("2f36");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setAdditionalData_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
var customData = new Dictionary<string, string>();
|
|
||||||
customData.Add("test", "test");
|
|
||||||
AppsFlyer.setAdditionalData(customData);
|
|
||||||
AppsFlyerMOCKInterface.Received().setAdditionalData(customData);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setResolveDeepLinkURLs_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setResolveDeepLinkURLs("url1", "url2");
|
|
||||||
AppsFlyerMOCKInterface.Received().setResolveDeepLinkURLs("url1", "url2");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setOneLinkCustomDomain_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setOneLinkCustomDomain("url1", "url2");
|
|
||||||
AppsFlyerMOCKInterface.Received().setOneLinkCustomDomain("url1", "url2");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setCurrencyCode_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCurrencyCode("usd");
|
|
||||||
AppsFlyerMOCKInterface.Received().setCurrencyCode("usd");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_recordLocation_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
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<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.anonymizeUser(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().anonymizeUser(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_anonymizeUser_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.anonymizeUser(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().anonymizeUser(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_getAppsFlyerId_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.getAppsFlyerId();
|
|
||||||
AppsFlyerMOCKInterface.Received().getAppsFlyerId();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setMinTimeBetweenSessions_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setMinTimeBetweenSessions(3);
|
|
||||||
AppsFlyerMOCKInterface.Received().setMinTimeBetweenSessions(3);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setHost_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setHost("prefix", "name");
|
|
||||||
AppsFlyerMOCKInterface.Received().setHost("prefix", "name");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_setPhoneNumber_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setPhoneNumber("002");
|
|
||||||
AppsFlyerMOCKInterface.Received().setPhoneNumber("002");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[System.Obsolete]
|
|
||||||
public void Test_setSharingFilterForAllPartners_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setSharingFilterForAllPartners();
|
|
||||||
AppsFlyerMOCKInterface.Received().setSharingFilterForAllPartners();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[System.Obsolete]
|
|
||||||
public void Test_setSharingFilter_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
|
|
||||||
AppsFlyer.setSharingFilter("filter1", "filter2");
|
|
||||||
AppsFlyerMOCKInterface.Received().setSharingFilter("filter1", "filter2");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_getConversionData_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
AppsFlyer.getConversionData("ObjectName");
|
|
||||||
AppsFlyerMOCKInterface.Received().getConversionData("ObjectName");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_attributeAndOpenStore_called_withParams()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
|
||||||
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<MonoBehaviour>());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_attributeAndOpenStore_called_nullParams()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
AppsFlyer.attributeAndOpenStore("appid", "campaign", null, new MonoBehaviour());
|
|
||||||
AppsFlyerMOCKInterface.Received().attributeAndOpenStore("appid", "campaign", null, Arg.Any<MonoBehaviour>());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_recordCrossPromoteImpression_calledWithParameters()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
|
||||||
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<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.recordCrossPromoteImpression("appid", "campaign", null);
|
|
||||||
AppsFlyerMOCKInterface.Received().recordCrossPromoteImpression("appid", "campaign", null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_generateUserInviteLink_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
|
|
||||||
AppsFlyer.generateUserInviteLink(new Dictionary<string, string>(), new MonoBehaviour());
|
|
||||||
AppsFlyerMOCKInterface.Received().generateUserInviteLink(Arg.Any<Dictionary<string, string>>(), Arg.Any<MonoBehaviour>());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_addPushNotificationDeepLinkPath_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerNativeBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.addPushNotificationDeepLinkPath("path1", "path2");
|
|
||||||
AppsFlyerMOCKInterface.Received().addPushNotificationDeepLinkPath("path1", "path2");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
[Test]
|
|
||||||
public void updateServerUninstallToken_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.updateServerUninstallToken("tokenTest");
|
|
||||||
AppsFlyerMOCKInterface.Received().updateServerUninstallToken("tokenTest");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setImeiData_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setImeiData("imei");
|
|
||||||
AppsFlyerMOCKInterface.Received().setImeiData("imei");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setAndroidIdData_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setAndroidIdData("androidId");
|
|
||||||
AppsFlyerMOCKInterface.Received().setAndroidIdData("androidId");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void waitForCustomerUserId_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.waitForCustomerUserId(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().waitForCustomerUserId(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setCustomerIdAndStartSDK_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCustomerIdAndStartSDK("01234");
|
|
||||||
AppsFlyerMOCKInterface.Received().setCustomerIdAndStartSDK("01234");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void getOutOfStore_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.getOutOfStore();
|
|
||||||
AppsFlyerMOCKInterface.Received().getOutOfStore();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setOutOfStore_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setOutOfStore("test");
|
|
||||||
AppsFlyerMOCKInterface.Received().setOutOfStore("test");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setCollectAndroidID_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCollectAndroidID(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setCollectAndroidID(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setCollectIMEI_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCollectIMEI(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setCollectIMEI(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setIsUpdate_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setIsUpdate(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setIsUpdate(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setPreinstallAttribution_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setPreinstallAttribution("mediaSourceTestt", "campaign", "sideId");
|
|
||||||
AppsFlyerMOCKInterface.Received().setPreinstallAttribution("mediaSourceTestt", "campaign", "sideId");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void isPreInstalledApp_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.isPreInstalledApp();
|
|
||||||
AppsFlyerMOCKInterface.Received().isPreInstalledApp();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void getAttributionId_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.getAttributionId();
|
|
||||||
AppsFlyerMOCKInterface.Received().getAttributionId();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void handlePushNotifications_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.handlePushNotifications();
|
|
||||||
AppsFlyerMOCKInterface.Received().handlePushNotifications();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void validateAndSendInAppPurchase_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
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<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCollectOaid(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setCollectOaid(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableAdvertisingIdentifiers_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableAdvertisingIdentifiers(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableAdvertisingIdentifiers(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableNetworkData_called() {
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerAndroidBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableNetworkData(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableNetworkData(true);
|
|
||||||
}
|
|
||||||
#elif UNITY_IOS
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableCollectAppleAdSupport_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableCollectAppleAdSupport(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableCollectAppleAdSupport(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableCollectAppleAdSupport_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableCollectAppleAdSupport(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableCollectAppleAdSupport(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[System.Obsolete]
|
|
||||||
public void setShouldCollectDeviceName_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setShouldCollectDeviceName(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setShouldCollectDeviceName(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[System.Obsolete]
|
|
||||||
public void setShouldCollectDeviceName_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setShouldCollectDeviceName(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().setShouldCollectDeviceName(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableCollectIAd_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableCollectIAd(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableCollectIAd(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setDisableCollectIAd_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setDisableCollectIAd(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().setDisableCollectIAd(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setUseReceiptValidationSandbox_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setUseReceiptValidationSandbox(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setUseReceiptValidationSandbox(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setUseReceiptValidationSandbox_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setUseReceiptValidationSandbox(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().setUseReceiptValidationSandbox(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ssetUseUninstallSandbox_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setUseUninstallSandbox(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().setUseUninstallSandbox(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setUseUninstallSandbox_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setUseUninstallSandbox(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().setUseUninstallSandbox(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void validateAndSendInAppPurchase_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
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<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
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<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
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<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(30);
|
|
||||||
AppsFlyerMOCKInterface.Received().waitForATTUserAuthorizationWithTimeoutInterval(30);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void setCurrentDeviceLanguage_called()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.setCurrentDeviceLanguage("en");
|
|
||||||
AppsFlyerMOCKInterface.Received().setCurrentDeviceLanguage("en");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void disableSKAdNetwork_called_true()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.disableSKAdNetwork(true);
|
|
||||||
AppsFlyerMOCKInterface.Received().disableSKAdNetwork(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void disableSKAdNetwork_called_false()
|
|
||||||
{
|
|
||||||
|
|
||||||
var AppsFlyerMOCKInterface = Substitute.For<IAppsFlyerIOSBridge>();
|
|
||||||
|
|
||||||
AppsFlyer.instance = AppsFlyerMOCKInterface;
|
|
||||||
AppsFlyer.disableSKAdNetwork(false);
|
|
||||||
AppsFlyerMOCKInterface.Received().disableSKAdNetwork(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1b1a24aa01166451d804d7c03c14a3db
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "appsflyer-unity-plugin",
|
"name": "appsflyer-unity-plugin",
|
||||||
"displayName": "AppsFlyer",
|
"displayName": "AppsFlyer",
|
||||||
"description": "AppsFlyer Unity plugin",
|
"description": "AppsFlyer Unity plugin",
|
||||||
"version": "6.14.0",
|
"version": "6.17.5",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a018e17712e364f0e97a392611a0718c
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7e34367e2fda2451da80e204c278c92a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 3429646f5d4949efa347230fa86778b7
|
guid: e2d7ea0845de4cf984265d2a444b7aa4
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.182/Google.IOSResolver.dll
|
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll
|
||||||
- gvhp_targets-editor
|
- gvhp_targets-editor
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -14,7 +14,7 @@ PluginImporter:
|
|||||||
isPreloaded: 0
|
isPreloaded: 0
|
||||||
isOverridable: 0
|
isOverridable: 0
|
||||||
isExplicitlyReferenced: 0
|
isExplicitlyReferenced: 0
|
||||||
validateReferences: 1
|
validateReferences: 0
|
||||||
platformData:
|
platformData:
|
||||||
- first:
|
- first:
|
||||||
Any:
|
Any:
|
||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5b1a2b9a8d0748609fa3195265844d21
|
guid: fa49a85d4ba140a0ae21528ed12d174c
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.182/Google.JarResolver.dll
|
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll
|
||||||
- gvhp_targets-editor
|
- gvhp_targets-editor
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4026c19ba8ec495f93f5919b5f2934ee
|
guid: d8bb10c56a0147bc855a6296778e025e
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.182/Google.PackageManagerResolver.dll
|
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll
|
||||||
- gvhp_targets-editor
|
- gvhp_targets-editor
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 025280fbe75c450fbdf7c5fc7ecc8860
|
guid: 5980a684c61d42fbb6b74e2eb3477016
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.182/Google.VersionHandlerImpl.dll
|
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll
|
||||||
- gvhp_targets-editor
|
- gvhp_targets-editor
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
# Version 1.2.186 - May 19, 2025
|
||||||
|
* iOS Resolver - Set `validateReferences` to off by default,
|
||||||
|
to prevent errors when running without iOS Support installed.
|
||||||
|
Fixes #412 and #622
|
||||||
|
|
||||||
|
# Version 1.2.185 - Feb 3, 2025
|
||||||
|
* Android Resolver - Reverse conditional checker for `packaging` keyword in maintemplate based on android gradle plugin version. Fixes #715
|
||||||
|
|
||||||
|
# Version 1.2.184 - Jan 28, 2025
|
||||||
|
* Android Resolver - Update and resolve `packaging` keyword in maintemplate
|
||||||
|
based on android gradle plugin version.
|
||||||
|
Fixes #715
|
||||||
|
|
||||||
|
# Version 1.2.183 - Sep 18, 2024
|
||||||
|
* Android Resolver - Handle package paths that don't include a version hash,
|
||||||
|
which is no longer present with Unity 6. Fixes #697
|
||||||
|
* Android Resolver - Handle packages referenced using local file paths.
|
||||||
|
Fixes #701
|
||||||
|
|
||||||
# Version 1.2.182 - Aug 2, 2024
|
# Version 1.2.182 - Aug 2, 2024
|
||||||
* General - Check for gradle version instead of Unity version when determining
|
* General - Check for gradle version instead of Unity version when determining
|
||||||
the template files to modify.
|
the template files to modify.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b699fc553a294dbcad96ff0365038f6a
|
guid: aba4ee01c6d145f7bf2d944d892f709a
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md
|
- gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md
|
||||||
timeCreated: 1584567712
|
timeCreated: 1584567712
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 61128ff4560e43ddb606dc203efe7799
|
guid: f7632a50b10045458c53a5ddf7b6d238
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll
|
- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll
|
||||||
- gvhp_targets-editor
|
- gvhp_targets-editor
|
||||||
timeCreated: 1480838400
|
timeCreated: 1480838400
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b91d7551a5d9453e914e5295af46195e
|
guid: ae8b2bc8d1ac4ad48f0ab2b2e7ac75fb
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE
|
- gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE
|
||||||
timeCreated: 1584567712
|
timeCreated: 1584567712
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ EDM4U is available on
|
|||||||
openupm add com.google.external-dependency-manager
|
openupm add com.google.external-dependency-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Install via git URL
|
||||||
|
1. Open Package Manager
|
||||||
|
2. Click on the + icon on the top left corner of the "Package Manager" screen
|
||||||
|
3. Click on "Install package from git url..."
|
||||||
|
4. Paste: https://github.com/googlesamples/unity-jar-resolver.git?path=upm
|
||||||
|
|
||||||
### Install via Google APIs for Unity
|
### Install via Google APIs for Unity
|
||||||
|
|
||||||
EDM4U is available both in UPM and legacy `.unitypackage` formats on
|
EDM4U is available both in UPM and legacy `.unitypackage` formats on
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: ee2d63ed1abf409b893e36120a404f03
|
guid: 77919e84cef8419ab4b725fc16e83d52
|
||||||
labels:
|
labels:
|
||||||
- gvh
|
- gvh
|
||||||
- gvh_version-1.2.182
|
- gvh_version-1.2.186
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/README.md
|
- gvhp_exportpath-ExternalDependencyManager/Editor/README.md
|
||||||
timeCreated: 1584567712
|
timeCreated: 1584567712
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.IOSResolver.dll
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.IOSResolver.pdb
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.JarResolver.dll
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.JarResolver.pdb
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.PackageManagerResolver.dll
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.PackageManagerResolver.pdb
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.VersionHandlerImpl.dll
|
|
||||||
Assets/ExternalDependencyManager/Editor/1.2.182/Google.VersionHandlerImpl.pdb
|
|
||||||
Assets/ExternalDependencyManager/Editor/CHANGELOG.md
|
|
||||||
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll
|
|
||||||
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb
|
|
||||||
Assets/ExternalDependencyManager/Editor/LICENSE
|
|
||||||
Assets/ExternalDependencyManager/Editor/README.md
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d602686ba68d4bfea020d161c28431a9
|
|
||||||
labels:
|
|
||||||
- gvh
|
|
||||||
- gvh_manifest
|
|
||||||
- gvh_version-1.2.182
|
|
||||||
- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.182_manifest.txt
|
|
||||||
- gvhp_manifestname-0External Dependency Manager
|
|
||||||
- gvhp_manifestname-play-services-resolver
|
|
||||||
timeCreated: 1474401009
|
|
||||||
licenseType: Pro
|
|
||||||
TextScriptImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll
|
||||||
|
Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb
|
||||||
|
Assets/ExternalDependencyManager/Editor/CHANGELOG.md
|
||||||
|
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll
|
||||||
|
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb
|
||||||
|
Assets/ExternalDependencyManager/Editor/LICENSE
|
||||||
|
Assets/ExternalDependencyManager/Editor/README.md
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c9a3138961c74d99b7046b783112fceb
|
||||||
|
labels:
|
||||||
|
- gvh
|
||||||
|
- gvh_manifest
|
||||||
|
- gvh_version-1.2.186
|
||||||
|
- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt
|
||||||
|
- gvhp_manifestname-0External Dependency Manager
|
||||||
|
- gvhp_manifestname-play-services-resolver
|
||||||
|
timeCreated: 1474401009
|
||||||
|
licenseType: Pro
|
||||||
|
TextScriptImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<androidPackages>
|
<androidPackages>
|
||||||
<androidPackage spec="com.applovin:applovin-sdk:13.0.0" />
|
<androidPackage spec="com.applovin:applovin-sdk:13.5.1" />
|
||||||
|
<androidPackage spec="com.google.android.ump:user-messaging-platform:2.1.0" />
|
||||||
</androidPackages>
|
</androidPackages>
|
||||||
<iosPods>
|
<iosPods>
|
||||||
<iosPod name="AppLovinSDK" version="13.0.0" />
|
<iosPod name="AppLovinSDK" version="13.5.1" />
|
||||||
|
<iosPod name="GoogleUserMessagingPlatform" version="~> 2.1" />
|
||||||
</iosPods>
|
</iosPods>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
Binary file not shown.
@@ -14,8 +14,8 @@ typedef void (*ALUnityBackgroundCallback)(const char* args);
|
|||||||
|
|
||||||
- (void)initializeSdkWithConfiguration:(ALSdkInitializationConfiguration *)initConfig andCompletionHandler:(ALSdkInitializationCompletionHandler)completionHandler;
|
- (void)initializeSdkWithConfiguration:(ALSdkInitializationConfiguration *)initConfig andCompletionHandler:(ALSdkInitializationCompletionHandler)completionHandler;
|
||||||
|
|
||||||
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition;
|
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition isAdaptive:(BOOL)isAdaptive;
|
||||||
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset;
|
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset isAdaptive:(BOOL)isAdaptive;
|
||||||
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
||||||
- (void)setBannerBackgroundColorForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier hexColorCode:(nullable NSString *)hexColorCode;
|
- (void)setBannerBackgroundColorForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier hexColorCode:(nullable NSString *)hexColorCode;
|
||||||
- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
||||||
@@ -67,18 +67,9 @@ typedef void (*ALUnityBackgroundCallback)(const char* args);
|
|||||||
- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
|
- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
|
||||||
- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
|
- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
|
||||||
|
|
||||||
- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
|
||||||
- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
|
||||||
- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData;
|
|
||||||
- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
|
|
||||||
- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
|
|
||||||
|
|
||||||
// Event Tracking
|
// Event Tracking
|
||||||
- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters;
|
- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters;
|
||||||
|
|
||||||
// Ad Info
|
|
||||||
- (NSString *)adInfoForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
|
|
||||||
|
|
||||||
// Ad Value
|
// Ad Value
|
||||||
- (NSString *)adValueForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier withKey:(nullable NSString *)key;
|
- (NSString *)adValueForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier withKey:(nullable NSString *)key;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern bool max_unity_should_disable_all_logs(void); // Forward declaration
|
||||||
|
|
||||||
// UnityAppController.mm
|
// UnityAppController.mm
|
||||||
UIViewController* UnityGetGLViewController(void);
|
UIViewController* UnityGetGLViewController(void);
|
||||||
UIWindow* UnityGetMainWindow(void);
|
UIWindow* UnityGetMainWindow(void);
|
||||||
@@ -40,7 +42,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface MAUnityAdManager()<MAAdDelegate, MAAdViewAdDelegate, MARewardedAdDelegate, MAAdRevenueDelegate, MAAdReviewDelegate>
|
@interface MAUnityAdManager()<MAAdDelegate, MAAdViewAdDelegate, MARewardedAdDelegate, MAAdRevenueDelegate, MAAdReviewDelegate, MAAdExpirationDelegate>
|
||||||
|
|
||||||
// Parent Fields
|
// Parent Fields
|
||||||
@property (nonatomic, weak) ALSdk *sdk;
|
@property (nonatomic, weak) ALSdk *sdk;
|
||||||
@@ -49,7 +51,6 @@ extern "C" {
|
|||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAInterstitialAd *> *interstitials;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAInterstitialAd *> *interstitials;
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAAppOpenAd *> *appOpenAds;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAAppOpenAd *> *appOpenAds;
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MARewardedAd *> *rewardedAds;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, MARewardedAd *> *rewardedAds;
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MARewardedInterstitialAd *> *rewardedInterstitialAds;
|
|
||||||
|
|
||||||
// AdView Fields
|
// AdView Fields
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAAdView *> *adViews;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAAdView *> *adViews;
|
||||||
@@ -65,6 +66,7 @@ extern "C" {
|
|||||||
@property (nonatomic, strong) NSMutableArray<NSString *> *adUnitIdentifiersToShowAfterCreate;
|
@property (nonatomic, strong) NSMutableArray<NSString *> *adUnitIdentifiersToShowAfterCreate;
|
||||||
@property (nonatomic, strong) NSMutableSet<NSString *> *disabledAdaptiveBannerAdUnitIdentifiers;
|
@property (nonatomic, strong) NSMutableSet<NSString *> *disabledAdaptiveBannerAdUnitIdentifiers;
|
||||||
@property (nonatomic, strong) NSMutableSet<NSString *> *disabledAutoRefreshAdViewAdUnitIdentifiers;
|
@property (nonatomic, strong) NSMutableSet<NSString *> *disabledAutoRefreshAdViewAdUnitIdentifiers;
|
||||||
|
@property (nonatomic, strong) NSMutableSet<NSString *> *ignoreSafeAreaLandscapeAdUnitIdentifiers;
|
||||||
@property (nonatomic, strong) UIView *safeAreaBackground;
|
@property (nonatomic, strong) UIView *safeAreaBackground;
|
||||||
@property (nonatomic, strong, nullable) UIColor *publisherBannerBackgroundColor;
|
@property (nonatomic, strong, nullable) UIColor *publisherBannerBackgroundColor;
|
||||||
|
|
||||||
@@ -110,7 +112,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
self.interstitials = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.interstitials = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
self.appOpenAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.appOpenAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
self.rewardedAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.rewardedAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
self.rewardedInterstitialAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
||||||
self.adViews = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.adViews = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
self.adViewAdFormats = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.adViewAdFormats = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
self.adViewPositions = [NSMutableDictionary dictionaryWithCapacity: 2];
|
self.adViewPositions = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
@@ -124,6 +125,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
self.adUnitIdentifiersToShowAfterCreate = [NSMutableArray arrayWithCapacity: 2];
|
self.adUnitIdentifiersToShowAfterCreate = [NSMutableArray arrayWithCapacity: 2];
|
||||||
self.disabledAdaptiveBannerAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2];
|
self.disabledAdaptiveBannerAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2];
|
||||||
self.disabledAutoRefreshAdViewAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2];
|
self.disabledAutoRefreshAdViewAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2];
|
||||||
|
self.ignoreSafeAreaLandscapeAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2];
|
||||||
self.adInfoDict = [NSMutableDictionary dictionary];
|
self.adInfoDict = [NSMutableDictionary dictionary];
|
||||||
self.adInfoDictLock = [[NSObject alloc] init];
|
self.adInfoDictLock = [[NSObject alloc] init];
|
||||||
|
|
||||||
@@ -223,14 +225,14 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
#pragma mark - Banners
|
#pragma mark - Banners
|
||||||
|
|
||||||
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition
|
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition isAdaptive:(BOOL)isAdaptive
|
||||||
{
|
{
|
||||||
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: bannerPosition withOffset: CGPointZero];
|
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: bannerPosition withOffset: CGPointZero isAdaptive: isAdaptive];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset
|
- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset isAdaptive:(BOOL)isAdaptive
|
||||||
{
|
{
|
||||||
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
|
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) isAdaptive: isAdaptive];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
||||||
@@ -323,12 +325,12 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)mrecPosition
|
- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)mrecPosition
|
||||||
{
|
{
|
||||||
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero];
|
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero isAdaptive: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset
|
- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset
|
||||||
{
|
{
|
||||||
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
|
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) isAdaptive: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
- (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
||||||
@@ -516,44 +518,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
[rewardedAd setLocalExtraParameterForKey: key value: value];
|
[rewardedAd setLocalExtraParameterForKey: key value: value];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Rewarded Interstitials
|
|
||||||
|
|
||||||
- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
|
||||||
{
|
|
||||||
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
[rewardedInterstitialAd loadAd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
|
||||||
{
|
|
||||||
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
return [rewardedInterstitialAd isReady];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData
|
|
||||||
{
|
|
||||||
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
[rewardedInterstitialAd showAdForPlacement: placement customData: customData];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
|
|
||||||
{
|
|
||||||
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
[rewardedInterstitialAd setExtraParameterForKey: key value: value];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
|
|
||||||
{
|
|
||||||
if ( !key )
|
|
||||||
{
|
|
||||||
[self log: @"Failed to set local extra parameter: No key specified"];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
[rewardedInterstitialAd setLocalExtraParameterForKey: key value: value];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Event Tracking
|
#pragma mark - Event Tracking
|
||||||
|
|
||||||
- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters
|
- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters
|
||||||
@@ -564,16 +528,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
#pragma mark - Ad Info
|
#pragma mark - Ad Info
|
||||||
|
|
||||||
- (NSString *)adInfoForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
|
|
||||||
{
|
|
||||||
if ( ![adUnitIdentifier al_isValidString] ) return @"";
|
|
||||||
|
|
||||||
MAAd *ad = [self adWithAdUnitIdentifier: adUnitIdentifier];
|
|
||||||
if ( !ad ) return @"";
|
|
||||||
|
|
||||||
return [MAUnityAdManager serializeParameters: [self adInfoForAd: ad]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDictionary<NSString *, id> *)adInfoForAd:(MAAd *)ad
|
- (NSDictionary<NSString *, id> *)adInfoForAd:(MAAd *)ad
|
||||||
{
|
{
|
||||||
return @{@"adUnitId" : ad.adUnitIdentifier,
|
return @{@"adUnitId" : ad.adUnitIdentifier,
|
||||||
@@ -625,6 +579,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
networkInfoObject[@"adapterClassName"] = response.mediatedNetwork.adapterClassName;
|
networkInfoObject[@"adapterClassName"] = response.mediatedNetwork.adapterClassName;
|
||||||
networkInfoObject[@"adapterVersion"] = response.mediatedNetwork.adapterVersion;
|
networkInfoObject[@"adapterVersion"] = response.mediatedNetwork.adapterVersion;
|
||||||
networkInfoObject[@"sdkVersion"] = response.mediatedNetwork.sdkVersion;
|
networkInfoObject[@"sdkVersion"] = response.mediatedNetwork.sdkVersion;
|
||||||
|
networkInfoObject[@"initializationStatus"] = @(response.mediatedNetwork.initializationStatus);
|
||||||
|
|
||||||
networkResponseDict[@"mediatedNetwork"] = networkInfoObject;
|
networkResponseDict[@"mediatedNetwork"] = networkInfoObject;
|
||||||
}
|
}
|
||||||
@@ -703,10 +658,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnRewardedAdLoadedEvent";
|
name = @"OnRewardedAdLoadedEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewardedInterstitial == adFormat )
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdLoadedEvent";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logInvalidAdFormat: adFormat];
|
[self logInvalidAdFormat: adFormat];
|
||||||
@@ -760,10 +711,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnRewardedAdLoadFailedEvent";
|
name = @"OnRewardedAdLoadFailedEvent";
|
||||||
}
|
}
|
||||||
else if ( self.rewardedInterstitialAds[adUnitIdentifier] )
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdLoadFailedEvent";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self log: @"invalid adUnitId from %@", [NSThread callStackSymbols]];
|
[self log: @"invalid adUnitId from %@", [NSThread callStackSymbols]];
|
||||||
@@ -811,10 +758,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnRewardedAdClickedEvent";
|
name = @"OnRewardedAdClickedEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewardedInterstitial == adFormat )
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdClickedEvent";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logInvalidAdFormat: adFormat];
|
[self logInvalidAdFormat: adFormat];
|
||||||
@@ -848,14 +791,10 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnAppOpenAdDisplayedEvent";
|
name = @"OnAppOpenAdDisplayedEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewarded == adFormat )
|
else // rewarded
|
||||||
{
|
{
|
||||||
name = @"OnRewardedAdDisplayedEvent";
|
name = @"OnRewardedAdDisplayedEvent";
|
||||||
}
|
}
|
||||||
else // rewarded inters
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdDisplayedEvent";
|
|
||||||
}
|
|
||||||
|
|
||||||
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
||||||
[self forwardUnityEventWithArgs: args];
|
[self forwardUnityEventWithArgs: args];
|
||||||
@@ -879,14 +818,10 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnAppOpenAdFailedToDisplayEvent";
|
name = @"OnAppOpenAdFailedToDisplayEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewarded == adFormat )
|
else // rewarded
|
||||||
{
|
{
|
||||||
name = @"OnRewardedAdFailedToDisplayEvent";
|
name = @"OnRewardedAdFailedToDisplayEvent";
|
||||||
}
|
}
|
||||||
else // rewarded inters
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdFailedToDisplayEvent";
|
|
||||||
}
|
|
||||||
|
|
||||||
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
||||||
args[@"errorCode"] = [@(error.code) stringValue];
|
args[@"errorCode"] = [@(error.code) stringValue];
|
||||||
@@ -930,14 +865,10 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnAppOpenAdHiddenEvent";
|
name = @"OnAppOpenAdHiddenEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewarded == adFormat )
|
else // rewarded
|
||||||
{
|
{
|
||||||
name = @"OnRewardedAdHiddenEvent";
|
name = @"OnRewardedAdHiddenEvent";
|
||||||
}
|
}
|
||||||
else // rewarded inters
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdHiddenEvent";
|
|
||||||
}
|
|
||||||
|
|
||||||
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
||||||
[self forwardUnityEventWithArgs: args];
|
[self forwardUnityEventWithArgs: args];
|
||||||
@@ -1020,7 +951,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
|
|
||||||
MAAdFormat *adFormat = ad.format;
|
MAAdFormat *adFormat = ad.format;
|
||||||
if ( adFormat != MAAdFormat.rewarded && adFormat != MAAdFormat.rewardedInterstitial )
|
if ( adFormat != MAAdFormat.rewarded )
|
||||||
{
|
{
|
||||||
[self logInvalidAdFormat: adFormat];
|
[self logInvalidAdFormat: adFormat];
|
||||||
return;
|
return;
|
||||||
@@ -1029,9 +960,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
NSString *rewardLabel = reward ? reward.label : @"";
|
NSString *rewardLabel = reward ? reward.label : @"";
|
||||||
NSInteger rewardAmountInt = reward ? reward.amount : 0;
|
NSInteger rewardAmountInt = reward ? reward.amount : 0;
|
||||||
NSString *rewardAmount = [@(rewardAmountInt) stringValue];
|
NSString *rewardAmount = [@(rewardAmountInt) stringValue];
|
||||||
|
NSString *name = @"OnRewardedAdReceivedRewardEvent";
|
||||||
NSString *name = (adFormat == MAAdFormat.rewarded) ? @"OnRewardedAdReceivedRewardEvent" : @"OnRewardedInterstitialAdReceivedRewardEvent";
|
|
||||||
|
|
||||||
|
|
||||||
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
|
||||||
args[@"rewardLabel"] = rewardLabel;
|
args[@"rewardLabel"] = rewardLabel;
|
||||||
@@ -1066,10 +995,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnRewardedAdRevenuePaidEvent";
|
name = @"OnRewardedAdRevenuePaidEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewardedInterstitial == adFormat )
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdRevenuePaidEvent";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logInvalidAdFormat: adFormat];
|
[self logInvalidAdFormat: adFormat];
|
||||||
@@ -1082,6 +1007,43 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)didReloadExpiredAd:(MAAd *)expiredAd withNewAd:(MAAd *)newAd;
|
||||||
|
{
|
||||||
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
|
|
||||||
|
NSString *name;
|
||||||
|
MAAdFormat *adFormat = newAd.format;
|
||||||
|
if ( MAAdFormat.interstitial == adFormat )
|
||||||
|
{
|
||||||
|
name = @"OnExpiredInterstitialAdReloadedEvent";
|
||||||
|
}
|
||||||
|
else if ( MAAdFormat.appOpen == adFormat )
|
||||||
|
{
|
||||||
|
name = @"OnExpiredAppOpenAdReloadedEvent";
|
||||||
|
}
|
||||||
|
else if ( MAAdFormat.rewarded == adFormat )
|
||||||
|
{
|
||||||
|
name = @"OnExpiredRewardedAdReloadedEvent ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self logInvalidAdFormat: adFormat];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@synchronized ( self.adInfoDictLock )
|
||||||
|
{
|
||||||
|
self.adInfoDict[newAd.adUnitIdentifier] = newAd;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableDictionary<NSString *, NSObject *> *args = [NSMutableDictionary dictionary];
|
||||||
|
args[@"expiredAdInfo"] = [self adInfoForAd: expiredAd];
|
||||||
|
args[@"newAdInfo"] = [self adInfoForAd: newAd];
|
||||||
|
args[@"name"] = name;
|
||||||
|
[self forwardUnityEventWithArgs: args];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
- (void)didGenerateCreativeIdentifier:(NSString *)creativeIdentifier forAd:(MAAd *)ad
|
- (void)didGenerateCreativeIdentifier:(NSString *)creativeIdentifier forAd:(MAAd *)ad
|
||||||
{
|
{
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
@@ -1104,10 +1066,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
{
|
{
|
||||||
name = @"OnRewardedAdReviewCreativeIdGeneratedEvent";
|
name = @"OnRewardedAdReviewCreativeIdGeneratedEvent";
|
||||||
}
|
}
|
||||||
else if ( MAAdFormat.rewardedInterstitial == adFormat )
|
|
||||||
{
|
|
||||||
name = @"OnRewardedInterstitialAdReviewCreativeIdGeneratedEvent";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logInvalidAdFormat: adFormat];
|
[self logInvalidAdFormat: adFormat];
|
||||||
@@ -1133,7 +1091,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
#pragma mark - Internal Methods
|
#pragma mark - Internal Methods
|
||||||
|
|
||||||
- (void)createAdViewWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset
|
- (void)createAdViewWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset isAdaptive:(BOOL)isAdaptive
|
||||||
{
|
{
|
||||||
max_unity_dispatch_on_main_thread(^{
|
max_unity_dispatch_on_main_thread(^{
|
||||||
[self log: @"Creating %@ with ad unit identifier \"%@\" and position: \"%@\"", adFormat, adUnitIdentifier, adViewPosition];
|
[self log: @"Creating %@ with ad unit identifier \"%@\" and position: \"%@\"", adFormat, adUnitIdentifier, adViewPosition];
|
||||||
@@ -1144,7 +1102,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve ad view from the map
|
// Retrieve ad view from the map
|
||||||
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset];
|
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset isAdaptive: isAdaptive];
|
||||||
adView.hidden = YES;
|
adView.hidden = YES;
|
||||||
self.safeAreaBackground.hidden = YES;
|
self.safeAreaBackground.hidden = YES;
|
||||||
|
|
||||||
@@ -1154,16 +1112,6 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
NSDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier];
|
NSDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier];
|
||||||
|
|
||||||
// Enable adaptive banners by default for banners and leaders.
|
|
||||||
if ( [adFormat isBannerOrLeaderAd] )
|
|
||||||
{
|
|
||||||
// Check if there is already a pending setting for adaptive banners. If not, enable them.
|
|
||||||
if ( !extraParameters[@"adaptive_banner"] )
|
|
||||||
{
|
|
||||||
[adView setExtraParameterForKey: @"adaptive_banner" value: @"true"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle initial extra parameters if publisher sets it before creating ad view
|
// Handle initial extra parameters if publisher sets it before creating ad view
|
||||||
if ( extraParameters )
|
if ( extraParameters )
|
||||||
{
|
{
|
||||||
@@ -1430,6 +1378,8 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
}
|
}
|
||||||
else if ( [@"adaptive_banner" isEqualToString: key] )
|
else if ( [@"adaptive_banner" isEqualToString: key] )
|
||||||
{
|
{
|
||||||
|
[self log: @"Setting adaptive banners via extra parameters is deprecated and will be removed in a future plugin version. Use the CreateBanner(adUnitIdentifier, AdViewConfiguration) API to properly configure adaptive banners."];
|
||||||
|
|
||||||
BOOL shouldUseAdaptiveBanner = [NSNumber al_numberWithString: value].boolValue;
|
BOOL shouldUseAdaptiveBanner = [NSNumber al_numberWithString: value].boolValue;
|
||||||
if ( shouldUseAdaptiveBanner )
|
if ( shouldUseAdaptiveBanner )
|
||||||
{
|
{
|
||||||
@@ -1442,6 +1392,18 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
||||||
}
|
}
|
||||||
|
else if ( [@"ignore_safe_area_landscape" isEqualToString: key] && [NSNumber al_numberWithString: value].boolValue )
|
||||||
|
{
|
||||||
|
[self.ignoreSafeAreaLandscapeAdUnitIdentifiers addObject: adUnitIdentifier];
|
||||||
|
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( [adFormat isAdViewAd] && [@"clips_to_bounds" isEqualToString: key] )
|
||||||
|
{
|
||||||
|
BOOL clipsToBounds = [NSNumber al_numberWithString: value].boolValue;
|
||||||
|
MAAdView *view = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
||||||
|
view.clipsToBounds = clipsToBounds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1544,6 +1506,8 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
- (void)log:(NSString *)format, ...
|
- (void)log:(NSString *)format, ...
|
||||||
{
|
{
|
||||||
|
if (max_unity_should_disable_all_logs()) return;
|
||||||
|
|
||||||
va_list valist;
|
va_list valist;
|
||||||
va_start(valist, format);
|
va_start(valist, format);
|
||||||
NSString *message = [[NSString alloc] initWithFormat: format arguments: valist];
|
NSString *message = [[NSString alloc] initWithFormat: format arguments: valist];
|
||||||
@@ -1554,6 +1518,8 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
+ (void)log:(NSString *)format, ...
|
+ (void)log:(NSString *)format, ...
|
||||||
{
|
{
|
||||||
|
if (max_unity_should_disable_all_logs()) return;
|
||||||
|
|
||||||
va_list valist;
|
va_list valist;
|
||||||
va_start(valist, format);
|
va_start(valist, format);
|
||||||
NSString *message = [[NSString alloc] initWithFormat: format arguments: valist];
|
NSString *message = [[NSString alloc] initWithFormat: format arguments: valist];
|
||||||
@@ -1567,10 +1533,11 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
MAInterstitialAd *result = self.interstitials[adUnitIdentifier];
|
MAInterstitialAd *result = self.interstitials[adUnitIdentifier];
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
result = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk];
|
result = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: adUnitIdentifier];
|
||||||
result.delegate = self;
|
result.delegate = self;
|
||||||
result.revenueDelegate = self;
|
result.revenueDelegate = self;
|
||||||
result.adReviewDelegate = self;
|
result.adReviewDelegate = self;
|
||||||
|
result.expirationDelegate = self;
|
||||||
|
|
||||||
self.interstitials[adUnitIdentifier] = result;
|
self.interstitials[adUnitIdentifier] = result;
|
||||||
}
|
}
|
||||||
@@ -1583,9 +1550,10 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
MAAppOpenAd *result = self.appOpenAds[adUnitIdentifier];
|
MAAppOpenAd *result = self.appOpenAds[adUnitIdentifier];
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
result = [[MAAppOpenAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk];
|
result = [[MAAppOpenAd alloc] initWithAdUnitIdentifier: adUnitIdentifier];
|
||||||
result.delegate = self;
|
result.delegate = self;
|
||||||
result.revenueDelegate = self;
|
result.revenueDelegate = self;
|
||||||
|
result.expirationDelegate = self;
|
||||||
|
|
||||||
self.appOpenAds[adUnitIdentifier] = result;
|
self.appOpenAds[adUnitIdentifier] = result;
|
||||||
}
|
}
|
||||||
@@ -1598,10 +1566,11 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
MARewardedAd *result = self.rewardedAds[adUnitIdentifier];
|
MARewardedAd *result = self.rewardedAds[adUnitIdentifier];
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
result = [MARewardedAd sharedWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk];
|
result = [MARewardedAd sharedWithAdUnitIdentifier: adUnitIdentifier];
|
||||||
result.delegate = self;
|
result.delegate = self;
|
||||||
result.revenueDelegate = self;
|
result.revenueDelegate = self;
|
||||||
result.adReviewDelegate = self;
|
result.adReviewDelegate = self;
|
||||||
|
result.expirationDelegate = self;
|
||||||
|
|
||||||
self.rewardedAds[adUnitIdentifier] = result;
|
self.rewardedAds[adUnitIdentifier] = result;
|
||||||
}
|
}
|
||||||
@@ -1609,34 +1578,35 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MARewardedInterstitialAd *)retrieveRewardedInterstitialAdForAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
||||||
{
|
|
||||||
MARewardedInterstitialAd *result = self.rewardedInterstitialAds[adUnitIdentifier];
|
|
||||||
if ( !result )
|
|
||||||
{
|
|
||||||
result = [[MARewardedInterstitialAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk];
|
|
||||||
result.delegate = self;
|
|
||||||
result.revenueDelegate = self;
|
|
||||||
result.adReviewDelegate = self;
|
|
||||||
|
|
||||||
self.rewardedInterstitialAds[adUnitIdentifier] = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat
|
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat
|
||||||
{
|
{
|
||||||
return [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: nil withOffset: CGPointZero];
|
return [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: nil withOffset: CGPointZero isAdaptive: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset
|
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset isAdaptive:(BOOL)isAdaptive
|
||||||
{
|
{
|
||||||
MAAdView *result = self.adViews[adUnitIdentifier];
|
MAAdView *result = self.adViews[adUnitIdentifier];
|
||||||
if ( !result && adViewPosition )
|
if ( !result && adViewPosition )
|
||||||
{
|
{
|
||||||
result = [[MAAdView alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat sdk: self.sdk];
|
MAAdViewConfiguration *config = [MAAdViewConfiguration configurationWithBuilderBlock:^(MAAdViewConfigurationBuilder *builder) {
|
||||||
|
|
||||||
|
// Set adaptive type only for banner ads. If adaptive is enabled, use ANCHORED; otherwise, fall back to NONE.
|
||||||
|
if ( [adFormat isBannerOrLeaderAd] )
|
||||||
|
{
|
||||||
|
if ( isAdaptive )
|
||||||
|
{
|
||||||
|
builder.adaptiveType = MAAdViewAdaptiveTypeAnchored;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.adaptiveType = MAAdViewAdaptiveTypeNone;
|
||||||
|
[self.disabledAdaptiveBannerAdUnitIdentifiers addObject:adUnitIdentifier];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
// There is a Unity bug where if an empty UIView is on screen with user interaction enabled, and a user interacts with it, it just passes the events to random parts of the screen.
|
// There is a Unity bug where if an empty UIView is on screen with user interaction enabled, and a user interacts with it, it just passes the events to random parts of the screen.
|
||||||
|
result = [[MAAdView alloc] initWithAdUnitIdentifier:adUnitIdentifier adFormat:adFormat configuration:config];
|
||||||
result.userInteractionEnabled = NO;
|
result.userInteractionEnabled = NO;
|
||||||
result.translatesAutoresizingMaskIntoConstraints = NO;
|
result.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
result.delegate = self;
|
result.delegate = self;
|
||||||
@@ -1733,6 +1703,8 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]];
|
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]];
|
||||||
|
|
||||||
UILayoutGuide *layoutGuide = superview.safeAreaLayoutGuide;
|
UILayoutGuide *layoutGuide = superview.safeAreaLayoutGuide;
|
||||||
|
BOOL shouldIgnoreSafeArea = [self shouldIgnoreSafeAreaForAdUnitIdentifier: adUnitIdentifier];
|
||||||
|
NSLayoutAnchor *topAnchor = shouldIgnoreSafeArea ? superview.topAnchor : layoutGuide.topAnchor;
|
||||||
|
|
||||||
if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] )
|
if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] )
|
||||||
{
|
{
|
||||||
@@ -1763,7 +1735,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
if ( [adViewPosition isEqual: @"top_center"] )
|
if ( [adViewPosition isEqual: @"top_center"] )
|
||||||
{
|
{
|
||||||
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor],
|
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: topAnchor],
|
||||||
[self.safeAreaBackground.topAnchor constraintEqualToAnchor: superview.topAnchor],
|
[self.safeAreaBackground.topAnchor constraintEqualToAnchor: superview.topAnchor],
|
||||||
[self.safeAreaBackground.bottomAnchor constraintEqualToAnchor: adView.topAnchor]]];
|
[self.safeAreaBackground.bottomAnchor constraintEqualToAnchor: adView.topAnchor]]];
|
||||||
}
|
}
|
||||||
@@ -1783,7 +1755,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
if ( [adViewPosition isEqual: @"top_center"] )
|
if ( [adViewPosition isEqual: @"top_center"] )
|
||||||
{
|
{
|
||||||
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor],
|
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: topAnchor],
|
||||||
[self.safeAreaBackground.topAnchor constraintEqualToAnchor: superview.topAnchor],
|
[self.safeAreaBackground.topAnchor constraintEqualToAnchor: superview.topAnchor],
|
||||||
[self.safeAreaBackground.bottomAnchor constraintEqualToAnchor: adView.topAnchor]]];
|
[self.safeAreaBackground.bottomAnchor constraintEqualToAnchor: adView.topAnchor]]];
|
||||||
}
|
}
|
||||||
@@ -1805,7 +1777,7 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
|
|
||||||
if ( [adViewPosition isEqual: @"top_center"] )
|
if ( [adViewPosition isEqual: @"top_center"] )
|
||||||
{
|
{
|
||||||
[constraints addObject: [adView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor]];
|
[constraints addObject: [adView.topAnchor constraintEqualToAnchor: topAnchor]];
|
||||||
}
|
}
|
||||||
else // BottomCenter
|
else // BottomCenter
|
||||||
{
|
{
|
||||||
@@ -1922,11 +1894,11 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
if ( [adViewPosition isEqual: @"top_left"] )
|
if ( [adViewPosition isEqual: @"top_left"] )
|
||||||
{
|
{
|
||||||
[constraints addObjectsFromArray: @[[adView.leftAnchor constraintEqualToAnchor: superview.leftAnchor constant: adViewOffset.x],
|
[constraints addObjectsFromArray: @[[adView.leftAnchor constraintEqualToAnchor: superview.leftAnchor constant: adViewOffset.x],
|
||||||
[adView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor constant: adViewOffset.y]]];
|
[adView.topAnchor constraintEqualToAnchor: topAnchor constant: adViewOffset.y]]];
|
||||||
}
|
}
|
||||||
else if ( [adViewPosition isEqual: @"top_right"] )
|
else if ( [adViewPosition isEqual: @"top_right"] )
|
||||||
{
|
{
|
||||||
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor],
|
[constraints addObjectsFromArray: @[[adView.topAnchor constraintEqualToAnchor: topAnchor],
|
||||||
[adView.rightAnchor constraintEqualToAnchor: superview.rightAnchor]]];
|
[adView.rightAnchor constraintEqualToAnchor: superview.rightAnchor]]];
|
||||||
}
|
}
|
||||||
else if ( [adViewPosition isEqual: @"centered"] )
|
else if ( [adViewPosition isEqual: @"centered"] )
|
||||||
@@ -2081,4 +2053,15 @@ static ALUnityBackgroundCallback backgroundCallback;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Helper
|
||||||
|
|
||||||
|
- (BOOL)shouldIgnoreSafeAreaForAdUnitIdentifier:(NSString *)adUnitIdentifier
|
||||||
|
{
|
||||||
|
if ( ![self.ignoreSafeAreaLandscapeAdUnitIdentifiers containsObject: adUnitIdentifier] ) return NO;
|
||||||
|
|
||||||
|
// We should use the superview instead of layout guide if the application's orientation is landscape and the extra parameter is set
|
||||||
|
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||||
|
return orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -8,12 +8,13 @@
|
|||||||
|
|
||||||
#import "MAUnityAdManager.h"
|
#import "MAUnityAdManager.h"
|
||||||
|
|
||||||
#define VERSION @"7.0.0"
|
#define VERSION @"8.5.1"
|
||||||
#define NSSTRING(_X) ( (_X != NULL) ? [NSString stringWithCString: _X encoding: NSStringEncodingConversionAllowLossy].al_stringByTrimmingWhitespace : nil)
|
#define NSSTRING(_X) ( (_X != NULL) ? [NSString stringWithCString: _X encoding: NSStringEncodingConversionAllowLossy].al_stringByTrimmingWhitespace : nil)
|
||||||
|
|
||||||
@interface NSString (ALUtils)
|
@interface NSString (ALUtils)
|
||||||
@property (nonatomic, copy, readonly) NSString *al_stringByTrimmingWhitespace;
|
@property (nonatomic, copy, readonly) NSString *al_stringByTrimmingWhitespace;
|
||||||
@property (assign, readonly, getter=al_isValidString) BOOL al_validString;
|
@property (assign, readonly, getter=al_isValidString) BOOL al_validString;
|
||||||
|
- (BOOL)al_isEqualToStringIgnoringCase:(nullable NSString *)otherString;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface ALSdkInitializationConfigurationBuilder (ALUtils)
|
@interface ALSdkInitializationConfigurationBuilder (ALUtils)
|
||||||
@@ -35,11 +36,13 @@ extern "C"
|
|||||||
|
|
||||||
static bool _isSdkInitialized = false;
|
static bool _isSdkInitialized = false;
|
||||||
static bool _initializeSdkCalled = false;
|
static bool _initializeSdkCalled = false;
|
||||||
|
static bool _disableAllLogs = false;
|
||||||
|
|
||||||
// Helper method to create C string copy
|
// Helper method to create C string copy
|
||||||
static const char * cStringCopy(NSString *string);
|
static const char * cStringCopy(NSString *string);
|
||||||
// Helper method to log errors
|
// Helper method to log errors
|
||||||
void logUninitializedAccessError(const char *callingMethod);
|
void max_unity_log_uninitialized_access_error(const char *callingMethod);
|
||||||
|
void max_unity_log_error(NSString *message);
|
||||||
|
|
||||||
ALSdk *getSdk()
|
ALSdk *getSdk()
|
||||||
{
|
{
|
||||||
@@ -72,6 +75,11 @@ extern "C"
|
|||||||
return _initConfigurationBuilder;
|
return _initConfigurationBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool max_unity_should_disable_all_logs()
|
||||||
|
{
|
||||||
|
return _disableAllLogs;
|
||||||
|
}
|
||||||
|
|
||||||
int getConsentStatusValue(NSNumber *consentStatus)
|
int getConsentStatusValue(NSNumber *consentStatus)
|
||||||
{
|
{
|
||||||
if ( consentStatus )
|
if ( consentStatus )
|
||||||
@@ -182,13 +190,14 @@ extern "C"
|
|||||||
NSArray<MAMediatedNetworkInfo *> *availableMediatedNetworks = [getSdk() availableMediatedNetworks];
|
NSArray<MAMediatedNetworkInfo *> *availableMediatedNetworks = [getSdk() availableMediatedNetworks];
|
||||||
|
|
||||||
// Create array of serialized network strings
|
// Create array of serialized network strings
|
||||||
NSMutableArray<NSDictionary<NSString *, NSString *> *> *serializedNetworks = [NSMutableArray arrayWithCapacity: availableMediatedNetworks.count];
|
NSMutableArray<NSDictionary<NSString *, id> *> *serializedNetworks = [NSMutableArray arrayWithCapacity: availableMediatedNetworks.count];
|
||||||
for ( MAMediatedNetworkInfo *mediatedNetwork in availableMediatedNetworks )
|
for ( MAMediatedNetworkInfo *mediatedNetwork in availableMediatedNetworks )
|
||||||
{
|
{
|
||||||
NSDictionary<NSString *, NSString *> *mediatedNetworkDictionary = @{@"name" : mediatedNetwork.name,
|
NSDictionary<NSString *, id> *mediatedNetworkDictionary = @{@"name" : mediatedNetwork.name,
|
||||||
@"adapterClassName" : mediatedNetwork.adapterClassName,
|
@"adapterClassName" : mediatedNetwork.adapterClassName,
|
||||||
@"adapterVersion" : mediatedNetwork.adapterVersion,
|
@"adapterVersion" : mediatedNetwork.adapterVersion,
|
||||||
@"sdkVersion" : mediatedNetwork.sdkVersion};
|
@"sdkVersion" : mediatedNetwork.sdkVersion,
|
||||||
|
@"initializationStatus" : @(mediatedNetwork.initializationStatus)};
|
||||||
[serializedNetworks addObject: mediatedNetworkDictionary];
|
[serializedNetworks addObject: mediatedNetworkDictionary];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +209,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Failed to show mediation debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG);
|
max_unity_log_error(@"Failed to show mediation debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,25 +220,13 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Failed to show creative debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG);
|
max_unity_log_error(@"Failed to show creative debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[getSdk() showCreativeDebugger];
|
[getSdk() showCreativeDebugger];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MaxShowConsentDialog()
|
|
||||||
{
|
|
||||||
NSLog(@"[%@] Failed to show consent dialog - Unavailable on iOS, please use the consent flow: https://developers.applovin.com/en/unity/overview/terms-and-privacy-policy-flow", TAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _MaxConsentDialogState()
|
|
||||||
{
|
|
||||||
if ( !_isSdkInitialized ) return ALConsentDialogStateUnknown;
|
|
||||||
|
|
||||||
return (int) getSdk().configuration.consentDialogState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxSetUserId(const char *userId)
|
void _MaxSetUserId(const char *userId)
|
||||||
{
|
{
|
||||||
getSdk().settings.userIdentifier = NSSTRING(userId);
|
getSdk().settings.userIdentifier = NSSTRING(userId);
|
||||||
@@ -239,7 +236,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( _initializeSdkCalled )
|
if ( _initializeSdkCalled )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Segment collection must be set before MAX SDK is initialized", TAG);
|
max_unity_log_error(@"Segment collection must be set before MAX SDK is initialized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +247,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxGetSdkConfiguration");
|
max_unity_log_uninitialized_access_error("_MaxGetSdkConfiguration");
|
||||||
return cStringCopy(@"");
|
return cStringCopy(@"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,33 +293,33 @@ extern "C"
|
|||||||
return [ALPrivacySettings isDoNotSellSet];
|
return [ALPrivacySettings isDoNotSellSet];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MaxCreateBanner(const char *adUnitIdentifier, const char *bannerPosition)
|
void _MaxCreateBanner(const char *adUnitIdentifier, const char *bannerPosition, bool isAdaptive)
|
||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxCreateBanner");
|
max_unity_log_uninitialized_access_error("_MaxCreateBanner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[getAdManager() createBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) atPosition: NSSTRING(bannerPosition)];
|
[getAdManager() createBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) atPosition: NSSTRING(bannerPosition) isAdaptive: isAdaptive];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MaxCreateBannerXY(const char *adUnitIdentifier, const float x, const float y)
|
void _MaxCreateBannerXY(const char *adUnitIdentifier, const float x, const float y, bool isAdaptive)
|
||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxCreateBannerXY");
|
max_unity_log_uninitialized_access_error("_MaxCreateBannerXY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[getAdManager() createBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) x: x y: y];
|
[getAdManager() createBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) x: x y: y isAdaptive: isAdaptive];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MaxLoadBanner(const char *adUnitIdentifier)
|
void _MaxLoadBanner(const char *adUnitIdentifier)
|
||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxLoadBanner");
|
max_unity_log_uninitialized_access_error("_MaxLoadBanner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +330,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerBackgroundColor");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerBackgroundColor");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +341,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerPlacement");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerPlacement");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +352,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxStartBannerAutoRefresh");
|
max_unity_log_uninitialized_access_error("_MaxStartBannerAutoRefresh");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +363,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxStopBannerAutoRefresh");
|
max_unity_log_uninitialized_access_error("_MaxStopBannerAutoRefresh");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +374,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +387,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +400,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +414,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerCustomData");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerCustomData");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +425,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetBannerWidth");
|
max_unity_log_uninitialized_access_error("_MaxSetBannerWidth");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +436,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxUpdateBannerPosition");
|
max_unity_log_uninitialized_access_error("_MaxUpdateBannerPosition");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +447,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxUpdateBannerPositionXY");
|
max_unity_log_uninitialized_access_error("_MaxUpdateBannerPositionXY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +458,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowBanner");
|
max_unity_log_uninitialized_access_error("_MaxShowBanner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,7 +469,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxDestroyBanner");
|
max_unity_log_uninitialized_access_error("_MaxDestroyBanner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +480,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxHideBanner");
|
max_unity_log_uninitialized_access_error("_MaxHideBanner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +491,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxGetBannerLayout");
|
max_unity_log_uninitialized_access_error("_MaxGetBannerLayout");
|
||||||
return cStringCopy(@"");
|
return cStringCopy(@"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +502,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxCreateMRec");
|
max_unity_log_uninitialized_access_error("_MaxCreateMRec");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +513,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxCreateMRecXY");
|
max_unity_log_uninitialized_access_error("_MaxCreateMRecXY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,7 +524,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxLoadMRec");
|
max_unity_log_uninitialized_access_error("_MaxLoadMRec");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +535,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetMRecPlacement");
|
max_unity_log_uninitialized_access_error("_MaxSetMRecPlacement");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +546,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxStartMRecAutoRefresh");
|
max_unity_log_uninitialized_access_error("_MaxStartMRecAutoRefresh");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +557,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxStopMRecAutoRefresh");
|
max_unity_log_uninitialized_access_error("_MaxStopMRecAutoRefresh");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +568,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxUpdateMRecPosition");
|
max_unity_log_uninitialized_access_error("_MaxUpdateMRecPosition");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +579,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxUpdateMRecPositionXY");
|
max_unity_log_uninitialized_access_error("_MaxUpdateMRecPositionXY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +590,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowMRec");
|
max_unity_log_uninitialized_access_error("_MaxShowMRec");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,7 +601,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxDestroyMRec");
|
max_unity_log_uninitialized_access_error("_MaxDestroyMRec");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +612,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxHideMRec");
|
max_unity_log_uninitialized_access_error("_MaxHideMRec");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,7 +623,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetMRecExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetMRecExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +636,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetMRecLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetMRecLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +649,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetMRecLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetMRecLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,7 +663,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetMRecCustomData");
|
max_unity_log_uninitialized_access_error("_MaxSetMRecCustomData");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,7 +674,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxGetMRecLayout");
|
max_unity_log_uninitialized_access_error("_MaxGetMRecLayout");
|
||||||
return cStringCopy(@"");
|
return cStringCopy(@"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,7 +685,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxLoadInterstitial");
|
max_unity_log_uninitialized_access_error("_MaxLoadInterstitial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,7 +696,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetInterstitialExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetInterstitialExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,7 +709,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetInterstitialLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetInterstitialLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +722,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetInterstitialLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetInterstitialLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,7 +736,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxIsInterstitialReady");
|
max_unity_log_uninitialized_access_error("_MaxIsInterstitialReady");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +747,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowInterstitial");
|
max_unity_log_uninitialized_access_error("_MaxShowInterstitial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +758,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxLoadAppOpenAd");
|
max_unity_log_uninitialized_access_error("_MaxLoadAppOpenAd");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,7 +769,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetAppOpenAdExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetAppOpenAdExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +782,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetAppOpenAdLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetAppOpenAdLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,7 +795,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetAppOpenAdLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetAppOpenAdLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,7 +809,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxIsAppOpenAdReady");
|
max_unity_log_uninitialized_access_error("_MaxIsAppOpenAdReady");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,7 +820,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowAppOpenAd");
|
max_unity_log_uninitialized_access_error("_MaxShowAppOpenAd");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,7 +831,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxLoadRewardedAd");
|
max_unity_log_uninitialized_access_error("_MaxLoadRewardedAd");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -845,7 +842,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetRewardedAdExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetRewardedAdExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,7 +855,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetRewardedAdLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetRewardedAdLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,7 +868,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxSetRewardedAdLocalExtraParameter");
|
max_unity_log_uninitialized_access_error("_MaxSetRewardedAdLocalExtraParameter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -885,7 +882,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxIsRewardedAdReady");
|
max_unity_log_uninitialized_access_error("_MaxIsRewardedAdReady");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,91 +893,18 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowRewardedAd");
|
max_unity_log_uninitialized_access_error("_MaxShowRewardedAd");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[getAdManager() showRewardedAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) placement: NSSTRING(placement) customData: NSSTRING(customData)];
|
[getAdManager() showRewardedAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) placement: NSSTRING(placement) customData: NSSTRING(customData)];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MaxLoadRewardedInterstitialAd(const char *adUnitIdentifier)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxLoadRewardedInterstitialAd");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[getAdManager() loadRewardedInterstitialAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxSetRewardedInterstitialAdExtraParameter(const char *adUnitIdentifier, const char *key, const char *value)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxSetRewardedInterstitialAdExtraParameter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[getAdManager() setRewardedInterstitialAdExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
|
|
||||||
key: NSSTRING(key)
|
|
||||||
value: NSSTRING(value)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxSetRewardedInterstitialAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxSetRewardedInterstitialAdLocalExtraParameter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[getAdManager() setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
|
|
||||||
key: NSSTRING(key)
|
|
||||||
value: (__bridge id)value];
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxSetRewardedInterstitialAdLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxSetRewardedInterstitialAdLocalExtraParameter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
id value = getLocalExtraParameterValue(json);
|
|
||||||
[getAdManager() setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
|
|
||||||
key: NSSTRING(key)
|
|
||||||
value: value];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _MaxIsRewardedInterstitialAdReady(const char *adUnitIdentifier)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxIsRewardedInterstitialAdReady");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [getAdManager() isRewardedInterstitialAdReadyWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxShowRewardedInterstitialAd(const char *adUnitIdentifier, const char *placement, const char *customData)
|
|
||||||
{
|
|
||||||
if ( !_initializeSdkCalled )
|
|
||||||
{
|
|
||||||
logUninitializedAccessError("_MaxShowRewardedInterstitialAd");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[getAdManager() showRewardedInterstitialAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) placement: NSSTRING(placement) customData: NSSTRING(customData)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void _MaxTrackEvent(const char *event, const char *parameters)
|
void _MaxTrackEvent(const char *event, const char *parameters)
|
||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxTrackEvent");
|
max_unity_log_uninitialized_access_error("_MaxTrackEvent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,11 +966,6 @@ extern "C"
|
|||||||
return [UIScreen.mainScreen nativeScale];
|
return [UIScreen.mainScreen nativeScale];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * _MaxGetAdInfo(const char *adUnitIdentifier)
|
|
||||||
{
|
|
||||||
return cStringCopy([getAdManager() adInfoForAdUnitIdentifier: NSSTRING(adUnitIdentifier)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char * _MaxGetAdValue(const char *adUnitIdentifier, const char *key)
|
const char * _MaxGetAdValue(const char *adUnitIdentifier, const char *key)
|
||||||
{
|
{
|
||||||
return cStringCopy([getAdManager() adValueForAdUnitIdentifier: NSSTRING(adUnitIdentifier) withKey: NSSTRING(key)]);
|
return cStringCopy([getAdManager() adValueForAdUnitIdentifier: NSSTRING(adUnitIdentifier) withKey: NSSTRING(key)]);
|
||||||
@@ -1066,7 +985,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( _initializeSdkCalled )
|
if ( _initializeSdkCalled )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Test device advertising IDs must be set before MAX SDK is initialized", TAG);
|
max_unity_log_error(@"Test device advertising IDs must be set before MAX SDK is initialized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,7 +1002,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( _initializeSdkCalled )
|
if ( _initializeSdkCalled )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Exception handler must be enabled/disabled before MAX SDK is initialized", TAG);
|
max_unity_log_error(@"Exception handler must be enabled/disabled before MAX SDK is initialized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1095,12 +1014,19 @@ extern "C"
|
|||||||
NSString *stringKey = NSSTRING(key);
|
NSString *stringKey = NSSTRING(key);
|
||||||
if ( ![stringKey al_isValidString] )
|
if ( ![stringKey al_isValidString] )
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Failed to set extra parameter for nil or empty key: %@", TAG, stringKey);
|
NSString *message = [NSString stringWithFormat:@"Failed to set extra parameter for nil or empty key: %@", stringKey];
|
||||||
|
max_unity_log_error(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSString *stringValue = NSSTRING(value);
|
||||||
|
if ( [@"disable_all_logs" isEqualToString: stringKey] )
|
||||||
|
{
|
||||||
|
_disableAllLogs = [@"true" al_isEqualToStringIgnoringCase: stringValue];
|
||||||
|
}
|
||||||
|
|
||||||
ALSdkSettings *settings = getSdk().settings;
|
ALSdkSettings *settings = getSdk().settings;
|
||||||
[settings setExtraParameterForKey: stringKey value: NSSTRING(value)];
|
[settings setExtraParameterForKey: stringKey value: stringValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
int * _MaxGetSafeAreaInsets()
|
int * _MaxGetSafeAreaInsets()
|
||||||
@@ -1114,7 +1040,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxShowCmpForExistingUser");
|
max_unity_log_uninitialized_access_error("_MaxShowCmpForExistingUser");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1125,7 +1051,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if ( !_initializeSdkCalled )
|
if ( !_initializeSdkCalled )
|
||||||
{
|
{
|
||||||
logUninitializedAccessError("_MaxHasSupportedCmp");
|
max_unity_log_uninitialized_access_error("_MaxHasSupportedCmp");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1137,9 +1063,18 @@ extern "C"
|
|||||||
return [MAUnityAdManager adaptiveBannerHeightForWidth: width];
|
return [MAUnityAdManager adaptiveBannerHeightForWidth: width];
|
||||||
}
|
}
|
||||||
|
|
||||||
void logUninitializedAccessError(const char *callingMethod)
|
void max_unity_log_uninitialized_access_error(const char *callingMethod)
|
||||||
{
|
{
|
||||||
NSLog(@"[%@] Failed to execute: %s - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG, callingMethod);
|
NSString *message = [NSString stringWithFormat:@"Failed to execute: %s - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", callingMethod];
|
||||||
|
max_unity_log_error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void max_unity_log_error(NSString *message)
|
||||||
|
{
|
||||||
|
if (_disableAllLogs) return;
|
||||||
|
|
||||||
|
NSString *logMessage = [NSString stringWithFormat: @"[%@] %@", TAG, message];
|
||||||
|
NSLog(@"%@", logMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
sdk-intergration/Assets/MaxSdk/CHANGELOG.md
Normal file
3
sdk-intergration/Assets/MaxSdk/CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# AppLovin MAX Unity Plugin
|
||||||
|
|
||||||
|
To get the latest changes, see the [AppLovin MAX Unity Changelog](https://support.axon.ai/en/max/unity/changelog).
|
||||||
10
sdk-intergration/Assets/MaxSdk/CHANGELOG.md.meta
Normal file
10
sdk-intergration/Assets/MaxSdk/CHANGELOG.md.meta
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dfb944c2e1cb479cabf023040a5942d2
|
||||||
|
labels:
|
||||||
|
- al_max
|
||||||
|
- al_max_export_path-MaxSdk/CHANGELOG.md
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<androidPackages>
|
<androidPackages>
|
||||||
<androidPackage spec="com.applovin.mediation:fyber-adapter:8.3.5.0"/>
|
<androidPackage spec="com.applovin.mediation:fyber-adapter:8.4.2.0"/>
|
||||||
</androidPackages>
|
</androidPackages>
|
||||||
<iosPods>
|
<iosPods>
|
||||||
<iosPod name="AppLovinMediationFyberAdapter" version="8.3.4.0"/>
|
<iosPod name="AppLovinMediationFyberAdapter" version="8.4.3.0"/>
|
||||||
</iosPods>
|
</iosPods>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -14,23 +14,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
qualityServiceEnabled: 1
|
qualityServiceEnabled: 1
|
||||||
sdkKey: rW51GKWqpT99uzHaOQH36OihVd51teKXIfDdTnAzXH70rsTUMSQuyMb7SqmEZzq2qN4B1sFZZPPdlHTOhxQPIC
|
sdkKey: rW51GKWqpT99uzHaOQH36OihVd51teKXIfDdTnAzXH70rsTUMSQuyMb7SqmEZzq2qN4B1sFZZPPdlHTOhxQPIC
|
||||||
setAttributionReportEndpoint: 0
|
|
||||||
addApsSkAdNetworkIds: 0
|
|
||||||
customGradleVersionUrl:
|
customGradleVersionUrl:
|
||||||
customGradleToolsVersion:
|
customGradleToolsVersion:
|
||||||
consentFlowEnabled: 0
|
|
||||||
consentFlowPlatform: 0
|
|
||||||
consentFlowPrivacyPolicyUrl:
|
|
||||||
consentFlowTermsOfServiceUrl:
|
|
||||||
userTrackingUsageDescriptionEn:
|
|
||||||
userTrackingUsageLocalizationEnabled: 0
|
|
||||||
userTrackingUsageDescriptionDe:
|
|
||||||
userTrackingUsageDescriptionEs:
|
|
||||||
userTrackingUsageDescriptionFr:
|
|
||||||
userTrackingUsageDescriptionJa:
|
|
||||||
userTrackingUsageDescriptionKo:
|
|
||||||
userTrackingUsageDescriptionZhHans:
|
|
||||||
userTrackingUsageDescriptionZhHant:
|
|
||||||
adMobAndroidAppId: ca-app-pub-1541656156622049~4671899521
|
adMobAndroidAppId: ca-app-pub-1541656156622049~4671899521
|
||||||
adMobIosAppId: ca-app-pub-1541656156622049~9934477255
|
adMobIosAppId: ca-app-pub-1541656156622049~9934477255
|
||||||
showInternalSettingsInIntegrationManager: 0
|
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 572fee4574afa4f6dbf2846e0c152fe8
|
|
||||||
labels:
|
|
||||||
- al_max
|
|
||||||
- al_max_export_path-MaxSdk/Resources/Images/alert_icon.png
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 10
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: -1
|
|
||||||
aniso: -1
|
|
||||||
mipBias: -100
|
|
||||||
wrapU: -1
|
|
||||||
wrapV: -1
|
|
||||||
wrapW: -1
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 0
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,94 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 76946689084c54119a0ee1f5e60ca947
|
||||||
|
labels:
|
||||||
|
- al_max
|
||||||
|
- al_max_export_path-MaxSdk/Resources/Images/error_icon.png
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 10
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
sdk-intergration/Assets/MaxSdk/Resources/Images/info_icon.png
Normal file
BIN
sdk-intergration/Assets/MaxSdk/Resources/Images/info_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 576 B |
@@ -0,0 +1,95 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 036a0d1eebcb7467ba676e6cb67c7872
|
||||||
|
labels:
|
||||||
|
- al_max
|
||||||
|
- al_max_export_path-MaxSdk/Resources/Images/info_icon.png
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user