From ccfe998b9d60ef5b4adcd40a7917d22266671bda Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 1 Nov 2016 19:00:00 -0300 Subject: [PATCH] Fix hidden back button --- src/js/routes.js | 4 +++- src/js/services/incomingData.js | 16 ++++++++-------- src/js/services/openURL.js | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/js/routes.js b/src/js/routes.js index dde598bd4..f3e584a48 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -907,7 +907,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) { uxLanguage.init(); - openURLService.init(); $ionicPlatform.ready(function() { if (platformInfo.isCordova) { @@ -999,6 +998,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr $log.debug('Profile loaded ... Starting UX.'); scannerService.gentleInitialize(); $state.go('tabs.home'); + $timeout(function() { + openURLService.init(); + }, 1000); } }); }); diff --git a/src/js/services/incomingData.js b/src/js/services/incomingData.js index 326fa4794..2db4832a7 100644 --- a/src/js/services/incomingData.js +++ b/src/js/services/incomingData.js @@ -40,7 +40,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat // data extensions for Payment Protocol with non-backwards-compatible request if ((/^bitcoin:\?r=[\w+]/).exec(data)) { data = decodeURIComponent(data.replace('bitcoin:?r=', '')); - $state.go('tabs.send').then(function() { + $state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() { $state.transitionTo('tabs.send.confirm', {paypro: data}); }); return true; @@ -62,7 +62,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat handlePayPro(details); }); } else { - $state.go('tabs.send'); + $state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}); // Timeout is required to enable the "Back" button $timeout(function() { if (amount) { @@ -70,7 +70,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat } else { $state.transitionTo('tabs.send.amount', {toAddress: addr}); } - }); + }, 100); } return true; @@ -102,7 +102,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat var secret = getParameterByName('secret', data); var email = getParameterByName('email', data); var otp = getParameterByName('otp', data); - $state.go('tabs.home').then(function() { + $state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() { $state.transitionTo('tabs.bitpayCardIntro', { secret: secret, email: email, @@ -113,14 +113,14 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat // Join } else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) { - $state.go('tabs.home').then(function() { + $state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() { $state.transitionTo('tabs.add.join', {url: data}); }); return true; // Old join } else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) { - $state.go('tabs.home').then(function() { + $state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() { $state.transitionTo('tabs.add.join', {url: data}); }); return true; @@ -136,7 +136,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat }; function goToAmountPage(toAddress) { - $state.go('tabs.send'); + $state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}); $timeout(function() { $state.transitionTo('tabs.send.amount', {toAddress: toAddress}); }, 100); @@ -150,7 +150,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat paypro: payProDetails }; scannerService.pausePreview(); - $state.go('tabs.send').then(function() { + $state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() { $timeout(function() { $state.transitionTo('tabs.send.confirm', stateParams); }); diff --git a/src/js/services/openURL.js b/src/js/services/openURL.js index 1eb6d1c8f..adc4c6f72 100644 --- a/src/js/services/openURL.js +++ b/src/js/services/openURL.js @@ -8,9 +8,10 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop // Stop it from caching the first view as one to return when the app opens $ionicHistory.nextViewOptions({ historyRoot: true, - disableBack: true, + disableBack: false, disableAnimation: true }); + var url = args.url; if (!url) { $log.error('No url provided');