Update: Adds a callback for updateAllWallets

This commit is contained in:
Sam Cheng Hung 2018-04-11 17:41:05 +08:00
commit 772f3bfb35

View file

@ -83,11 +83,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.enter", function(event, data) {
$ionicNavBarDelegate.showBar(true); $ionicNavBarDelegate.showBar(true);
updateAllWallets(); updateAllWallets(function() {
$timeout(function() {
profileService.initBitcoinCoreDisplay(); profileService.initBitcoinCoreDisplay();
}, 1000); });
addressbookService.list(function(err, ab) { addressbookService.list(function(err, ab) {
if (err) $log.error(err); if (err) $log.error(err);
@ -215,7 +213,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}) })
}; };
var updateAllWallets = function() { var updateAllWallets = function(cb) {
var wallets = []; var wallets = [];
$scope.walletsBtc = profileService.getWallets({coin: 'btc'}); $scope.walletsBtc = profileService.getWallets({coin: 'btc'});
$scope.walletsBch = profileService.getWallets({coin: 'bch'}); $scope.walletsBch = profileService.getWallets({coin: 'bch'});
@ -249,6 +247,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
} }
if (++j == i) { if (++j == i) {
updateTxps(); updateTxps();
if (cb !== undefined) {
cb();
}
} }
}); });
}); });