[U] ad plugins
This commit is contained in:
@@ -62,13 +62,20 @@ public class AFDeepLinkHelper : MonoBehaviour, IAppsFlyerConversionData, IAppsFl
|
||||
}
|
||||
}
|
||||
|
||||
public void Init()
|
||||
public void Init(string afkey, string afAppID, string customerUserID, string oneLinkID, bool debugMode = false)
|
||||
{
|
||||
AppsFlyer.setIsDebug(true);
|
||||
AppsFlyer.setAppInviteOneLinkID("jT1Q");
|
||||
AppsFlyer.initSDK("rSySeWtvKabfbPZE7Lmx7C", "6505145935", this);
|
||||
AppsFlyer.setIsDebug(debugMode);
|
||||
AppsFlyer.setAppInviteOneLinkID(oneLinkID);
|
||||
AppsFlyer.initSDK(afkey, afAppID, this);
|
||||
AppsFlyer.setCustomerUserId(customerUserID);
|
||||
AppsFlyer.OnDeepLinkReceived += OnDeepLink;
|
||||
|
||||
#if UNITY_IOS
|
||||
AppsFlyerSDK.AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(30);
|
||||
#endif
|
||||
|
||||
AppsFlyer.startSDK();
|
||||
AppsFlyerSDK.AppsFlyerAdRevenue.start();
|
||||
}
|
||||
|
||||
public async Task<string> GenInviteLink(string referrerUID, string referrerPID)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using AppsFlyerSDK;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
@@ -14,11 +13,8 @@ public class AFInit
|
||||
text.text = "";
|
||||
}
|
||||
|
||||
[Btn("Init AF")]
|
||||
public void InitAF()
|
||||
{
|
||||
AFDeepLinkHelper.Instance.Init();
|
||||
text.text = $"Init AF {AppsFlyer.CallBackObjectName}\n";
|
||||
}
|
||||
|
||||
[Btn("Gen Url")]
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using AppsFlyerSDK;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class OneLinkTest : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private RootCtx ctx;
|
||||
|
||||
[SerializeField] private GameObject btnContainer;
|
||||
|
||||
[SerializeField] private GameObject btn;
|
||||
@@ -13,10 +17,26 @@ public class OneLinkTest : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
var aFInit = new AFInit();
|
||||
ctx.OnInited += OnContextInited;
|
||||
}
|
||||
|
||||
// Callback from GContex when its ready
|
||||
private void OnContextInited()
|
||||
{
|
||||
Boost();
|
||||
}
|
||||
|
||||
private async void Boost()
|
||||
{
|
||||
await Awaiters.NextFrame;
|
||||
|
||||
TaInit();
|
||||
InitAppsFlyer();
|
||||
|
||||
var aFInit = new AFInit();
|
||||
aFInit.text = message;
|
||||
// Get funcs methods witch has Btn attribute
|
||||
aFInit.text.text = $"Init AF {AppsFlyer.CallBackObjectName}\n";;
|
||||
|
||||
var methods = aFInit.GetType().GetMethods();
|
||||
foreach (var method in methods)
|
||||
{
|
||||
@@ -30,7 +50,45 @@ public class OneLinkTest : MonoBehaviour
|
||||
btnObj.GetComponent<Button>().onClick.AddListener(() => method.Invoke(aFInit, null));
|
||||
btnObj.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void TaInit()
|
||||
{
|
||||
var taAppId = GConstant.TA_APPID;
|
||||
var taUrl = GConstant.TA_URL;
|
||||
var autoTrackEventType = ThinkingData.Analytics.TDAutoTrackEventType.AppStart
|
||||
| ThinkingData.Analytics.TDAutoTrackEventType.AppEnd
|
||||
| ThinkingData.Analytics.TDAutoTrackEventType.AppInstall;
|
||||
|
||||
ThinkingData.Analytics.TDAnalytics.Init(taAppId, taUrl);
|
||||
ThinkingData.Analytics.TDAnalytics.EnableThirdPartySharing(ThinkingData.Analytics.Utils.TDThirdPartyType.APPSFLYER);
|
||||
ThinkingData.Analytics.TDAnalytics.EnableAutoTrack(autoTrackEventType);
|
||||
ThinkingData.Analytics.TDAnalytics.EnableLog(false);
|
||||
|
||||
Debug.Log("[GEvent::TaInit] ThinkingData inited");
|
||||
}
|
||||
|
||||
private static void InitAppsFlyer()
|
||||
{
|
||||
var afKey = GConstant.AF_KEY;
|
||||
var afAppID = GConstant.AF_APPID;
|
||||
var afOneLinkID = GConstant.AF_OneLinkID;
|
||||
var afCustomerUserID = ThinkingData.Analytics.TDAnalytics.GetDistinctId();
|
||||
AFDeepLinkHelper.Instance.Init(afKey,afAppID,afCustomerUserID,afOneLinkID,true);
|
||||
Debug.Log("[GEvent::InitAppsFlyer] AppsFlyer inited");
|
||||
}
|
||||
}
|
||||
|
||||
public class GConstant
|
||||
{
|
||||
public const string TA_URL = "https://ta-event.bamboogames.fun";
|
||||
public const string TA_APPID = "9876bb56ee484b528064d1db40a57ec4";
|
||||
|
||||
public const string AF_KEY = "rSySeWtvKabfbPZE7Lmx7C";
|
||||
public const string AF_APPID = "6505145935";
|
||||
public const string AF_OneLinkID = "jT1Q";
|
||||
}
|
||||
|
||||
|
||||
|
||||
23
sdk-intergration/Assets/Scripts/RootCtx.cs
Normal file
23
sdk-intergration/Assets/Scripts/RootCtx.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using asap.core;
|
||||
using System.Threading.Tasks;
|
||||
public class RootCtx : GContext
|
||||
{
|
||||
protected override async Task SetupAsync()
|
||||
{
|
||||
container.Register<IStageService, StageService>().AsSingleton();
|
||||
//container.Register<IDataService, LubanDataService>().AsSingleton();
|
||||
container.Register<IObjectSerializer, ObjectSerializer>().AsSingleton();
|
||||
container.Register<IConfig, Config>().AsSingleton();
|
||||
|
||||
await Awaiters.NextFrame;
|
||||
BetterStreamingAssets.Initialize();
|
||||
|
||||
|
||||
UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);
|
||||
|
||||
Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
||||
}
|
||||
}
|
||||
11
sdk-intergration/Assets/Scripts/RootCtx.cs.meta
Normal file
11
sdk-intergration/Assets/Scripts/RootCtx.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84cefae1a98f84abc971afcf8efcfdc1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user