[M] deep link
This commit is contained in:
78
sdk-intergration/Assets/Scripts/AFInit.cs
Normal file
78
sdk-intergration/Assets/Scripts/AFInit.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System.Text;
|
||||
using AppsFlyerSDK;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AFInit
|
||||
{
|
||||
public Text text {get; set;}
|
||||
|
||||
[Btn("Clear")]
|
||||
public void Clear()
|
||||
{
|
||||
text.text = "";
|
||||
}
|
||||
|
||||
[Btn("Init AF")]
|
||||
public void InitAF()
|
||||
{
|
||||
AFDeepLinkHelper.Instance.Init();
|
||||
text.text = $"Init AF {AppsFlyer.CallBackObjectName}\n";
|
||||
}
|
||||
|
||||
[Btn("Gen Url")]
|
||||
public async void GenInviteUrl()
|
||||
{
|
||||
var url = await AFDeepLinkHelper.Instance.GenInviteLink("Mustapha", "123456");
|
||||
if(url != null)
|
||||
{
|
||||
Debug.Log($"[AFInit::GenInviteUrl] {url}");
|
||||
text.text = $"{url}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = $"Error\n";
|
||||
}
|
||||
}
|
||||
|
||||
[Btn("DeepLinkData")]
|
||||
public void DeepLinkData()
|
||||
{
|
||||
if(AFDeepLinkHelper.Instance.DidReceivedDeepLink)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append($"DeepLinkData \n");
|
||||
foreach(var item in AFDeepLinkHelper.Instance.DeepLinkParamsDictionary)
|
||||
{
|
||||
sb.Append($"{item.Key} : {item.Value}\n");
|
||||
sb.AppendLine();
|
||||
}
|
||||
var data = sb.ToString();
|
||||
text.text = data;
|
||||
Debug.Log($"[AFInit::DeepLinkData]\r\n{data}");
|
||||
}
|
||||
else
|
||||
text.text = $"No DL\n";
|
||||
}
|
||||
|
||||
[Btn("Referrer")]
|
||||
public void Referer()
|
||||
{
|
||||
if(AFDeepLinkHelper.Instance.GetDLReferer(out string pid, out string uid))
|
||||
{
|
||||
text.text = $"Referrer pid:{pid} uid:{uid}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = $"No Referrer\n";
|
||||
}
|
||||
}
|
||||
|
||||
[Btn("SDK Test")]
|
||||
public void SDKTest()
|
||||
{
|
||||
SceneManager.LoadScene("SampleScene");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user