Merge pull request #158 from gabrielbazan7/fix/copayers
refresh status when bwsEvent arrives
This commit is contained in:
commit
9b93cf8c42
1 changed files with 20 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('copayersController',
|
||||
function($scope, $log, $ionicNavBarDelegate, $stateParams, $state, profileService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
||||
function($scope, $log, $ionicNavBarDelegate, $timeout, $stateParams, $state, $rootScope, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
||||
if (!$stateParams.walletId) {
|
||||
$log.debug('No wallet provided...back to home');
|
||||
return $state.go('tabs.home');
|
||||
|
|
@ -53,4 +53,23 @@ angular.module('copayApp.controllers').controller('copayersController',
|
|||
window.plugins.socialsharing.share(message, gettextCatalog.getString('Invitation to share a Copay Wallet'), null, null);
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.$on('bwsEvent', function() {
|
||||
updateWallet();
|
||||
});
|
||||
|
||||
var updateWallet = function() {
|
||||
$log.debug('Updating wallet:' + wallet.name)
|
||||
walletService.getStatus(wallet, {}, function(err, status) {
|
||||
if (err) {
|
||||
$log.error(err); //TODO
|
||||
return;
|
||||
}
|
||||
wallet.status = status;
|
||||
$scope.copayers = wallet.status.wallet.copayers;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue