From 9e2ea245444ac0d8da35fecc8ab356c54be907d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 10 Dec 2015 15:55:08 -0300 Subject: [PATCH] fix backbutton in disclaimer page --- src/js/init.js | 11 +++++------ src/js/routes.js | 8 ++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/js/init.js b/src/js/init.js index c241d99b1..9c6b29c7b 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -33,7 +33,7 @@ angular.element(document).ready(function() { document.addEventListener('pause', function() { if (!window.ignoreMobilePause) { setTimeout(function() { - window.location = '#/cordova/pause//'; + window.location = '#/cordova/pause///'; }, 100); } }, false); @@ -41,7 +41,7 @@ angular.element(document).ready(function() { document.addEventListener('resume', function() { if (!window.ignoreMobilePause) { setTimeout(function() { - window.location = '#/cordova/resume//'; + window.location = '#/cordova/resume///'; }, 100); } setTimeout(function() { @@ -54,11 +54,10 @@ angular.element(document).ready(function() { document.addEventListener('backbutton', function() { var loc = window.location; - var exit = loc.toString().match(/disclaimer/) ? 'true' : ''; - if (exit != 'true') - var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : ''; + var fromDisclaimer = loc.toString().match(/disclaimer/) ? 'true' : ''; + var fromHome = loc.toString().match(/index\.html#\/$/) ? 'true' : ''; if (!window.ignoreMobilePause) { - window.location = '#/cordova/backbutton/' + exit + '/' + secondBackButtonPress; + window.location = '#/cordova/backbutton/' + fromHome + '/' + fromDisclaimer + '/' + secondBackButtonPress; if (secondBackButtonPress == 'true') { clearInterval(intval); } else { diff --git a/src/js/routes.js b/src/js/routes.js index 8df3986c1..fb2bfe569 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -475,7 +475,7 @@ angular } }) .state('cordova', { - url: '/cordova/:status/:exit/:secondBackButtonPress', + url: '/cordova/:status/:fromHome/:fromDisclaimer/:secondBackButtonPress', views: { 'main': { controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { @@ -485,7 +485,11 @@ angular $rootScope.$emit('Local/Resume'); break; case 'backbutton': - if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) { + + if ($stateParams.fromDisclaimer == 'true') + navigator.app.exitApp(); + + if (isCordova && $stateParams.fromHome == 'true' && !$rootScope.modalOpened) { if ($stateParams.secondBackButtonPress == 'true') { navigator.app.exitApp(); } else {