From a95c8164a4f3fe7dff041173f99eb54ba15bf88e Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 20 Apr 2015 11:55:32 -0300 Subject: [PATCH 1/3] Back button should exit the app if there is no more previous pages --- src/js/init.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/init.js b/src/js/init.js index 7179a3ccc..0cec07bf6 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -43,9 +43,11 @@ angular.element(document).ready(function() { // window.location = '#/cordoba/online'; // }, false); - document.addEventListener('backbutton', function() { - window.location = '#/walletHome'; - }, false); + // Removes handler for backbutton event. + // All apps use a natural flow for back button + //document.addEventListener('backbutton', function() { + // window.location = '#/walletHome'; + //}, false); document.addEventListener('menubutton', function() { window.location = '#/preferences'; From 28461491af669a8b2826eb4cf9ee58805e9df2d3 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 20 Apr 2015 12:29:42 -0300 Subject: [PATCH 2/3] Fix back button --- src/js/init.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js/init.js b/src/js/init.js index 0cec07bf6..54bbbb3b0 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -43,11 +43,15 @@ angular.element(document).ready(function() { // window.location = '#/cordoba/online'; // }, false); - // Removes handler for backbutton event. - // All apps use a natural flow for back button - //document.addEventListener('backbutton', function() { - // window.location = '#/walletHome'; - //}, false); + // Back button event + document.addEventListener('backbutton', function() { + if (window.location == 'x-wmapp0:www/index.html#/') { + navigator.app.exitApp(); + } + else { + window.location = '#/walletHome'; + } + }, false); document.addEventListener('menubutton', function() { window.location = '#/preferences'; From 62c475381497a110738aad156185691b609e380b Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 20 Apr 2015 12:48:01 -0300 Subject: [PATCH 3/3] Fix back button --- src/js/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/init.js b/src/js/init.js index 54bbbb3b0..0b3f01085 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -45,7 +45,8 @@ angular.element(document).ready(function() { // Back button event document.addEventListener('backbutton', function() { - if (window.location == 'x-wmapp0:www/index.html#/') { + var loc = window.location; + if (loc.toString().match(/index\.html#\/$/)) { navigator.app.exitApp(); } else {