many optimizations in addresses pulling

This commit is contained in:
Matias Alejo Garcia 2014-05-16 18:33:06 -03:00
commit 398daf3f05
9 changed files with 183 additions and 130 deletions

View file

@ -7,6 +7,8 @@ angular.module('copay.signin').controller('SigninController',
return v1 > v2 ? 1 : ( v1 < v2 ) ? -1 : 0;
};
$rootScope.videoInfo = {};
$scope.loading = $scope.failure = false;
$scope.wallets = walletFactory.getWallets().sort(cmp);
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
@ -20,6 +22,8 @@ angular.module('copay.signin').controller('SigninController',
$rootScope.walletName = form.walletName.$modelValue;
$rootScope.walletPassword = form.createPassword.$modelValue;
$location.path('setup');
};
@ -31,7 +35,10 @@ angular.module('copay.signin').controller('SigninController',
$scope.loading = true;
var password = form.openPassword.$modelValue;
console.log('## Obtaining passphrase...');
Passphrase.getBase64Async(password, function(passphrase){
console.log('## Done.');
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
if (!w) {
$scope.loading = $scope.failure = false;
@ -39,8 +46,8 @@ angular.module('copay.signin').controller('SigninController',
$rootScope.$digest();
return;
}
installStartupHandlers(w);
controllerUtils.startNetwork(w);
listenErrors(w);
});
};
@ -67,16 +74,20 @@ angular.module('copay.signin').controller('SigninController',
controllerUtils.onErrorDigest();
} else {
controllerUtils.startNetwork(w);
listenErrors(w);
installStartupHandlers(w);
}
});
});
};
function listenErrors(wallet) {
function installStartupHandlers(wallet) {
wallet.network.on('error', function(err) {
$scope.failure = true;
});
wallet.on('ready', function() {
console.log('## RECEIVED READY2');
$scope.loading = false;
});
}
});