# 工具方法

为了方便接入和调试,我们提供了一些工具类 API,你可以根据情况自行选择。

# EnableLogging()

是否打开日志

AIHelpSupport.EnableLogging(true);

# GetSDKVersion()

获取当前 AIHelp 版本信息

string sdkVersion = AIHelpSupport.GetSDKVersion();

# IsAIHelpShowing()

当前展示的是否为 AIHelp 页面

boolean isShowing = AIHelpSupport.IsAIHelpShowing();

# SetOnSpecificUrlClickedCallback()

利用此 API 来接管某个超链接的点击事件,具体配置方法如下:

1、为超链接配置 js-bridge=enable 参数,如:https://www.google.com?js-bridge=enable

2、设置回调来接管配置了 js-bridge=enable 的超链接的点击事件:

AIHelpSupport.SetOnSpecificUrlClickedCallback((url) => {
    // url: https://www.google.com?js-bridge=enable
    // You can get the callback when user clicked the specific url
});

# SetOnAIHelpSessionOpenCallback()

注册 AIHelp 页面打开的回调通知:

AIHelpSupport.SetOnAIHelpSessionOpenCallback(() => {
    // You can get the callback when user opened the AIHelp page
});

# SetOnAIHelpSessionCloseCallback()

注册 AIHelp 页面关闭的回调通知:

AIHelpSupport.SetOnAIHelpSessionCloseCallback(() => {
    // You can get the callback when user closed the AIHelp page
});

# SetOnOperationUnreadChangedCallback()

注册运营文章更新时的回调通知:

AIHelpSupport.SetOnOperationUnreadChangedCallback((hasUnreadArticles) => {
    // do something you want according to the unread status received
});

# AdditionalSupportFor()

为以下国家或地区提供额外的域名支持:

  • 印度地区
  • 中国大陆地区

需要注意的是,此方法必须在 init 开始之前调用,如下所示:

if (USER_FROM_MAINLAND_CHINA) {
  AIHelpSupport.AdditionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.Init("appKey", "domain", "appId", "defaultLanguage(optional)");
上次更新: 11/9/2023, 2:59:49 AM