fix:1、删除max广告。2、更换sdk
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7863556d88b814e09ba9cfc75a91d655
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
+11
@@ -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);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c60f499ae0d048b1be8ffd6878a184c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
+48
@@ -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>
|
||||
BIN
Binary file not shown.
+115
@@ -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:
|
||||
@@ -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:
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+33
@@ -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:
|
||||
BIN
Binary file not shown.
Vendored
+33
@@ -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:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 429c3c4b79918684894c368157dad34a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd0ef81b1482347b38905fab4f30e583
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "BigoAds"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a16a603f2fee3094a83a14116e2d8129
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 467aa0b9eadf04b22b5b3713a1b07bea
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd438e36fdc745aaa018eac5d3b182c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoAdConfig
|
||||
{
|
||||
public const string EXTRA_KEY_HOST_RULES = "host_rules";
|
||||
|
||||
/// <summary>
|
||||
/// the unique identifier of the App
|
||||
/// </summary>
|
||||
internal string AppId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom set the debugLog to print debug Log.
|
||||
/// debugLog NO: close debug log, YES: open debug log.
|
||||
/// </summary>
|
||||
internal bool DebugLog { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Channels for publishing media applications
|
||||
/// </summary>
|
||||
internal string Channel { get; }
|
||||
|
||||
internal int Age { get; }
|
||||
|
||||
internal int Gender { get; }
|
||||
|
||||
internal long ActivatedTime { get; }
|
||||
|
||||
internal Dictionary<string, string> ExtraDictionary { get; }
|
||||
|
||||
private BigoAdConfig(BigoAdConfig.Builder builder)
|
||||
{
|
||||
AppId = builder.AppId;
|
||||
DebugLog = builder.DebugLog;
|
||||
Channel = builder.Channel;
|
||||
Age = builder.Age;
|
||||
Gender = (int)builder.Gender;
|
||||
ActivatedTime = builder.ActivatedTime;
|
||||
ExtraDictionary = builder.ExtraDictionary;
|
||||
}
|
||||
|
||||
public class Builder
|
||||
{
|
||||
internal string AppId;
|
||||
|
||||
internal bool DebugLog;
|
||||
|
||||
internal string Channel;
|
||||
|
||||
internal int Age;
|
||||
|
||||
internal BGAdGender Gender;
|
||||
|
||||
internal long ActivatedTime;
|
||||
|
||||
internal Dictionary<string, string> ExtraDictionary = new Dictionary<string, string>();
|
||||
|
||||
public Builder SetAppId(string appid)
|
||||
{
|
||||
this.AppId = appid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder SetDebugLog(bool debugLog)
|
||||
{
|
||||
this.DebugLog = debugLog;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder SetChannel(string channel)
|
||||
{
|
||||
this.Channel = channel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder SetAge(int age)
|
||||
{
|
||||
this.Age = age;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder SetGender(BGAdGender gender)
|
||||
{
|
||||
this.Gender = gender;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder SetActivatedTime(long activatedTime)
|
||||
{
|
||||
this.ActivatedTime = activatedTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
///Only works on Android
|
||||
public Builder SetExtra(string key, string extra)
|
||||
{
|
||||
if (key != null && extra != null)
|
||||
{
|
||||
this.ExtraDictionary.Add(key, extra);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigoAdConfig Build()
|
||||
{
|
||||
return new BigoAdConfig(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18497a84c58a49f385b63be54aff0cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
using BigoAds.Scripts.Common;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public static class BigoAdSdk
|
||||
{
|
||||
private static IClientFactory _clientFactory;
|
||||
|
||||
private static ISDK _sdk;
|
||||
|
||||
internal static ISDK SDK
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sdk == null)
|
||||
{
|
||||
_sdk = GetClientFactory().BuildSDKClient();
|
||||
}
|
||||
|
||||
return _sdk;
|
||||
}
|
||||
}
|
||||
|
||||
internal static IClientFactory GetClientFactory()
|
||||
{
|
||||
if (_clientFactory != null)
|
||||
{
|
||||
return _clientFactory;
|
||||
}
|
||||
|
||||
_clientFactory =
|
||||
#if UNITY_ANDROID
|
||||
new BigoAds.Scripts.Platforms.Android.AndroidClientFactory();
|
||||
#elif UNITY_IOS
|
||||
new BigoAds.Scripts.Platforms.iOS.IOSClientFactory();
|
||||
#else
|
||||
null;
|
||||
throw new PlatformNotSupportedException();
|
||||
#endif
|
||||
return _clientFactory;
|
||||
}
|
||||
|
||||
public delegate void InitResultDelegate();
|
||||
|
||||
public static event InitResultDelegate OnInitFinish;
|
||||
|
||||
/// Starts the Bigo SDK
|
||||
/// @warning Call this method as early as possible to reduce ad request fail.
|
||||
/// @param config SDK configuration
|
||||
/// @param callback Callback for starting the Bigo SDK
|
||||
/// ////
|
||||
public static void Initialize(BigoAdConfig config)
|
||||
{
|
||||
if (IsInitSuccess())
|
||||
{
|
||||
OnInitFinish?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
SDK.Init(config, (() => { OnInitFinish?.Invoke(); }));
|
||||
}
|
||||
|
||||
////
|
||||
/// The SDK initialization state
|
||||
////
|
||||
public static bool IsInitSuccess()
|
||||
{
|
||||
return SDK.IsInitSuccess();
|
||||
}
|
||||
|
||||
///////
|
||||
/// Bigo SDK version
|
||||
/// ////
|
||||
public static string GetSDKVersion()
|
||||
{
|
||||
return SDK.GetSDKVersion();
|
||||
}
|
||||
|
||||
///////
|
||||
/// Bigo SDK version name
|
||||
/// ////
|
||||
public static string GetSDKVersionName()
|
||||
{
|
||||
return SDK.GetSDKVersionName();
|
||||
}
|
||||
|
||||
///////
|
||||
/// Bigo SDK set user consent
|
||||
/// ////
|
||||
public static void SetUserConsent(ConsentOptions option, bool consent)
|
||||
{
|
||||
SDK.SetUserConsent(option, consent);
|
||||
}
|
||||
|
||||
///////
|
||||
/// Only works on Android
|
||||
/// Bigo SDK set user consent
|
||||
/// ////
|
||||
public static void AddExtraHost(string country, string host)
|
||||
{
|
||||
SDK.AddExtraHost(country, host);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5ad9c8c265954d4e8f4f03312b5fa42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
using BigoAds.Scripts.Common;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoBannerAd : BigoBaseAd<BigoBannerRequest>
|
||||
{
|
||||
private readonly IBannerAd _bannerAdClient;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// create a banner ad
|
||||
/// </summary>
|
||||
/// <param name="slotId"></param>
|
||||
public BigoBannerAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildBannerAdClient())
|
||||
{
|
||||
_bannerAdClient = (IBannerAd) ADClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set position for banner
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
public void SetPosition(BigoPosition position)
|
||||
{
|
||||
_bannerAdClient?.SetPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5136d466cbb6c461f92fbd90b6fa157d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
public class BigoBannerRequest : BigoRequest
|
||||
{
|
||||
[SerializeField()]
|
||||
private BigoBannerSize size;
|
||||
public BigoBannerSize Size => size;
|
||||
|
||||
public BigoPosition Position { get; }
|
||||
|
||||
public BigoBannerRequest(BigoBannerSize size, BigoPosition position = BigoPosition.Bottom)
|
||||
{
|
||||
this.size = size;
|
||||
this.Position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 159c6164853954739adbca1ae7592df7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using BigoAds.Scripts.Common;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoInterstitialAd : BigoBaseAd<BigoInterstitialRequest>
|
||||
{
|
||||
public BigoInterstitialAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildInterstitialAdClient())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1323eae1e03094d8281b23f5527a53db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
|
||||
public class BigoInterstitialRequest : BigoRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1947fd630823b4858af6c3a471497f70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
using BigoAds.Scripts.Common;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoNativeAd : BigoBaseAd<BigoNativeRequest>
|
||||
{
|
||||
private readonly INativeAd _NativeAdClient;
|
||||
|
||||
public BigoNativeAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildNativeAdClient())
|
||||
{
|
||||
_NativeAdClient = (INativeAd) ADClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set position for native
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
public void SetPosition(BigoPosition position)
|
||||
{
|
||||
_NativeAdClient?.SetPosition(position);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1742d1ee2ff5e4d508ae81524cb94ade
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
public class BigoNativeRequest : BigoRequest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 033c30386f5714bddb5dd41d7524979e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using BigoAds.Scripts.Common;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoPopupAd : BigoBaseAd<BigoPopupRequest>
|
||||
{
|
||||
public BigoPopupAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildPopupAdClient())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2be0a8fe9e5aa4bea8970a47e617a076
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
|
||||
public class BigoPopupRequest : BigoRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 580aad20fbde543bab37a5e878c682cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
public class BigoRequest
|
||||
{
|
||||
[SerializeField] private string extraInfo;
|
||||
[SerializeField] private int age;
|
||||
[SerializeField] private BGAdGender gender;
|
||||
[SerializeField] private long activatedTime;
|
||||
|
||||
public string ExtraInfoJson
|
||||
{
|
||||
get => extraInfo;
|
||||
set => extraInfo = value;
|
||||
}
|
||||
|
||||
/// Only works on Android
|
||||
public int Age
|
||||
{
|
||||
get => age;
|
||||
set => age = value;
|
||||
}
|
||||
|
||||
/// Only works on Android
|
||||
public BGAdGender Gender
|
||||
{
|
||||
get => gender;
|
||||
set => gender = value;
|
||||
}
|
||||
|
||||
/// Only works on Android
|
||||
public long ActivatedTime
|
||||
{
|
||||
get => activatedTime;
|
||||
set => activatedTime = value;
|
||||
}
|
||||
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonUtility.ToJson(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2707ffe474e6443d6a5260876d5b1370
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using BigoAds.Scripts.Common;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoRewardedAd : BigoBaseAd<BigoRewardedRequest>
|
||||
{
|
||||
public event Action OnUserEarnedReward;
|
||||
|
||||
public BigoRewardedAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildRewardedAdClient())
|
||||
{
|
||||
var rewardedAdClient = (IRewardedAd) ADClient;
|
||||
rewardedAdClient.OnUserEarnedReward += InvokeOnUserEarnedReward;
|
||||
}
|
||||
|
||||
|
||||
private void InvokeOnUserEarnedReward()
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnUserEarnedReward?.Invoke(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnUserEarnedReward?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f745c8797b25430685a5a08b34f0d9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
|
||||
public class BigoRewardedRequest : BigoRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38f4a763a1fc9429ca87c62eed4b4645
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using BigoAds.Scripts.Common;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
public class BigoSplashAd : BigoBaseAd<BigoSplashRequest>
|
||||
{
|
||||
public BigoSplashAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildSplashAdClient())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61b62ca232d2e42788e61f33d7784209
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api
|
||||
{
|
||||
[Serializable]
|
||||
|
||||
public class BigoSplashRequest : BigoRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afdf808922a744419b5db1fdd4ca18b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0762cd7e46c3c43e5a32b1558643eb74
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
namespace BigoAds.Scripts.Api.Constant
|
||||
{
|
||||
[Serializable]
|
||||
public enum BGAdGender
|
||||
{
|
||||
Female = 1,
|
||||
Male = 2
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2784802c5b5b34470a0500118ccb7f55
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api.Constant
|
||||
{
|
||||
[Serializable]
|
||||
public enum BGAdLossReason
|
||||
{
|
||||
InternalError = 1,
|
||||
Timeout = 2,
|
||||
LowerThanFloorPrice = 100,
|
||||
LowerThanHighestPrice = 101
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 303b2e25e09c44797a167b642310a319
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BigoAds.Scripts.Api.Constant
|
||||
{
|
||||
[Serializable]
|
||||
public struct BigoBannerSize
|
||||
{
|
||||
public static readonly BigoBannerSize BANNER_W_320_H_50 = new BigoBannerSize(320,50);
|
||||
public static readonly BigoBannerSize BANNER_W_300_H_250 = new BigoBannerSize(300,250);
|
||||
|
||||
[SerializeField] private int width;
|
||||
[SerializeField] private int height;
|
||||
public int Width => width;
|
||||
public int Height => height;
|
||||
|
||||
public BigoBannerSize(int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a4411a50cfc94717b30325ceed3d52f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api.Constant
|
||||
{
|
||||
[Serializable]
|
||||
public enum BigoPosition
|
||||
{
|
||||
Top = 0,
|
||||
Middle = 1,
|
||||
Bottom = 2
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6511065ffc7f44235bacb3ee16a87f5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace BigoAds.Scripts.Api.Constant
|
||||
{
|
||||
[Serializable]
|
||||
public enum ConsentOptions
|
||||
{
|
||||
GDPR,
|
||||
CCPA,
|
||||
LGPD,
|
||||
COPPA
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7867ac15c426649a6aa633a772d54879
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b4db2c2875384f11b89eb7dec28b823
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
using System;
|
||||
using BigoAds.Scripts.Api;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public class BigoBaseAd<T> where T : BigoRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// event for load ad success
|
||||
/// </summary>
|
||||
public event Action OnLoad;
|
||||
|
||||
/// <summary>
|
||||
/// load ad failed with error code and error message
|
||||
/// </summary>
|
||||
public event Action<int, string> OnLoadFailed;
|
||||
|
||||
/// <summary>
|
||||
/// event for ad impression
|
||||
/// </summary>
|
||||
public event Action OnAdShowed;
|
||||
|
||||
/// <summary>
|
||||
/// event for ad be clicked
|
||||
/// </summary>
|
||||
public event Action OnAdClicked;
|
||||
|
||||
/// <summary>
|
||||
/// event for ad be closed
|
||||
/// </summary>
|
||||
public event Action OnAdDismissed;
|
||||
|
||||
/// <summary>
|
||||
/// event for ad error
|
||||
/// </summary>
|
||||
public event Action<int, string> OnAdError;
|
||||
|
||||
private readonly string _slotId;
|
||||
|
||||
private bool _isAdLoaded;
|
||||
|
||||
protected readonly IBigoAd<T> ADClient;
|
||||
|
||||
public bool CallbackOnMainThread { get; set; } = true;
|
||||
|
||||
private BigoAdBid _bid;
|
||||
|
||||
protected BigoBaseAd(string id, IBigoAd<T> adClient)
|
||||
{
|
||||
_slotId = id;
|
||||
ADClient = adClient;
|
||||
InitEvent(ADClient);
|
||||
}
|
||||
|
||||
private void InitEvent(IBigoAd<T> adClient)
|
||||
{
|
||||
adClient.OnLoad += InvokeOnLoad;
|
||||
adClient.OnLoadFailed += InvokeOnLoadFailed;
|
||||
|
||||
adClient.OnAdShowed += InvokeOnAdShowed;
|
||||
adClient.OnAdClicked += InvokeOnAdClicked;
|
||||
adClient.OnAdDismissed += InvokeOnAdDismissed;
|
||||
adClient.OnAdError += InvokeOnAdError;
|
||||
}
|
||||
|
||||
public void Load(T request)
|
||||
{
|
||||
if (_isAdLoaded)
|
||||
{
|
||||
InvokeOnLoad();
|
||||
}
|
||||
if (string.IsNullOrEmpty(_slotId))
|
||||
{
|
||||
InvokeOnLoadFailed(-1, "slotId must be not null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!BigoAdSdk.IsInitSuccess())
|
||||
{
|
||||
InvokeOnLoadFailed(-1, "sdk has not init");
|
||||
return;
|
||||
}
|
||||
ADClient?.Load(_slotId, request);
|
||||
}
|
||||
|
||||
public virtual void Show()
|
||||
{
|
||||
_isAdLoaded = false;
|
||||
ADClient?.Show();
|
||||
}
|
||||
|
||||
public void DestroyAd()
|
||||
{
|
||||
ADClient?.Destroy();
|
||||
}
|
||||
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return _isAdLoaded;
|
||||
}
|
||||
|
||||
public bool IsExpired()
|
||||
{
|
||||
return ADClient == null ? false : ADClient.IsExpired();
|
||||
}
|
||||
|
||||
public string GetExtraInfo(String key)
|
||||
{
|
||||
return ADClient == null ? "" : ADClient.GetExtraInfo(key);
|
||||
}
|
||||
|
||||
private void InvokeOnLoad()
|
||||
{
|
||||
OnLoad?.Invoke();
|
||||
_isAdLoaded = true;
|
||||
}
|
||||
|
||||
protected void InvokeOnLoadFailed(int errorCode, string errorMessage)
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnLoadFailed?.Invoke(errorCode, errorMessage); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnLoadFailed?.Invoke(errorCode, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void InvokeOnAdShowed()
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnAdShowed?.Invoke(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnAdShowed?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeOnAdClicked()
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnAdClicked?.Invoke(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnAdClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeOnAdDismissed()
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnAdDismissed?.Invoke(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnAdDismissed?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeOnAdError(int errorCode, string errorMessage)
|
||||
{
|
||||
if (CallbackOnMainThread)
|
||||
{
|
||||
BigoDispatcher.PostTask((() => { OnAdError?.Invoke(errorCode, errorMessage); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnAdError?.Invoke(errorCode, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public BigoAdBid GetBid()
|
||||
{
|
||||
if (ADClient == null) return null;
|
||||
if (!ADClient.IsClientBidding()) return null;
|
||||
if (_bid == null)
|
||||
{
|
||||
_bid = new BigoAdBid(ADClient);
|
||||
}
|
||||
return _bid;
|
||||
}
|
||||
|
||||
public class BigoAdBid : IClientBidding
|
||||
{
|
||||
protected readonly IBigoAd<T> _ADClient;
|
||||
|
||||
public BigoAdBid(IBigoAd<T> ADClient)
|
||||
{
|
||||
_ADClient = ADClient;
|
||||
}
|
||||
/// get price
|
||||
public double getPrice()
|
||||
{
|
||||
return _ADClient == null ? 0 : _ADClient.getPrice();
|
||||
}
|
||||
|
||||
///notify win
|
||||
public void notifyWin(double secPrice, string secBidder)
|
||||
{
|
||||
_ADClient?.notifyWin(secPrice, secBidder);
|
||||
}
|
||||
|
||||
///notify loss
|
||||
public void notifyLoss(double firstPrice, string firstBidder, BGAdLossReason lossReason)
|
||||
{
|
||||
_ADClient?.notifyLoss(firstPrice, firstBidder, lossReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8554386bfcec3403cb6fab89c7a35f31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// The unity thread dispatcher.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
internal sealed class BigoDispatcher : MonoBehaviour
|
||||
{
|
||||
private static bool _instanceCreated;
|
||||
|
||||
// The thread safe task queue.
|
||||
private static readonly List<Action> PostTasks = new List<Action>();
|
||||
|
||||
// The executing buffer.
|
||||
private static readonly List<Action> Executing = new List<Action>();
|
||||
|
||||
static BigoDispatcher()
|
||||
{
|
||||
CreateInstance();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Work thread post a task to the main thread.
|
||||
/// </summary>
|
||||
public static void PostTask(Action task)
|
||||
{
|
||||
lock (PostTasks)
|
||||
{
|
||||
PostTasks.Add(task);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start to run this dispatcher.
|
||||
/// </summary>
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void CreateInstance()
|
||||
{
|
||||
if (_instanceCreated || !Application.isPlaying) return;
|
||||
var go = new GameObject(
|
||||
"BigoDispatcher", typeof(BigoDispatcher));
|
||||
DontDestroyOnLoad(go);
|
||||
_instanceCreated = true;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
lock (PostTasks)
|
||||
{
|
||||
PostTasks.Clear();
|
||||
}
|
||||
|
||||
Executing.Clear();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
lock (PostTasks)
|
||||
{
|
||||
if (PostTasks.Count > 0)
|
||||
{
|
||||
Executing.AddRange(PostTasks);
|
||||
PostTasks.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var task in Executing)
|
||||
{
|
||||
try
|
||||
{
|
||||
task();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e.Message, this);
|
||||
}
|
||||
}
|
||||
|
||||
Executing.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d1af23e5ee93476382ea747bb4b6985
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IBannerAd : IBigoAd<BigoBannerRequest>
|
||||
{
|
||||
void SetPosition(BigoPosition position);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9632da3a0b8674b539385af7fec47c33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using BigoAds.Scripts.Api;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IBigoAd<in T> : IClientBidding where T : BigoRequest
|
||||
{
|
||||
event Action OnLoad;
|
||||
event Action<int, string> OnLoadFailed;
|
||||
event Action OnAdShowed;
|
||||
event Action OnAdClicked;
|
||||
event Action OnAdDismissed;
|
||||
event Action<int, string> OnAdError;
|
||||
void Load(string slotId, T request);
|
||||
bool IsLoaded();
|
||||
bool IsExpired();
|
||||
void Show();
|
||||
void Destroy();
|
||||
bool IsClientBidding();
|
||||
string GetExtraInfo(String key);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac3c835ae5b8f421192fb72d32c9c6c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IClientBidding
|
||||
{
|
||||
/// get price
|
||||
double getPrice();
|
||||
|
||||
///notify win
|
||||
void notifyWin(double secPrice, string secBidder);
|
||||
|
||||
///notify loss
|
||||
void notifyLoss(double firstPrice, string firstBidder, BGAdLossReason lossReason);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be474d5a8f44740eeac370fd98153d15
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IClientFactory
|
||||
{
|
||||
ISDK BuildSDKClient();
|
||||
IBannerAd BuildBannerAdClient();
|
||||
INativeAd BuildNativeAdClient();
|
||||
IInterstitialAd BuildInterstitialAdClient();
|
||||
IPopupAd BuildPopupAdClient();
|
||||
ISplashAd BuildSplashAdClient();
|
||||
IRewardedAd BuildRewardedAdClient();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2cb5f6ac1b7f463db75ac0bfa7d7fbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IInterstitialAd : IBigoAd<BigoInterstitialRequest>
|
||||
{
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d31ee1df8a074b81a5575e9a7735b2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface INativeAd : IBigoAd<BigoNativeRequest>
|
||||
{
|
||||
void SetPosition(BigoPosition position);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eef5c6b4f590c4ceaac635a2992576ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IPopupAd : IBigoAd<BigoPopupRequest>
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e767b9004c4f4ca19baa6f54c409c5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using BigoAds.Scripts.Api;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface IRewardedAd : IBigoAd<BigoRewardedRequest>
|
||||
{
|
||||
event Action OnUserEarnedReward;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b3baa8d362724d19997664f34f4320d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface ISDK
|
||||
{
|
||||
///
|
||||
/// Starts the Bigo SDK
|
||||
///
|
||||
void Init(BigoAdConfig config, BigoAdSdk.InitResultDelegate initResultDelegate);
|
||||
|
||||
////
|
||||
/// The SDK initialization state
|
||||
////
|
||||
bool IsInitSuccess();
|
||||
|
||||
///////
|
||||
/// Bigo SDK version
|
||||
/// ////
|
||||
string GetSDKVersion();
|
||||
|
||||
|
||||
///////
|
||||
/// Bigo SDK version name
|
||||
/// ////
|
||||
string GetSDKVersionName();
|
||||
|
||||
///////
|
||||
/// Bigo SDK set user consent
|
||||
/// ////
|
||||
void SetUserConsent(ConsentOptions option, bool consent);
|
||||
|
||||
///////
|
||||
/// Only works on Android
|
||||
/// Bigo SDK set user consent
|
||||
/// ////
|
||||
void AddExtraHost(string country, string host);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00ad18b48fa1047ee98bd415dd127f65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
using BigoAds.Scripts.Api;
|
||||
|
||||
namespace BigoAds.Scripts.Common
|
||||
{
|
||||
public interface ISplashAd:IBigoAd<BigoSplashRequest>
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1105e67678354e71850311744a989c3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f730f3e43d10941928ac676ed88c7ee4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e595ff25130d84811aae9bbe30751d78
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
using UnityEngine;
|
||||
using BigoAds.Scripts.Api;
|
||||
using BigoAds.Scripts.Common;
|
||||
using BigoAds.Scripts.Api.Constant;
|
||||
|
||||
public class AdHelper
|
||||
{
|
||||
public static void ShowBannerAd(AndroidJavaObject bannerAd)
|
||||
{
|
||||
ShowBannerAd(bannerAd, BigoPosition.Bottom);
|
||||
}
|
||||
|
||||
public static void ShowBannerAd(AndroidJavaObject bannerAd, BigoPosition position)
|
||||
{
|
||||
if (bannerAd == null) return;
|
||||
var adView = bannerAd.Call<AndroidJavaObject>("adView");
|
||||
SetViewPosition(adView, position);
|
||||
}
|
||||
|
||||
public static void ShowNativeAd(AndroidJavaObject nativeAd)
|
||||
{
|
||||
ShowNativeAd(nativeAd, BigoPosition.Bottom);
|
||||
}
|
||||
|
||||
public static void RemoveAdView()
|
||||
{
|
||||
var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
new AndroidJavaClass("sg.bigo.ads.AdHelper").CallStatic("removeAdView", activity);
|
||||
}
|
||||
|
||||
public static void ShowNativeAd(AndroidJavaObject nativeAd, BigoPosition position)
|
||||
{
|
||||
if (nativeAd == null) return;
|
||||
var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
var adView = new AndroidJavaClass("sg.bigo.ads.AdHelper").CallStatic<AndroidJavaObject>("renderNativeAdView", activity, nativeAd, "layout_bigo_native_ad");
|
||||
SetViewPosition(adView, position);
|
||||
}
|
||||
|
||||
public static void SetViewPosition(AndroidJavaObject adView, BigoPosition position)
|
||||
{
|
||||
var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
int positionInt;
|
||||
switch (position)
|
||||
{
|
||||
case BigoPosition.Top:
|
||||
positionInt = 48;
|
||||
break;
|
||||
case BigoPosition.Middle:
|
||||
positionInt = 16;
|
||||
break;
|
||||
case BigoPosition.Bottom:
|
||||
default:
|
||||
positionInt = 80;
|
||||
break;
|
||||
}
|
||||
new AndroidJavaClass("sg.bigo.ads.AdHelper").CallStatic("addAdView", activity, adView, positionInt);
|
||||
}
|
||||
|
||||
|
||||
public abstract class Task : AndroidJavaProxy
|
||||
{
|
||||
public Task() : base("java.lang.Runnable")
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void run();
|
||||
}
|
||||
|
||||
public static void DestroyAd(AndroidJavaObject ad)
|
||||
{
|
||||
if (ad != null) {
|
||||
PostToAndroidMainThread(new DestryAdTask(ad));
|
||||
}
|
||||
}
|
||||
|
||||
private class DestryAdTask : Task
|
||||
{
|
||||
public AndroidJavaObject Ad;
|
||||
|
||||
public DestryAdTask(AndroidJavaObject ad)
|
||||
{
|
||||
this.Ad = ad;
|
||||
}
|
||||
|
||||
public override void run()
|
||||
{
|
||||
Ad.Call("destroy");
|
||||
AdHelper.RemoveAdView();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostToAndroidMainThread(Task task)
|
||||
{
|
||||
new AndroidJavaClass("sg.bigo.ads.AdHelper").CallStatic("postToAndroidMainThread", task);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user