2025-09-01 06:57:00 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2025-09-02 06:37:21 +00:00
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
2025-09-01 06:57:00 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace EFSDK
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// TKG Native SDK Android platform interface call
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class EFSdk
|
|
|
|
|
{
|
|
|
|
|
private static EFSdk _mEfSdk;
|
2025-09-02 06:37:21 +00:00
|
|
|
|
|
|
|
|
|
// 保持变量名不变
|
|
|
|
|
private static string mappingInfo = "";
|
2025-09-01 06:57:00 +00:00
|
|
|
|
|
|
|
|
|
public static EFSdk get()
|
|
|
|
|
{
|
|
|
|
|
if (_mEfSdk == null)
|
|
|
|
|
{
|
|
|
|
|
_mEfSdk = new EFSdk();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _mEfSdk;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AndroidJavaObject jo;
|
|
|
|
|
|
|
|
|
|
public EFSdk()
|
|
|
|
|
{
|
2025-09-02 06:37:21 +00:00
|
|
|
|
Debug.Log($"GetNewSDKClass():{GetNewSDKClass()}");
|
2025-10-15 08:26:52 +00:00
|
|
|
|
Debug.Log($"initSDK():{GenerateAndroidName("initSDK")}");
|
|
|
|
|
|
2025-09-01 06:57:00 +00:00
|
|
|
|
// java interface class
|
2025-09-02 06:37:21 +00:00
|
|
|
|
using (AndroidJavaClass jc = new AndroidJavaClass(GetNewSDKClass()))
|
2025-09-01 06:57:00 +00:00
|
|
|
|
{
|
|
|
|
|
jo = jc.GetStatic<AndroidJavaObject>("INSTANCE");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-02 06:37:21 +00:00
|
|
|
|
private static string oriSDKPName = "com.earn.push";
|
|
|
|
|
private static string oriSDK = "_SDK";
|
|
|
|
|
|
|
|
|
|
private static string GetNewSDKClass()
|
|
|
|
|
{
|
2025-10-15 08:26:52 +00:00
|
|
|
|
return GetSDKPackage() + GenerateAndroidName(oriSDK);
|
2025-09-02 06:37:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static string GetSDKPackage()
|
|
|
|
|
{
|
|
|
|
|
string[] parts = oriSDKPName.Split('.');
|
|
|
|
|
string[] parts2 = new string[parts.Length];
|
|
|
|
|
for (int i = 0; i < parts.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
parts2[i] = GenerateAndroidName(parts[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string newPName = "";
|
|
|
|
|
for (int i = 0; i < parts2.Length; i++)
|
|
|
|
|
{
|
2025-10-15 08:26:52 +00:00
|
|
|
|
newPName += parts2[i] + ".";
|
2025-09-02 06:37:21 +00:00
|
|
|
|
}
|
2025-10-15 08:26:52 +00:00
|
|
|
|
|
2025-09-02 06:37:21 +00:00
|
|
|
|
return newPName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static string GenerateAndroidName(string oriString)
|
|
|
|
|
{
|
|
|
|
|
string md5Str = GetFirstEightWithUnderscore(GetMD5Hash(Application.identifier + oriString));
|
|
|
|
|
return md5Str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetMD5Hash(string input)
|
|
|
|
|
{
|
|
|
|
|
using (var md5 = MD5.Create())
|
|
|
|
|
{
|
|
|
|
|
var inputBytes = Encoding.ASCII.GetBytes(input);
|
|
|
|
|
var hashBytes = md5.ComputeHash(inputBytes);
|
|
|
|
|
|
|
|
|
|
var builder = new StringBuilder();
|
|
|
|
|
foreach (var t in hashBytes)
|
|
|
|
|
{
|
|
|
|
|
builder.Append(t.ToString("x2")); // Convert byte to hexadecimal string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static string GetFirstEightWithUnderscore(string str)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(str)) return str;
|
|
|
|
|
string sub = str.Length <= 8 ? str : str.Substring(0, 8);
|
|
|
|
|
if (char.IsDigit(sub[0]))
|
|
|
|
|
{
|
|
|
|
|
sub = "a" + sub;
|
|
|
|
|
}
|
2025-10-15 08:26:52 +00:00
|
|
|
|
|
2025-09-02 06:37:21 +00:00
|
|
|
|
return sub;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-01 06:57:00 +00:00
|
|
|
|
private T SDKCall<T>(string _method, params object[] _param)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2025-09-02 06:37:21 +00:00
|
|
|
|
string newMethod = GenerateAndroidName(_method);
|
|
|
|
|
Debug.Log($"SDKCall<T> newMethod:{newMethod}");
|
|
|
|
|
return jo.Call<T>(newMethod, _param);
|
2025-09-01 06:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return default(T);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SDKCall(string _method, params object[] _param)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2025-09-02 06:37:21 +00:00
|
|
|
|
string newMethod = GenerateAndroidName(_method);
|
|
|
|
|
Debug.Log($"SDKCall newMethod:{newMethod}");
|
|
|
|
|
jo.Call(newMethod, _param);
|
2025-09-01 06:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ActionType
|
|
|
|
|
{
|
2025-09-02 06:37:21 +00:00
|
|
|
|
SDK_INIT_Succ, //GAM页面加载成功
|
|
|
|
|
H5_Load_Succ, //H5页面加载成功
|
2025-09-01 06:57:00 +00:00
|
|
|
|
ON_RESUME, //游戏可见时回调,
|
|
|
|
|
// CAN_GOBACK, //游戏可见时回调,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Action<ActionType, string> ActionCallback;
|
|
|
|
|
public Action<string, Dictionary<string, string>> ActionSDKEventCallback;
|
|
|
|
|
public Action<string> HdH5ImpressionAction;
|
|
|
|
|
public Action<bool> mCanGobackAction;
|
|
|
|
|
public Action<bool> mReqNotifyPermissionAction;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在Init方法之后调用这个方法,设置SDK上报事件回调, 将SDK传过来的事件上报到Firebase,数数等
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="actionCallbvack">
|
|
|
|
|
/// 事件ID,事件属性
|
|
|
|
|
/// </param>
|
|
|
|
|
public void SetSDKEventCallback(Action<string, Dictionary<string, string>> eventKeyDict)
|
|
|
|
|
{
|
|
|
|
|
ActionSDKEventCallback = eventKeyDict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 互动广告展示回调,此时可以计算上报互动广告展示次数和收益
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="callback">string 是互动广告的url</param>
|
|
|
|
|
public void SetHdH5ImpressionCallback(Action<string> callback)
|
|
|
|
|
{
|
|
|
|
|
HdH5ImpressionAction = callback;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="actionCallbvack">ActionType 回调类型 ; string msg </param>
|
|
|
|
|
public void Init(Action<ActionType, string> actionCallbvack)
|
|
|
|
|
{
|
|
|
|
|
ActionCallback = actionCallbvack;
|
|
|
|
|
SDKInit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SDKInit()
|
|
|
|
|
{
|
2025-09-02 06:37:21 +00:00
|
|
|
|
SDKCall("initSDK", mappingInfo);
|
|
|
|
|
ActionCallback?.Invoke(ActionType.SDK_INIT_Succ, string.Empty);
|
2025-09-01 06:57:00 +00:00
|
|
|
|
}
|
2025-10-15 08:26:52 +00:00
|
|
|
|
|
2025-09-10 10:07:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当游戏进程启动之后,可以接收响应的时候(一般在游戏内事件上报相关内容初始化完毕调用即可,参数传true),调用这个方法通知SDK,
|
|
|
|
|
/// SDK收到通知后会开始将SDK侧的事件回传给游戏,作事件上报
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="active">传 true</param>
|
|
|
|
|
public void SetGameActive(bool active)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("onGameActive", active);
|
|
|
|
|
}
|
2025-09-01 06:57:00 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 展示WebView
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">标签id</param>
|
|
|
|
|
/// <param name="url">网址</param>
|
|
|
|
|
/// <param name="pRect"></param>
|
|
|
|
|
/// <param name="pCam"></param>
|
|
|
|
|
public void ShowWebView(int id, string url, RectTransform pRect, Camera pCam = null)
|
|
|
|
|
{
|
|
|
|
|
Vector3[] tWorldCorners = new Vector3[4];
|
|
|
|
|
pRect.GetWorldCorners(tWorldCorners);
|
|
|
|
|
Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[1]);
|
|
|
|
|
Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[3]);
|
|
|
|
|
int tWidth = (int)Mathf.Abs(tBottomRight.x - tTopLeft.x);
|
|
|
|
|
int tHeight = (int)Mathf.Abs(tBottomRight.y - tTopLeft.y);
|
|
|
|
|
SDKCall("showWebViewToActivity", id, url, (int)tTopLeft.x, (int)(Screen.height - tTopLeft.y), tWidth,
|
|
|
|
|
tHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 移除所有原生View, 回到游戏时调用
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public void RemoveAll()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("removeAll");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 刷新当前页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public void Refresh()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("refresh");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 回上一页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public void GoBack()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("goBack");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 回首页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public void GoHome()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("goHome");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
public void ShowToast(string message)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("showToast", message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 判断当前网页是否还能返回上一页, true:可以返回,此时页面不在首页 false: 不能返回了,当前页面就在首页
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void CanGoback(Action<bool> canGobackAction)
|
|
|
|
|
{
|
|
|
|
|
mCanGobackAction = canGobackAction;
|
|
|
|
|
SDKCall("canGoback");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 推送通知
|
|
|
|
|
|
2025-09-23 11:34:24 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 启用v2版本常驻通知样式
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="enable">rue:启用v2版本常驻通知样式,false:禁用 (禁用将使用V1版本常驻通知样式)</param>
|
|
|
|
|
public void EnablePersistentStyleV2(bool enable)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("enablePersistentStyleV2", enable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置v2版本常驻通知的文案
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text1">图标 1 文案</param>
|
|
|
|
|
/// <param name="text2">图标 2 文案</param>
|
|
|
|
|
/// <param name="text3">图标 3 文案</param>
|
|
|
|
|
/// <param name="text4">图标 4 文案</param>
|
|
|
|
|
public void SetPersistentStyleV2Text(string text1, string text2, string text3, string text4)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setPersistentStyleV2Text", text1, text2, text3, text4);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-01 06:57:00 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 满足条件:未领取 R$0.1 的 买量用户, 调用这个方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void SubscribeUnclaimed01()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("subscribeUnclaimed01");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不满足条件:未领取 R$0.1 的 买量用户, 调用这个方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void UnSubscribeUnclaimed01()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("unSubscribeUnclaimed01");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
// 满足条件: 在排队中 且 当日R$1 未领取 的买量用户, 调用这个方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void SubscribePending1()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("subscribePending1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不满足条件: 在排队中 且 当日R$1 未领取 的买量用户, 调用这个方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void UnSubscribePending1()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("unSubscribePending1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订阅Firebase推送主题
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="topic">主题名称</param>
|
|
|
|
|
public void SubscribeToTopic(string topic)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("subscribeToTopic", topic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消订阅Firebase推送主题
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="topic">主题名称</param>
|
|
|
|
|
public void UnSubscribeToTopic(string topic)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("UnSubscribeToTopic", topic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 向SDK上报当前金币总数,每次金币变化都要调用一次
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="totalGold"></param>
|
|
|
|
|
public void SendTotalGold2SDK(int totalGold)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setGoldNum", totalGold.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 向SDK上报当前要提现的现金额,每次变化都要调用一次
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cashNum"></param>
|
|
|
|
|
public void SendCashNum2SDK(double cashNum)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setCashNum", cashNum.ToString("0.00"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 向SDK上报 游戏名字(当前语言的),每次语言变化都上报
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="gameName"></param>
|
|
|
|
|
public void SetGameName(string gameName)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setGameName", gameName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置当前游戏语言是否是 西班牙语
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="isEs">西班牙语传 true, 其他的都传 false </param>
|
|
|
|
|
public void SetCurrLang(bool isEs)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setCurrLang", isEs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前是否有通知权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool HasNotifyPermission()
|
|
|
|
|
{
|
|
|
|
|
return SDKCall<bool>("hasNotifyPermission");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求获取通知权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ReqNotifyPermission()
|
|
|
|
|
{
|
|
|
|
|
SDKCall("reqNotifyPermission");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求获取通知权限
|
|
|
|
|
/// <param name="action">授权弹窗关闭回调 bool:表示用户是否允许了权限 true:有权限 false:无权限</param>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ReqNotifyPermission(Action<bool> action)
|
|
|
|
|
{
|
|
|
|
|
mReqNotifyPermissionAction = action;
|
|
|
|
|
SDKCall("reqNotifyPermission");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置推送开关, SDK默认关闭通知
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="isOpen"></param>
|
|
|
|
|
public void SetPushSwitch(bool isOpen)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("pushSwitch", isOpen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 消息类通知弹出间隔设置为60秒(在线参数控制)-Key: messagenotif Value:60
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="timeSeconds"></param>
|
|
|
|
|
public void SetPushMessagenotif(int timeSeconds)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setPushMessagenotif", timeSeconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 持续性通知在进入游戏时弹出的时间间隔设置为300秒(在线参数控制 )-Key:persistentnotif Value:300
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="timeSeconds"></param>
|
|
|
|
|
public void SetPushPersistentnotif(int timeSeconds)
|
|
|
|
|
{
|
|
|
|
|
SDKCall("setPushPersistentnotif", timeSeconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 每次回调游戏的onResume的时候都调用一次,获取游戏要跳转的页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>
|
|
|
|
|
/// 0 不需要进行任何跳转
|
|
|
|
|
/// 1 进行游戏主页
|
|
|
|
|
/// 2 进入游戏的金币提现界面
|
|
|
|
|
/// 3 进入对应小游戏1界面
|
|
|
|
|
/// 4 进入对应小游戏2界面
|
|
|
|
|
/// </returns>
|
|
|
|
|
public int GetJumpPage()
|
|
|
|
|
{
|
|
|
|
|
return SDKCall<int>("getJumpPage");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2025-10-15 08:26:52 +00:00
|
|
|
|
|
|
|
|
|
#region 小组件
|
|
|
|
|
|
|
|
|
|
public enum WidgetType
|
|
|
|
|
{
|
|
|
|
|
Widget3X2 = 1,
|
|
|
|
|
Widget5X1 = 2,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取指定类型的小组件是否已添加到桌面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool IsWidgetAdded(WidgetType type)
|
|
|
|
|
{
|
|
|
|
|
return SDKCall<bool>("isWidgetAdded", (int)type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Action<bool> actionRequestAddWidgetResult = null;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将指定类型的小组件添加到桌面(小组件采用默认样式)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
/// <param name="action">小组件添加结果回调</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public void RequestAddWidget(WidgetType type, Action<bool> action)
|
|
|
|
|
{
|
|
|
|
|
actionRequestAddWidgetResult = action;
|
|
|
|
|
SDKCall("requestAddWidget", (int)type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求将Widget3X2添加到桌面,并自定义文案
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title1">标题1文案</param>
|
|
|
|
|
/// <param name="title2">标题2文案</param>
|
|
|
|
|
/// <param name="progressStr">进度条上的文案</param>
|
|
|
|
|
/// <param name="buttonStr">按钮的文案</param>
|
|
|
|
|
/// <param name="action">小组件添加结果回调</param>
|
|
|
|
|
public void RequestAddWidget3x2(string title1, string title2, string progressStr, string buttonStr,
|
|
|
|
|
Action<bool> action)
|
|
|
|
|
{
|
|
|
|
|
actionRequestAddWidgetResult = action;
|
|
|
|
|
SDKCall("requestAddWidget3x2", title1, title2, progressStr, buttonStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求将 Widget5X1 添加到桌面,并自定义文案
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="content">内容文案</param>
|
|
|
|
|
/// <param name="action">小组件添加结果回调</param>
|
|
|
|
|
/// <param name="contentTextColor">文案文字十六进制颜色值,如: #FFFFFF</param>
|
|
|
|
|
public void RequestAddWidget5x1(string content, Action<bool> action, string contentTextColor = "#FFFFFF")
|
|
|
|
|
{
|
|
|
|
|
actionRequestAddWidgetResult = action;
|
|
|
|
|
SDKCall("requestAddWidget5x1", content, contentTextColor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2025-09-01 06:57:00 +00:00
|
|
|
|
}
|
2025-10-15 08:26:52 +00:00
|
|
|
|
}
|