feat: add premit request.

This commit is contained in:
Rintim 2023-11-30 20:12:57 +08:00
parent ed9e09a376
commit 13b62c570c
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 13 additions and 2 deletions

View File

@ -9979,7 +9979,7 @@ new Promise(resolve=>{
'是否退出游戏?', '是否退出游戏?',
function(index){ function(index){
switch(index){ switch(index){
case 2:game.saveConfig('null');game.reload();break; case 2:game.reload();break;
case 3:navigator.app.exitApp();break; case 3:navigator.app.exitApp();break;
} }
}, },
@ -9991,6 +9991,17 @@ new Promise(resolve=>{
navigator.app.exitApp(); navigator.app.exitApp();
} }
}); });
if ("cordova" in window && "plugins" in window.cordova && "permissions" in window.cordova.plugins) {
const permissions = cordova.plugins.permissions;
const requests = ["WRITE_EXTERNAL_STORAGE", "READ_EXTERNAL_STORAGE"]
requests.forEach((request) => {
permissions.checkPermission(permissions[request], (status) => {
if (!status.hasPermission) {
permissions.requestPermission(permissions[request], lib.other.ignore, lib.other.ignore);
}
}, lib.other.ignore);
});
}
} }
game.download=function(url,folder,onsuccess,onerror,dev,onprogress){ game.download=function(url,folder,onsuccess,onerror,dev,onprogress){
if(!url.startsWith('http')){ if(!url.startsWith('http')){
@ -10151,7 +10162,7 @@ new Promise(resolve=>{
else{ else{
showbar(); showbar();
} }
} };
} }
else if(typeof window.require=='function'){ else if(typeof window.require=='function'){
lib.node={ lib.node={