|
|
|
|
|
|
using System.Security.Cryptography; |
|
|
|
using HuaweiHms; |
|
|
|
using UnityEngine; |
|
|
|
using HuaweiHms; |
|
|
|
|
|
|
|
namespace HuaweiHmsDemo |
|
|
|
{ |
|
|
|
|
|
|
{ |
|
|
|
if (_appMessaging == null) |
|
|
|
{ |
|
|
|
_appMessaging = AGConnectAppMessaging.getInstance(); |
|
|
|
_appMessaging = AGConnectAppMessaging.getInstance(); |
|
|
|
} |
|
|
|
|
|
|
|
return _appMessaging; |
|
|
|
|
|
|
private AGConnectAppMessaging _appMessaging; |
|
|
|
|
|
|
|
public bool showApp = false; |
|
|
|
public bool showMessage = false; |
|
|
|
public bool fetchMessage = false; |
|
|
|
|
|
|
|
public static string EVENTNAME = "JUSTTEST"; |
|
|
|
// appMessaging.setDisplayEnable(false);
|
|
|
|
registerEvent("Show/Hide App Message State", ShowAppMessageState); |
|
|
|
registerEvent("Enable/Disable Fetch Message", EnableFetchMessage); |
|
|
|
registerEvent("Enable/Disable Fetch Message State", EnableFetchMessageState); |
|
|
|
registerEvent("Force Fetch", ForceFetch); |
|
|
|
registerEvent("Add OnClick Listener", AddOnClickListener); |
|
|
|
registerEvent("Add Dismiss Listener", AddDismissListener); |
|
|
|
|
|
|
|
|
|
|
public void ShowAppMessage() |
|
|
|
{ |
|
|
|
showApp = !showApp; |
|
|
|
appMessaging.setDisplayEnable(showApp); |
|
|
|
TestTip.Inst.ShowText($"set display to {showApp}"); |
|
|
|
showMessage = !showMessage; |
|
|
|
appMessaging.setDisplayEnable(showMessage); |
|
|
|
TestTip.Inst.ShowText($"set display to {showMessage}"); |
|
|
|
} |
|
|
|
|
|
|
|
public void ShowAppMessageState() |
|
|
|
{ |
|
|
|
var enable = appMessaging.isDisplayEnable(); |
|
|
|
TestTip.Inst.ShowText($"is display enable {enable}"); |
|
|
|
|
|
|
|
|
|
|
|
public void EnableFetchMessage() |
|
|
|
{ |
|
|
|
fetchMessage = !fetchMessage; |
|
|
|
appMessaging.setFetchMessageEnable(fetchMessage); |
|
|
|
TestTip.Inst.ShowText($"set fetch message to {fetchMessage}"); |
|
|
|
} |
|
|
|
|
|
|
|
public void EnableFetchMessageState() |
|
|
|
{ |
|
|
|
var enable = appMessaging.isFetchMessageEnable(); |
|
|
|
TestTip.Inst.ShowText($"is fetch enable: {enable}"); |
|
|
|
} |
|
|
|
|
|
|
|
public void ForceFetch() |
|
|
|
{ |
|
|
|
appMessaging.setForceFetch(); |
|
|
|
|
|
|
public void AddOnClickListener() |
|
|
|
{ |
|
|
|
ClickListener listener = new ClickListener(); |
|
|
|
ClickListener listener = new ClickListener(); |
|
|
|
|
|
|
|
|
|
|
|
DismissListener listener = new DismissListener(); |
|
|
|
DismissListener listener = new DismissListener(); |
|
|
|
|
|
|
|
|
|
|
|
DisplayListener listener = new DisplayListener(); |
|
|
|
DisplayListener listener = new DisplayListener(); |
|
|
|
appMessaging.addOnDisplayListener(listener); |
|
|
|
TestTip.Inst.ShowText("Add on display listener success"); |
|
|
|
} |
|
|
|
|
|
|
CustomDisplayView view = new CustomDisplayView(); |
|
|
|
CustomDisplayView view = new CustomDisplayView(); |
|
|
|
appMessaging.addCustomView(view); |
|
|
|
TestTip.Inst.ShowText("Add custom view success"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public void Trigger() |
|
|
|
{ |
|
|
|
appMessaging.trigger("justtest"); |
|
|
|
appMessaging.trigger(EVENTNAME); |
|
|
|
TestTip.Inst.ShowText("trigger"); |
|
|
|
} |
|
|
|
} |