rename and more seconds to the interval

This commit is contained in:
Gabriel Bazán 2015-12-10 11:24:42 -03:00
commit 682c896f27
2 changed files with 8 additions and 8 deletions

View file

@ -25,10 +25,10 @@ angular.element(document).ready(function() {
document.addEventListener('deviceready', function() { document.addEventListener('deviceready', function() {
var exitApp = 'false'; var secondBackButtonPress = 'false';
var intval = setInterval(function() { var intval = setInterval(function() {
exitApp = 'false'; secondBackButtonPress = 'false';
}, 2000); }, 5000);
document.addEventListener('pause', function() { document.addEventListener('pause', function() {
if (!window.ignoreMobilePause) { if (!window.ignoreMobilePause) {
@ -58,11 +58,11 @@ angular.element(document).ready(function() {
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 + '/' + secondBackButtonPress;
if (exitApp == 'true') { if (secondBackButtonPress == 'true') {
clearInterval(intval); clearInterval(intval);
} else { } else {
exitApp = 'true'; secondBackButtonPress = 'true';
} }
} }
setTimeout(function() { setTimeout(function() {

View file

@ -475,7 +475,7 @@ angular
} }
}) })
.state('cordova', { .state('cordova', {
url: '/cordova/:status/:exit/:exitApp', url: '/cordova/:status/:exit/:secondBackButtonPress',
views: { views: {
'main': { 'main': {
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
@ -486,7 +486,7 @@ angular
break; break;
case 'backbutton': case 'backbutton':
if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) { if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) {
if ($stateParams.exitApp == 'true') { if ($stateParams.secondBackButtonPress == 'true') {
navigator.app.exitApp(); navigator.app.exitApp();
} else { } else {
window.plugins.toast.showShortBottom('Press again to exit'); window.plugins.toast.showShortBottom('Press again to exit');