import "./__antmove/component/componentClass.js";
my.global = {};
const _my = require("./__antmove/api/index.js")(my);
const wx = _my;
App({
  data: {
    systemInfo: null,
    isKEightDevice: false,

    //初始化入参
    initParams: {
      appVersion: "*",
      "appId": "2021004113614021"
    },
    /**
     * 调用1：N刷脸
     */
    //调用服务入参
    oneVNParams: {
      "serviceId": "faceAuthAuth",
      "query": "QUERY",
      "scopes": "auth_user,order_service",
      "appId": "2021004113614021",
      "merchantAppId": "2021003181682188",
      zolozConfig: {
        "cameraID": 0,
        "supCameraID": 1,
        "toygerPowerMode": 0,
        "algorithmAngle": 90,
        "supAlgorithmAngle": 90,
        "isMirror": false,
        "supIsMirror": false,
        "isDisplayMirror": true,
        "supIsDisplayMirror": false,
        "displayAngle": 0,
        "supDisplayAngle": 0,
        "minIod": 0.02
      },
      extInfo: {
        "useTranslucentTheme": true
      }
    },
    //服务编码
    oneVNServiceCode: "BPaaSSmileFaceAuth",

    /**
     * 调用订阅授权服务
     */
    //调用服务入参
    authParams: {
      "auth_center_scope_nicks": "order_service",
      "user_id": "",
      "ftoken": "",
      "merchantAppId": "2021003181682188"
    },
    //服务编码
    authServiceCode: "BPaaSNoFaceAuth",

    /**
     * 访客使用
     */
    //判断二维码类型 1常客码
    type: null,
    // （过审专用，禁止删除）- start
    fake: true,
    // （过审专用，禁止删除）- end
    disinfectAreaId: null, //区域码id,
    userInfo: null
  },
  globalData: {
    authAppId: '2021003181682188',
    authAppToken: 'e9e2faf62fdd538e27ad3eaf30f7ef48d00a2fc3'
  },
  onLaunch(options) {

    // my.call('ampeStartOperationWatcher', {}, res => {
    //   console.log("result", res);
    // });

    my.on('ampeOperationTimeout', e => {
      console.log("event", e);
    })

    // 第一次打开
    // my.getSystemInfo({
    //   success: (res) => {
    //     // 判断获取设备系统信息中arome.deviceId参数是否为空
    //     if (res.arome_deviceId != null) {
    //       //todo 设置信标，当前为 ampe 设备
    //       //todo 获取用户信息
    //       console.log(333);
    //     } else {
    //       //todo 设置信标，当前为手机端 
    //       //todo 获取用户信息

    //     }
    //   },
    //   fail: (err) => {
    //     console.log(err);
    //   }
    // })

    this.getSystemInfoSync()

    //本地缓存-初始化刷脸服务
    my.setStorageSync({
      key: "defaultInitParams",
      data: JSON.parse(JSON.stringify(this.data.initParams))
    });

    //本地缓存-调用刷脸服务
    my.setStorageSync({
      key: "defaultOneVNParams",
      data: JSON.parse(JSON.stringify(this.data.oneVNParams))
    });
    my.setStorageSync({
      key: "defaultOneVNServiceCode",
      data: this.data.oneVNServiceCode
    });

    //本地缓存-调用授权服务
    my.setStorageSync({
      key: "defaultAuthParams",
      data: JSON.parse(JSON.stringify(this.data.authParams))
    });
    my.setStorageSync({
      key: "defaultAuthServiceCode",
      data: this.data.authServiceCode
    });
  },
  //获取系统信息
  getSystemInfoSync() {
    this.data.systemInfo = my.getSystemInfoSync()
    //判断是否是在安卓小程序容器中运行
    if (this.data.systemInfo.arome_hardwareName) {
      this.data.isK8Device = true
    }
  },
  onShow(options) {
    // 从后台被 scheme 重新打开
    // options.query == {number:1}
  },
});
