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
parent efd92f5d4a
commit 801ba54d46
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
'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() {
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
@ -20,12 +20,20 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
bitpayAccountService.getAccounts(function(err, data) {
if (err) $log.error(err);
$scope.bitpayAccounts = !lodash.isEmpty(data);
$timeout(function() {
$rootScope.$apply();
}, 10);
});
// TODO move this to a generic service
bitpayCardService.getCards(function(err, cards) {
if (err) $log.error(err);
$scope.bitpayCards = cards && cards.length > 0;
$timeout(function() {
$rootScope.$apply();
}, 10);
});
});
};

View File

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