2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
import{H as l,al as r,am as c,an as g,ao as m,ap as f}from"./index.2122acf6.js";import{r as v}from"./mobile.5ecfdaee.js";document.addEventListener("deviceready",()=>{navigator.splashscreen.hide(),v(),cordova.plugins.notification.badge.configure({autoClear:!0}),cordova.plugins.notification.local.on("click",function(e,o){cordova.plugins.backgroundMode.moveToForeground()}),cordova.plugins.backgroundMode.enable(),cordova.plugins.backgroundMode.on("activate",function(){cordova.plugins.backgroundMode.disableWebViewOptimizations()}),t()});function t(){return t.lastestCheckTime=new Date().getTime(),r.checkUpdate().then(({version:e,version_code:o,url:n,description:i})=>(setTimeout(()=>{c.create({title:"\u53D1\u73B0\u65B0\u7248\u672Cv"+e,message:i,ok:"\u524D\u5F80\u66F4\u65B0",persistent:!0}).onOk(()=>{g(n)}).onDismiss(()=>{m.show({backgroundColor:"white",html:!0,message:'\u7B49\u5F85\u66F4\u65B0\u5B8C\u6210\uFF5E\uFF5E<br/><a href="'+n+'" target="_blank" class="text-primary">\u70B9\u51FB\u4E0B\u8F7D\u6700\u65B0\u7248\u672C</a>'})})},200),e))}function s(){r.getAppUpgrade().then(e=>{c.create({title:e.title||"\u7CFB\u7EDF\u63D0\u793A",message:e.content})})}function d(){s(),t.lastestCheckTime&&new Date().getTime()-t.lastestCheckTime>60*6e4&&t()}document.addEventListener("resume",d,!1);document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&d()});window.addEventListener("cordovacallbackerror",function(e){console.error(e)});var k=l(({app:e,router:o,store:n,urlPath:i,redirect:p})=>{s(),e.provide("checkUpdate",function(){t().catch(a=>{f.create(a.message)})}),document.addEventListener("deviceready",function(){document.addEventListener("backbutton",function(a){a.preventDefault();let u=o.currentRoute.value.name;["login","home","together","follow","score","my"].indexOf(u)>=0&&cordova.plugins.backgroundMode.moveToBackground()},!1)})});export{k as default};
|