fix order in events

This commit is contained in:
Matias Alejo Garcia 2014-11-30 01:02:18 -03:00
parent 494c21132a
commit 5e92ae96ac
5 changed files with 14 additions and 14 deletions

View File

@ -24,7 +24,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
}
$rootScope.starting = true;
identityService.open(form.email.$modelValue, form.password.$modelValue, function(err) {
console.log('[home.js.27]'); //TODO
$rootScope.starting = false;
if (err) {
copay.logger.warn(err);

View File

@ -33,7 +33,9 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
};
$scope.switchWallet = function(wid) {
$scope.walletSelection = false;
identityService.setFocusedWallet(wid);
identityService.goWalletHome();
};
$scope.toggleWalletSelection = function() {

View File

@ -185,7 +185,6 @@ Identity.prototype.openWallets = function() {
return va < vb ? 1 : (va === vb ? 0 : -1);
});
console.log('[Identity.js.188]', self.walletIds, self.focusedTimestamps); //TODO
// opens the wallets, in the order they were last accessed. Emits open events (newWallet)
async.eachSeries(self.walletIds, function(walletId, a_cb) {
self.readAndBindWallet(walletId, a_cb);

View File

@ -109,7 +109,7 @@ angular.module('copayApp.services')
$location.path('/send');
};
root.setFocusedWallet = function(w) {
root.setFocusedWallet = function(w, dontUpdateIt) {
if (!_.isObject(w))
w = $rootScope.iden.getWalletById(w);
preconditions.checkState(w && _.isObject(w));
@ -117,9 +117,10 @@ angular.module('copayApp.services')
copay.logger.debug('Set focus:', w.getName());
$rootScope.wallet = w;
$rootScope.iden.updateFocusedTimestamp(w.getId());
pendingTxsService.update();
if (!dontUpdateIt)
$rootScope.iden.updateFocusedTimestamp(w.getId());
pendingTxsService.update();
$timeout(function() {
$rootScope.$digest();
})
@ -143,7 +144,7 @@ angular.module('copayApp.services')
});
w.on('ready', function() {
var isFocused = root.isFocused(wid);
console.log('GOT READY [identityService.js.184:isFocused:]', w.getName(), isFocused); //TODO
copay.logger.debug('Wallet:' + w.getName() + ' is ready. Focused:', isFocused);
balanceService.update(w, function() {
$rootScope.$digest();
@ -252,15 +253,15 @@ angular.module('copayApp.services')
iden.on('newWallet', function(wid) {
var w = iden.getWalletById(wid);
copay.logger.debug('newWallet:', w.getName());
copay.logger.debug('newWallet:', w.getName(), wid, iden.getLastFocusedWalletId());
root.installWalletHandlers(w);
w.netStart();
if (wid == iden.getLastFocusedWalletId()) {
copay.logger.debug('GOT Focused wallet!', w.getName());
root.setFocusedWallet(w);
copay.logger.debug('GOT Focused wallet:', w.getName());
root.setFocusedWallet(w, true);
root.goWalletHome();
$rootScope.$digest()
}
// At the end (after all handlers are in place)...start the wallet.
w.netStart();
});
iden.on('noWallets', function() {
@ -273,7 +274,7 @@ angular.module('copayApp.services')
if ($rootScope.wallet.id === wid) {
$rootScope.wallet = null;
var lastFocused = iden.getLastFocusedWalletId();
self.setFocusedWallet(lastFocused);
root.setFocusedWallet(lastFocused);
}
});
@ -304,7 +305,7 @@ angular.module('copayApp.services')
});
};
root.importProfile = function(str, password, cb){
root.importProfile = function(str, password, cb) {
copay.Identity.importFromEncryptedFullJson(str, password, {
pluginManager: pluginManager,
network: config.network,

View File

@ -9,7 +9,6 @@
<div class="contener_mixte"><div class="ballcolor ball_4">&nbsp;</div></div>
</div>
<span class="text-gray size-12" translate>Accessing your profile...</span>
13
</div>
</div>