Merge pull request #52 from gabrielbazan7/fix/clearHistory

clear history on settings
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-02 16:22:23 -03:00 committed by GitHub
commit 0478fbf276
7 changed files with 15 additions and 7 deletions

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('exportController', angular.module('copayApp.controllers').controller('exportController',
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) { function($rootScope, $scope, $timeout, $log, $ionicHistory, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
var prevState; var prevState;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid; var isAndroid = platformInfo.isAndroid;
@ -63,6 +63,7 @@ angular.module('copayApp.controllers').controller('exportController',
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export')); popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return; return;
} }
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
}); });
}); });

View file

@ -1,5 +1,5 @@
angular.module('copayApp.controllers').controller('paperWalletController', angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $timeout, $log, $ionicModal, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) { function($scope, $timeout, $log, $ionicModal, $ionicHistory, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var rawTx; var rawTx;
@ -102,6 +102,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
} else { } else {
var type = walletService.getViewStatus(wallet, txp); var type = walletService.getViewStatus(wallet, txp);
$scope.openStatusModal(type, txp, function() { $scope.openStatusModal(type, txp, function() {
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
}); });
} }

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('paymentUriController', angular.module('copayApp.controllers').controller('paymentUriController',
function($rootScope, $scope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, $state) { function($rootScope, $scope, $stateParams, $location, $timeout, $ionicHistory, profileService, configService, lodash, bitcore, $state) {
function strip(number) { function strip(number) {
return (parseFloat(number.toPrecision(12))); return (parseFloat(number.toPrecision(12)));
}; };
@ -47,6 +47,7 @@ angular.module('copayApp.controllers').controller('paymentUriController',
this.selectWallet = function(wid) { this.selectWallet = function(wid) {
var self = this; var self = this;
profileService.setAndStoreFocus(wid, function() {}); profileService.setAndStoreFocus(wid, function() {});
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
$timeout(function() { $timeout(function() {
$rootScope.$emit('paymentUri', self.bitcoinURI); $rootScope.$emit('paymentUri', self.bitcoinURI);

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController', angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) { function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet')); $ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' '; $scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
@ -37,6 +37,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
if (err) { if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else { } else {
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
} }
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory', angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, profileService, lodash) { function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, $ionicHistory, profileService, lodash) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History')); $ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var c = wallet.credentials; var c = wallet.credentials;
@ -126,6 +126,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$scope.$emit('Local/ClearHistory'); $scope.$emit('Local/ClearHistory');
$timeout(function() { $timeout(function() {
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
}, 100); }, 100);
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation', angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, $ionicNavBarDelegate, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) { function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information')); $ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information'));
var base = 'xpub'; var base = 'xpub';
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
@ -105,6 +105,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
opts.colorFor[walletId] = color; opts.colorFor[walletId] = color;
configService.set(opts, function(err) { configService.set(opts, function(err) {
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
if (err) $log.warn(err); if (err) $log.warn(err);
}); });
@ -116,6 +117,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
$scope.scan = function() { $scope.scan = function() {
walletService.startScan(wallet); walletService.startScan(wallet);
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
}; };

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services') angular.module('copayApp.services')
.factory('applicationService', function($rootScope, $timeout, platformInfo, $state) { .factory('applicationService', function($rootScope, $timeout, $ionicHistory, platformInfo, $state) {
var root = {}; var root = {};
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
@ -19,6 +19,7 @@ angular.module('copayApp.services')
if (isChromeApp) { if (isChromeApp) {
chrome.runtime.reload(); chrome.runtime.reload();
} else if (isNW) { } else if (isNW) {
$ionicHistory.clearHistory();
$state.go('tabs.home'); $state.go('tabs.home');
$timeout(function() { $timeout(function() {
var win = require('nw.gui').Window.get(); var win = require('nw.gui').Window.get();