fix:1、接入外部sdk

This commit is contained in:
2026-05-20 14:29:11 +08:00
parent aca0e4d1af
commit d8b41f25ba
890 changed files with 45707 additions and 1095 deletions
@@ -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:
@@ -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:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 96a328019e42349aabc478b546b8605e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 682114f7790724ab3b9410e89bbc076c
folderAsset: yes
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: 1
settings:
DefaultValueInitialized: true
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>20G417</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>AppsFlyerBundle</string>
<key>CFBundleIdentifier</key>
<string>com.appsflyer.support.two.AppsFlyerBundle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AppsFlyerBundle</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13A1030d</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>12.0</string>
<key>DTSDKBuild</key>
<string>21A344</string>
<key>DTSDKName</key>
<string>macosx12.0</string>
<key>DTXcode</key>
<string>1310</string>
<key>DTXcodeBuild</key>
<string>13A1030d</string>
<key>LSMinimumSystemVersion</key>
<string>11.6</string>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -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;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a1435104a69d4c8ebcc6f237cc29a54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1f19f272c71674582bed1d93925da003
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,33 @@
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.
@@ -0,0 +1,33 @@
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:
@@ -0,0 +1,33 @@
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:
@@ -0,0 +1,33 @@
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:
@@ -0,0 +1,24 @@
{
"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
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1f155a0e4c9ab48eeb4b54b2dc0aeba7
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,810 @@
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
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b1a24aa01166451d804d7c03c14a3db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: