fix reload in cordova
This commit is contained in:
parent
4d040e600d
commit
984a7a6651
6 changed files with 22 additions and 14 deletions
|
|
@ -158,6 +158,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.saveSettings(function(err) {
|
$scope.saveSettings(function(err) {
|
||||||
|
preconditions.checkState(!err,err);
|
||||||
|
|
||||||
$scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) {
|
$scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
form.password.$setViewValue('');
|
form.password.$setViewValue('');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.signout = function() {
|
$scope.signout = function() {
|
||||||
$rootScope.signingOut = true;
|
|
||||||
identityService.signout();
|
identityService.signout();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
pinService.clear(function() {
|
pinService.clear(function() {
|
||||||
copay.logger.debug('PIN erased');
|
copay.logger.debug('PIN erased');
|
||||||
delete $rootScope['hasPin'];
|
delete $rootScope['hasPin'];
|
||||||
applicationService.reload();
|
applicationService.restart();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
||||||
}];
|
}];
|
||||||
|
|
||||||
$scope.signout = function() {
|
$scope.signout = function() {
|
||||||
$rootScope.signingOut = true;
|
|
||||||
identityService.signout();
|
identityService.signout();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,28 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.services')
|
angular.module('copayApp.services')
|
||||||
.factory('applicationService', function() {
|
.factory('applicationService', function($rootScope, $location, $timeout) {
|
||||||
var root = {};
|
var root = {};
|
||||||
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
|
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
|
||||||
|
|
||||||
root.restart = function() {
|
root.restart = function() {
|
||||||
|
if (window.cordova !== undefined) {
|
||||||
|
$rootScope.iden = $rootScope.wallet = undefined;
|
||||||
|
// NOP. no need to restart on cordova apps.
|
||||||
|
$location.path('/');
|
||||||
|
$timeout(function(){
|
||||||
|
$rootScope.$digest();
|
||||||
|
},1);
|
||||||
|
|
||||||
// Go home reloading the application
|
|
||||||
var hashIndex = window.location.href.indexOf('#!/');
|
|
||||||
if (isChromeApp) {
|
|
||||||
chrome.runtime.reload();
|
|
||||||
} else {
|
} else {
|
||||||
window.location = window.location.href.substr(0, hashIndex);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
root.reload = function() {
|
// Go home reloading the application
|
||||||
window.location.reload();
|
var hashIndex = window.location.href.indexOf('#!/');
|
||||||
|
if (isChromeApp) {
|
||||||
|
chrome.runtime.reload();
|
||||||
|
} else {
|
||||||
|
window.location = window.location.href.substr(0, hashIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
||||||
|
|
@ -328,10 +328,12 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.signout = function() {
|
root.signout = function() {
|
||||||
|
$rootScope.signingOut = true;
|
||||||
if ($rootScope.iden) {
|
if ($rootScope.iden) {
|
||||||
$rootScope.iden.store({
|
$rootScope.iden.store({
|
||||||
noWallets: true
|
noWallets: true
|
||||||
}, function() {
|
}, function() {
|
||||||
|
$rootScope.signingOut = false;
|
||||||
$rootScope.iden.close();
|
$rootScope.iden.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue