Ensure settings view is updated when changes made to cards and accounts.

This commit is contained in:
Andy Phillipson 2017-02-22 12:34:19 -05:00
commit 801ba54d46
2 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, appConfigService, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayAccountService, bitpayCardService, storageService, glideraService, gettextCatalog, buyAndSellService) { angular.module('copayApp.controllers').controller('tabSettingsController', function($rootScope, $timeout, $scope, appConfigService, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayAccountService, bitpayCardService, storageService, glideraService, gettextCatalog, buyAndSellService) {
var updateConfig = function() { var updateConfig = function() {
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName(); $scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
@ -20,12 +20,20 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
bitpayAccountService.getAccounts(function(err, data) { bitpayAccountService.getAccounts(function(err, data) {
if (err) $log.error(err); if (err) $log.error(err);
$scope.bitpayAccounts = !lodash.isEmpty(data); $scope.bitpayAccounts = !lodash.isEmpty(data);
$timeout(function() {
$rootScope.$apply();
}, 10);
}); });
// TODO move this to a generic service // TODO move this to a generic service
bitpayCardService.getCards(function(err, cards) { bitpayCardService.getCards(function(err, cards) {
if (err) $log.error(err); if (err) $log.error(err);
$scope.bitpayCards = cards && cards.length > 0; $scope.bitpayCards = cards && cards.length > 0;
$timeout(function() {
$rootScope.$apply();
}, 10);
}); });
}); });
}; };

View file

@ -113,7 +113,7 @@
</a> </a>
<a class=" item item-icon-left item-icon-right" <a class=" item item-icon-left item-icon-right"
ng-if="bitpayAccounts || (bitpayCardEnabled && bitpayCards)" ng-if="bitpayAccounts || bitpayCards"
ui-sref="tabs.preferences.bitpayServices"> ui-sref="tabs.preferences.bitpayServices">
<i class="icon big-icon-svg circle"> <i class="icon big-icon-svg circle">
<div class="bg icon-bitpay"></div> <div class="bg icon-bitpay"></div>