From 59d3482c25a30ee4e1ead54d2390e18f453cfd9a Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 15 Sep 2017 10:15:19 -0400 Subject: [PATCH] Clear history after return home --- src/js/controllers/cashScan.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/cashScan.js b/src/js/controllers/cashScan.js index 7f60192e3..f00ed3ebf 100644 --- a/src/js/controllers/cashScan.js +++ b/src/js/controllers/cashScan.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('cashScanController', - function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, txFormatService, bwcError, pushNotificationsService, bwcService) { + function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $ionicHistory, $window, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, txFormatService, bwcError, pushNotificationsService, bwcService) { var wallet; var errors = bwcService.getErrors(); $scope.error = null; @@ -11,6 +11,17 @@ angular.module('copayApp.controllers').controller('cashScanController', updateAllWallets(); }); + var goHome = function() { + $ionicHistory.nextViewOptions({ + disableAnimate: true, + historyRoot: true + }); + $ionicHistory.clearHistory(); + $state.go('tabs.settings').then(function() { + $state.transitionTo('tabs.home'); + }); + } + var updateAllWallets = function() { var walletsBTC = profileService.getWallets({ coin: 'btc', @@ -19,7 +30,7 @@ angular.module('copayApp.controllers').controller('cashScanController', }); if (lodash.isEmpty(walletsBTC)) { - $state.go('tabs.home'); + goHome(); return; } @@ -157,7 +168,7 @@ angular.module('copayApp.controllers').controller('cashScanController', if (isNew) walletService.startScan(newWallet, function() {}); - $state.go('tabs.home'); + goHome(); }); }); });