Fix reloading after restart app

This commit is contained in:
Gustavo Maximiliano Cortez 2015-06-11 12:53:38 -03:00
parent 1224f89c17
commit 9cebdbef42
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
3 changed files with 11 additions and 9 deletions

View File

@ -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();
});
};

View File

@ -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);
});
};
}

View File

@ -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 {