"use strict";
const common_vendor = require("./common/vendor.js");
function checkNew() {
  const updateManager = common_vendor.index.getUpdateManager();
  updateManager.onCheckForUpdate(function(res) {
  });
  updateManager.onUpdateReady(function() {
    common_vendor.index.showModal({
      title: "更新提示",
      content: "新版本已经准备好，立即重启应用？",
      showCancel: false,
      success: function(res) {
        if (res.confirm) {
          updateManager.applyUpdate();
        }
      }
    });
  });
  updateManager.onUpdateFailed(function() {
    common_vendor.index.showModal({ title: "温馨提示", content: "新版本下载失败，请卸载小程序再重试", showCancel: false });
  });
}
function init() {
  common_vendor.index.getNetworkType({
    success: (res) => {
      const { networkType } = res;
      if (!["none"].includes(networkType)) {
        checkNew();
      } else {
        common_vendor.index.showToast({
          title: "当前无网络访问，请开启网络",
          icon: "none"
        });
      }
    },
    fail: () => {
      common_vendor.index.showToast({
        title: "获取网络失败，网络不稳定",
        icon: "none"
      });
    }
  });
}
exports.init = init;
//# sourceMappingURL=../.sourcemap/mp-weixin/initConfig.js.map
