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