90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using HC.MiniJSON;
|
|
|
|
namespace HC.Plugins
|
|
{
|
|
public class HCAnalytics : HCSingleton<HCAnalytics>, HCIBaseAnalytics
|
|
{
|
|
private Dictionary<string, object> config;
|
|
|
|
|
|
protected override void OnInstanceCreate()
|
|
{
|
|
base.OnInstanceCreate();
|
|
config = new Dictionary<string, object>();
|
|
}
|
|
|
|
public void InitializeSdk()
|
|
{
|
|
HCServer.Instance.AppConfig((code, msg, appConfig) =>
|
|
{
|
|
if (code != 0) return;
|
|
var appConfigContent = appConfig.content;
|
|
if (string.IsNullOrEmpty(appConfigContent)) return;
|
|
var contentData = (Dictionary<string, object>)Json.Deserialize(appConfigContent);
|
|
config = contentData;
|
|
|
|
HCAnalyticsManager.Instance.RemoteConfigListen?.Invoke(TrackEventPlatform.HC, config);
|
|
});
|
|
}
|
|
|
|
public TrackEventPlatform GetTrackEventPlatform()
|
|
{
|
|
return TrackEventPlatform.HC;
|
|
}
|
|
|
|
public bool ContainsRemoteConfigKey(string key)
|
|
{
|
|
return config.Keys.Contains(key);
|
|
}
|
|
|
|
public string GetRemoteConfigStr(string key, string defaultValue)
|
|
{
|
|
return config.TryGetValue(key, out var value) ? Convert.ToString(value) : defaultValue;
|
|
}
|
|
|
|
public int GetRemoteConfigInt(string key, int defaultValue)
|
|
{
|
|
return config.TryGetValue(key, out var value) ? Convert.ToInt32(value) : defaultValue;
|
|
}
|
|
|
|
public bool GetRemoteConfigBool(string key, bool defaultValue)
|
|
{
|
|
return config.TryGetValue(key, out var value) ? Convert.ToBoolean(value) : defaultValue;
|
|
}
|
|
|
|
public void SetUserId(string userId)
|
|
{
|
|
}
|
|
|
|
public void TrackEvent(string eventName, Dictionary<string, object> eventDic = null)
|
|
{
|
|
}
|
|
|
|
public void TrackAdRevenue(string eventName, Dictionary<string, object> dictionary)
|
|
{
|
|
}
|
|
|
|
public void SetSuperProperties(Dictionary<string, object> mPoperties)
|
|
{
|
|
}
|
|
|
|
public void UserSet(Dictionary<string, object> mPoperties)
|
|
{
|
|
}
|
|
|
|
public void Login(string userId)
|
|
{
|
|
}
|
|
|
|
public void UserSetOnce(Dictionary<string, object> properties)
|
|
{
|
|
}
|
|
|
|
public void SetLogEnable(bool enable)
|
|
{
|
|
}
|
|
}
|
|
} |