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) {
|
if (window.cordova !== undefined) {
|
||||||
|
|
||||||
document.addEventListener('deviceready', function() {
|
document.addEventListener('deviceready', function() {
|
||||||
var exitApp = false,
|
|
||||||
intval = setInterval(function() {
|
var exitApp = 'false';
|
||||||
exitApp = false;
|
var intval = setInterval(function() {
|
||||||
}, 2000);
|
exitApp = 'false';
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
document.addEventListener('pause', function() {
|
document.addEventListener('pause', function() {
|
||||||
if (!window.ignoreMobilePause) {
|
if (!window.ignoreMobilePause) {
|
||||||
|
|
@ -51,22 +52,22 @@ angular.element(document).ready(function() {
|
||||||
// Back button event
|
// Back button event
|
||||||
|
|
||||||
document.addEventListener('backbutton', function() {
|
document.addEventListener('backbutton', function() {
|
||||||
if (exitApp) {
|
|
||||||
clearInterval(intval)
|
var loc = window.location;
|
||||||
var loc = window.location;
|
var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
|
||||||
var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
|
if (exit != 'true')
|
||||||
if (exit != 'true')
|
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
|
||||||
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
|
if (!window.ignoreMobilePause) {
|
||||||
if (!window.ignoreMobilePause) {
|
window.location = '#/cordova/backbutton/' + exit + '/' + exitApp;
|
||||||
window.location = '#/cordova/backbutton/' + exit;
|
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);
|
}, false);
|
||||||
|
|
||||||
document.addEventListener('menubutton', function() {
|
document.addEventListener('menubutton', function() {
|
||||||
|
|
|
||||||
|
|
@ -475,17 +475,22 @@ angular
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('cordova', {
|
.state('cordova', {
|
||||||
url: '/cordova/:status/:exit',
|
url: '/cordova/:status/:exit/:exitApp',
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
|
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
|
||||||
|
|
||||||
switch ($stateParams.status) {
|
switch ($stateParams.status) {
|
||||||
case 'resume':
|
case 'resume':
|
||||||
$rootScope.$emit('Local/Resume');
|
$rootScope.$emit('Local/Resume');
|
||||||
break;
|
break;
|
||||||
case 'backbutton':
|
case 'backbutton':
|
||||||
if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) {
|
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 {
|
} else {
|
||||||
$rootScope.$emit('closeModal');
|
$rootScope.$emit('closeModal');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue