[M] sync from n3

This commit is contained in:
2024-08-22 18:04:52 +08:00
parent 1a0af9d725
commit da367097c8
8 changed files with 91 additions and 30 deletions

View File

@@ -1,5 +1,3 @@
using System;
using Newtonsoft.Json.Linq;
using UnityEngine;
namespace tysdk
@@ -38,14 +36,15 @@ namespace tysdk
GA_ABTest = 10, //abtest相关事件
}
/*
public class GAEvent : IDisposable
{
private GATrackType eventType;
private string eventName;
bool AFSend = true;
public static string ABTestValue = "0";
private JObject content = new JObject();
public static Dictionary<string, string> extraContent = new Dictionary<string, string>();
public GAEvent(GATrackType eventType, string eventName, bool AFSend = true)
{
@@ -57,8 +56,7 @@ namespace tysdk
public GAEvent AddContent(string key, string value)
{
content[key] = value;
return this;
}
return this; }
public GAEvent AddContent(string key, int value)
{
@@ -78,11 +76,40 @@ namespace tysdk
return this;
}
public GAEvent AddContent(string key, JToken value)
{
content[key] = value;
return this;
}
public void Dispose()
{
content["ABTestValue"] = ABTestValue;
TYSdkFacade.Instance.EventTrack((int)eventType, eventName, content.ToString());
foreach (var item in extraContent)
{
content[item.Key] = item.Value;
}
string msg = content.ToString();
if (msg == String.Empty) return;
if (AFSend)
{
SendAfEvent(eventType,eventName,msg);
}
TYSdkFacade.Instance.EventTrack((int)eventType, eventName, msg);
content.RemoveAll();
}
private void SendAfEvent(GATrackType type,string eventName,string logMessage)
{
Dictionary<string, string> eventValues = new Dictionary<string, string>();
eventValues.Add("GA_TYPE", type.ToString());
eventValues.Add(eventName, logMessage);
AppsFlyer.sendEvent(AFInAppEvents.GA, eventValues);
}
*/
/*
*GA_TRACK默认类型
@@ -98,6 +125,7 @@ namespace tysdk
*GA_PROFILE设置用户特征
*/
//TOD SDK
/*
public static GAEvent TackEvent(string eventName, bool afSend = true)
{
return new GAEvent(GATrackType.GA_TRACK, eventName, afSend);
@@ -128,4 +156,5 @@ namespace tysdk
return new GAEvent(GATrackType.GA_LOGIN, eventName, afSend);
}
}
}
*/
}