[M] deep link

This commit is contained in:
2025-01-15 18:53:22 +08:00
parent 0332758335
commit 90e54158f1
13 changed files with 1348 additions and 1 deletions

View 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");
}
}