xinhuamm_xycloud

新移云SDK插件

双端约定方法名

打开新移云页面

_xinhuammXycloudPlugin.openCloudPage("url");

静态参数配置方法(全局设置一次)

_xinhuammXycloudPlugin.setCloudGlobalConfig({
  "weixinSchemeUrl": "微信支付协议",
  "appUrlScheme": "支付宝支付协议",
  "userAgent": "xinhuamm",
  "themeColor": "#ff0000",
  "showNavigationBar": false,
  "isDebug": false
});

添加原生回调监听(全局设置一次)

void setCloudMethodCallHandler() {
  _xinhuammXycloudPlugin.setCloudMethodCallHandler((call) {
    if ("getUserId" == call.method) {
      // 用来判断用户是否登录/用户是否切换。返回:"*"/""/null
      return Future.value("userId");
    } else if ("getLoginParam" == call.method) {
      // 获取免登接口请求参数。返回:json字符串
      /* {
      "userId":"用户标识",
      "userPhone":"用户手机号",
      "otherKey":"value",
      } */
      return Future.value({
        "userId": "用户标识",
        "userPhone": "用户手机号",
        "otherKey": "value",
      });
    } else if ("share" == call.method) {
      // 调用分享功能,call中带有分享参数:
      /* {
      "title":"分享标题",
      "description":"分享摘要",
      "imageUrl":"分享图片",
      "url":"分享链接",
      } */
      String title = call.arguments['title'];
      String description = call.arguments['description'];
      String imageUrl = call.arguments['imageUrl'];
      String url = call.arguments['url'];
    } else if ("openMini" == call.method) {
      // 打开微信小程序,call中带有小程序信息:code&path
      String code = call.arguments['code'];
      String path = call.arguments['path'];
    }
    return Future.value(null);
  });
}