From 9cebdbef425152c5c8a4dcabfdef33bf79ab679d Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Jun 2015 12:53:38 -0300 Subject: [PATCH] Fix reloading after restart app --- src/js/controllers/preferencesBwsUrl.js | 3 +-- src/js/routes.js | 9 +++++++-- src/js/services/applicationService.js | 8 +++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/preferencesBwsUrl.js b/src/js/controllers/preferencesBwsUrl.js index cf4483f70..9702e2201 100644 --- a/src/js/controllers/preferencesBwsUrl.js +++ b/src/js/controllers/preferencesBwsUrl.js @@ -21,8 +21,7 @@ angular.module('copayApp.controllers').controller('preferencesBwsUrlController', configService.set(opts, function(err) { if (err) console.log(err); $scope.$emit('Local/BWSUpdated'); - applicationService.restart(true); - go.walletHome(); + applicationService.restart(); }); }; diff --git a/src/js/routes.js b/src/js/routes.js index 24761c787..817772cd0 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -108,14 +108,19 @@ angular views: { 'main': { templateUrl: 'views/disclaimer.html', - controller: function($scope, storageService, applicationService) { + controller: function($scope, $timeout, storageService, applicationService, go) { storageService.getCopayDisclaimer(function(err, val) { $scope.agreed = val; + $timeout(function(){ + $scope.$digest(); + }, 1); }); $scope.agree = function() { storageService.setCopayDisclaimer(function(err) { - applicationService.restart(); + $timeout(function(){ + applicationService.restart(); + }, 1000); }); }; } diff --git a/src/js/services/applicationService.js b/src/js/services/applicationService.js index 1855a6d97..c920a11cc 100644 --- a/src/js/services/applicationService.js +++ b/src/js/services/applicationService.js @@ -3,18 +3,16 @@ angular.module('copayApp.services') .factory('applicationService', function($rootScope, $timeout, isCordova, isChromeApp) { var root = {}; - root.restart = function(hard) { + root.restart = function() { + var hashIndex = window.location.href.indexOf('#/'); if (isCordova) { - if (hard) { - location.reload(); - } + window.location = window.location.href.substr(0, hashIndex); $timeout(function() { $rootScope.$digest(); }, 1); } else { // Go home reloading the application - var hashIndex = window.location.href.indexOf('#/'); if (isChromeApp) { chrome.runtime.reload(); } else {