fixing bugs
This commit is contained in:
parent
9cea58584a
commit
dd68836eea
2 changed files with 26 additions and 20 deletions
|
|
@ -24,10 +24,11 @@ angular.element(document).ready(function() {
|
|||
if (window.cordova !== undefined) {
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
var exitApp = false,
|
||||
intval = setInterval(function() {
|
||||
exitApp = false;
|
||||
}, 2000);
|
||||
|
||||
var exitApp = 'false';
|
||||
var intval = setInterval(function() {
|
||||
exitApp = 'false';
|
||||
}, 2000);
|
||||
|
||||
document.addEventListener('pause', function() {
|
||||
if (!window.ignoreMobilePause) {
|
||||
|
|
@ -51,22 +52,22 @@ angular.element(document).ready(function() {
|
|||
// Back button event
|
||||
|
||||
document.addEventListener('backbutton', function() {
|
||||
if (exitApp) {
|
||||
clearInterval(intval)
|
||||
var loc = window.location;
|
||||
var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
|
||||
if (exit != 'true')
|
||||
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
|
||||
if (!window.ignoreMobilePause) {
|
||||
window.location = '#/cordova/backbutton/' + exit;
|
||||
|
||||
var loc = window.location;
|
||||
var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
|
||||
if (exit != 'true')
|
||||
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
|
||||
if (!window.ignoreMobilePause) {
|
||||
window.location = '#/cordova/backbutton/' + exit + '/' + exitApp;
|
||||
if (exitApp == 'true') {
|
||||
clearInterval(intval);
|
||||
} else {
|
||||
exitApp = 'true';
|
||||
}
|
||||
setTimeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
} else {
|
||||
window.plugins.toast.showShortCenter('Press again to exit');
|
||||
exitApp = true;
|
||||
}
|
||||
setTimeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
}, false);
|
||||
|
||||
document.addEventListener('menubutton', function() {
|
||||
|
|
|
|||
|
|
@ -475,17 +475,22 @@ angular
|
|||
}
|
||||
})
|
||||
.state('cordova', {
|
||||
url: '/cordova/:status/:exit',
|
||||
url: '/cordova/:status/:exit/:exitApp',
|
||||
views: {
|
||||
'main': {
|
||||
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
|
||||
|
||||
switch ($stateParams.status) {
|
||||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'backbutton':
|
||||
if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) {
|
||||
navigator.app.exitApp();
|
||||
if ($stateParams.exitApp == 'true') {
|
||||
navigator.app.exitApp();
|
||||
} else {
|
||||
window.plugins.toast.showShortBottom('Press again to exit');
|
||||
}
|
||||
} else {
|
||||
$rootScope.$emit('closeModal');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue