Merge pull request #2117 from WalcoFPV/cordova_app_exit_confirm

10.8-maintenance
Michael Keller 2020-07-12 14:01:07 +12:00 committed by GitHub
commit 525f18d4ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -5832,5 +5832,11 @@
}, },
"cordovaWebviewUsed": { "cordovaWebviewUsed": {
"message": "used" "message": "used"
},
"cordovaExitAppTitle": {
"message": "Confirmation"
},
"cordovaExitAppMessage": {
"message": "Do you really want to close the configurator?"
} }
} }

View File

@ -187,6 +187,19 @@ function startProcess() {
chrome.runtime.onSuspend.addListener(closeHandler); chrome.runtime.onSuspend.addListener(closeHandler);
} else if (GUI.isCordova()) { } else if (GUI.isCordova()) {
window.addEventListener('beforeunload', closeHandler); window.addEventListener('beforeunload', closeHandler);
document.addEventListener('backbutton', function(e) {
e.preventDefault();
navigator.notification.confirm(
i18n.getMessage('cordovaExitAppMessage'),
function(stat) {
if (stat === 1) {
navigator.app.exitApp();
}
},
i18n.getMessage('cordovaExitAppTitle'),
[i18n.getMessage('yes'),i18n.getMessage('no')]
);
});
} }
$('.connect_b a.connect').removeClass('disabled'); $('.connect_b a.connect').removeClass('disabled');