From 682c896f27cbe5e416bcf2abdeae17130b1eaac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 10 Dec 2015 11:24:42 -0300 Subject: [PATCH] rename and more seconds to the interval --- src/js/init.js | 12 ++++++------ src/js/routes.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/js/init.js b/src/js/init.js index b7eb360fc..cad48be92 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -25,10 +25,10 @@ angular.element(document).ready(function() { document.addEventListener('deviceready', function() { - var exitApp = 'false'; + var secondBackButtonPress = 'false'; var intval = setInterval(function() { - exitApp = 'false'; - }, 2000); + secondBackButtonPress = 'false'; + }, 5000); document.addEventListener('pause', function() { if (!window.ignoreMobilePause) { @@ -58,11 +58,11 @@ angular.element(document).ready(function() { if (exit != 'true') var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : ''; if (!window.ignoreMobilePause) { - window.location = '#/cordova/backbutton/' + exit + '/' + exitApp; - if (exitApp == 'true') { + window.location = '#/cordova/backbutton/' + exit + '/' + secondBackButtonPress; + if (secondBackButtonPress == 'true') { clearInterval(intval); } else { - exitApp = 'true'; + secondBackButtonPress = 'true'; } } setTimeout(function() { diff --git a/src/js/routes.js b/src/js/routes.js index b14a08e77..8df3986c1 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -475,7 +475,7 @@ angular } }) .state('cordova', { - url: '/cordova/:status/:exit/:exitApp', + url: '/cordova/:status/:exit/:secondBackButtonPress', views: { 'main': { controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { @@ -486,7 +486,7 @@ angular break; case 'backbutton': if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) { - if ($stateParams.exitApp == 'true') { + if ($stateParams.secondBackButtonPress == 'true') { navigator.app.exitApp(); } else { window.plugins.toast.showShortBottom('Press again to exit');