add "verifying wallet message"

This commit is contained in:
Matias Alejo Garcia 2016-06-13 09:50:37 -03:00
commit 22ed51d047
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 62 additions and 29 deletions

View file

@ -1427,6 +1427,19 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.tab = 'walletHome'; self.tab = 'walletHome';
}); });
$rootScope.$on('Local/ValidatingWallet', function() {
if (isCordova) {
window.plugins.spinnerDialog.hide();
window.plugins.spinnerDialog.show(null, gettext('Validating wallet integrity...'), true);
}
});
$rootScope.$on('Local/ProfileBound', function() {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
});
$rootScope.$on('Local/ClearHistory', function(event) { $rootScope.$on('Local/ClearHistory', function(event) {
$log.debug('The wallet transaction history has been deleted'); $log.debug('The wallet transaction history has been deleted');
self.txHistory = self.completeHistory = self.txHistorySearchResults = []; self.txHistory = self.completeHistory = self.txHistorySearchResults = [];

View file

@ -614,7 +614,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} else { } else {
if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) { if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) {
event.preventDefault();
$state.transitionTo('copayers'); $state.transitionTo('copayers');
} }
} }

View file

@ -123,9 +123,9 @@ angular.module('copayApp.services')
// Used when reading wallets from the profile // Used when reading wallets from the profile
root.bindWallet = function(credentials) { root.bindWallet = function(credentials, cb) {
if (!credentials.walletId) if (!credentials.walletId)
throw 'bindWallet should receive credentials JSON'; return cb('bindWallet should receive credentials JSON');
// Create the client // Create the client
@ -136,16 +136,21 @@ angular.module('copayApp.services')
}; };
var skipKeyValidation = root.profile.isChecked(platformInfo.ua, credentials.walletId); var skipKeyValidation = root.profile.isChecked(platformInfo.ua, credentials.walletId);
$log.info('Binding wallet:' + credentials.walletId + ' Validating?:' + !skipKeyValidation); if (!skipKeyValidation) {
var client = bwcService.getClient(JSON.stringify(credentials), { $rootScope.$emit('Local/ValidatingWallet');
bwsurl: getBWSURL(credentials.walletId), }
skipKeyValidation: skipKeyValidation, $timeout(function() {
}); $log.info('Binding wallet:' + credentials.walletId + ' Validating?:' + !skipKeyValidation);
var client = bwcService.getClient(JSON.stringify(credentials), {
bwsurl: getBWSURL(credentials.walletId),
skipKeyValidation: skipKeyValidation,
});
if (!skipKeyValidation && !client.incorrectDerivation) if (!skipKeyValidation && !client.incorrectDerivation)
root.profile.setChecked(platformInfo.ua, credentials.walletId); root.profile.setChecked(platformInfo.ua, credentials.walletId);
return root.bindWalletClient(client); return cb(null, root.bindWalletClient(client));
}, 1);
}; };
root.bindProfile = function(profile, cb) { root.bindProfile = function(profile, cb) {
@ -155,26 +160,42 @@ angular.module('copayApp.services')
$log.debug('Preferences read'); $log.debug('Preferences read');
if (err) return cb(err); if (err) return cb(err);
lodash.each(root.profile.credentials, function(credentials) { function bindWallets(cb) {
root.bindWallet(credentials); var l = root.profile.credentials.length;
}); var i = 0, totalBound = 0;
$rootScope.$emit('Local/WalletListUpdated');
storageService.getFocusedWalletId(function(err, focusedWalletId) { lodash.each(root.profile.credentials, function(credentials) {
if (err) return cb(err); root.bindWallet(credentials, function(err, bound) {
root._setFocus(focusedWalletId, function() { i++;
if (usePushNotifications) totalBound += bound;
root.pushNotificationsInit(); if (i == l) {
root.isDisclaimerAccepted(function(val) { $log.info('Bound ' + totalBound + ' out of ' + l + ' wallets');
if (!val) { if (totalBound)
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); $rootScope.$emit('Local/WalletListUpdated');
return cb();
} }
});
});
}
bindWallets(function() {
storageService.getFocusedWalletId(function(err, focusedWalletId) {
if (err) return cb(err);
root._setFocus(focusedWalletId, function() {
if (usePushNotifications)
root.pushNotificationsInit();
root.isBound = true; root.isBound = true;
$rootScope.$emit('Local/ProfileBound'); $rootScope.$emit('Local/ProfileBound');
return cb();
root.isDisclaimerAccepted(function(val) {
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
return cb();
});
}); });
}); })
}); });
}); });
}; };
@ -348,8 +369,8 @@ angular.module('copayApp.services')
// check if exist // check if exist
if (lodash.find(root.profile.credentials, { if (lodash.find(root.profile.credentials, {
'walletId': walletData.walletId 'walletId': walletData.walletId
})) { })) {
return cb(gettext('Cannot join the same wallet more that once')); return cb(gettext('Cannot join the same wallet more that once'));
} }
} catch (ex) { } catch (ex) {
@ -709,7 +730,7 @@ angular.module('copayApp.services')
return (w.n == n); return (w.n == n);
}); });
} }
return lodash.sortBy(ret, 'name'); return lodash.sortBy(ret, 'name');
}; };