Merge pull request #3626 from gabrielbazan7/fix/backbuttonDisclaimer

backbutton in android fix
This commit is contained in:
Gustavo Maximiliano Cortez 2015-12-09 14:58:58 -03:00
commit 14a112585f
2 changed files with 13 additions and 8 deletions

View file

@ -11,8 +11,7 @@ angular.element(document).ready(function() {
if (!url) return; if (!url) return;
if (url.indexOf('glidera') != -1) { if (url.indexOf('glidera') != -1) {
url = '#/uri-glidera' + url.replace('bitcoin://glidera', ''); url = '#/uri-glidera' + url.replace('bitcoin://glidera', '');
} } else {
else {
url = '#/uri-payment/' + url; url = '#/uri-payment/' + url;
} }
setTimeout(function() { setTimeout(function() {
@ -48,9 +47,11 @@ angular.element(document).ready(function() {
// Back button event // Back button event
document.addEventListener('backbutton', function() { document.addEventListener('backbutton', function() {
var loc = window.location; var loc = window.location;
var isHome = loc.toString().match(/index\.html#\/$/) ? 'true' : ''; var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
if (exit != 'true')
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
if (!window.ignoreMobilePause) { if (!window.ignoreMobilePause) {
window.location = '#/cordova/backbutton/'+isHome; window.location = '#/cordova/backbutton/' + exit;
} }
setTimeout(function() { setTimeout(function() {
window.ignoreMobilePause = false; window.ignoreMobilePause = false;
@ -70,8 +71,12 @@ angular.element(document).ready(function() {
window.handleOpenURL = handleBitcoinURI; window.handleOpenURL = handleBitcoinURI;
window.plugins.touchid.isAvailable( window.plugins.touchid.isAvailable(
function(msg) { window.touchidAvailable = true; }, // success handler: TouchID available function(msg) {
function(msg) { window.touchidAvailable = false; } // error handler: no TouchID available window.touchidAvailable = true;
}, // success handler: TouchID available
function(msg) {
window.touchidAvailable = false;
} // error handler: no TouchID available
); );
startAngular(); startAngular();

View file

@ -475,7 +475,7 @@ angular
} }
}) })
.state('cordova', { .state('cordova', {
url: '/cordova/:status/:isHome', url: '/cordova/:status/:exit',
views: { views: {
'main': { 'main': {
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
@ -484,7 +484,7 @@ angular
$rootScope.$emit('Local/Resume'); $rootScope.$emit('Local/Resume');
break; break;
case 'backbutton': case 'backbutton':
if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) { if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) {
navigator.app.exitApp(); navigator.app.exitApp();
} else { } else {
$rootScope.$emit('closeModal'); $rootScope.$emit('closeModal');