"use strict";
const common_vendor = require("../../common/vendor.js");
const useGetUpdateManager = () => {
  return new Promise((resolve, reject) => {
    common_vendor.index.getUpdateManager().onCheckForUpdate(function(res) {
      if (res.hasUpdate) {
        common_vendor.index.getUpdateManager().onUpdateReady(function() {
          common_vendor.index.showModal({
            title: "更新提示",
            content: "新版本已经准备好，单击确定重启应用",
            showCancel: false,
            success: function(res2) {
              if (res2.confirm) {
                common_vendor.index.getUpdateManager().applyUpdate();
              }
            }
          });
        });
        common_vendor.index.getUpdateManager().onUpdateFailed(function() {
          common_vendor.index.showModal({
            title: "提示",
            content: "检查到有新版本，但下载失败，请检查网络设置",
            showCancel: false
          });
        });
      }
      resolve(res.hasUpdate);
    });
  });
};
exports.useGetUpdateManager = useGetUpdateManager;
//# sourceMappingURL=../../../.sourcemap/mp-alipay/hook/use-get-update-manager/index.js.map
