Skip to content

Commit

Permalink
Merge pull request #1691 from matiu/bug/digest
Browse files Browse the repository at this point in the history
add digest
  • Loading branch information
cmgustavo committed Nov 2, 2014
2 parents 5d2b37d + 97aac05 commit b41b794
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions js/services/controllerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ angular.module('copayApp.services')
} else {
$location.path('/manage');
}
$timeout(function() {
$rootScope.$digest()
}, 1);
};

// On the focused wallet
Expand Down
18 changes: 12 additions & 6 deletions js/services/identityService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('copayApp.services')
.factory('identityService', function($rootScope, $location, pluginManager, controllerUtils) {
.factory('identityService', function($rootScope, $location, $timeout, pluginManager, controllerUtils) {
var root = {};

root.check = function(scope) {
Expand Down Expand Up @@ -36,11 +36,15 @@ angular.module('copayApp.services')
scope.loading = false;
if (err || !iden) {
copay.logger.debug(err);
if (err && ( err.match('EEXISTS') || err.match('BADCREDENTIALS'))) {
if (err && (err.match('EEXISTS') || err.match('BADCREDENTIALS'))) {
scope.error = 'User already exists!';
} else {
scope.error = 'Unknown error when connecting Insight Server';
}
$timeout(function() {
$rootScope.$digest()
}, 1);

return;
}
var walletOptions = {
Expand Down Expand Up @@ -74,18 +78,20 @@ angular.module('copayApp.services')
walletDefaults: config.wallet,
passphraseConfig: config.passphraseConfig,
}, function(err, iden) {
scope.loading = false;
if (err && !iden) {
if ((err.toString() || '').match('PNOTFOUND')) {
scope.error = 'Invalid email or password';
}
else {
} else {
scope.error = 'Unknown error';
}
}
$timeout(function() {
$rootScope.$digest()
}, 1);
} else {
var firstWallet = iden.getLastFocusedWallet();
controllerUtils.bindProfile(scope, iden, firstWallet);
}
scope.loading = false;
});
};

Expand Down

0 comments on commit b41b794

Please sign in to comment.