Merge pull request #5650 from ajp8164/bug/pair-cleanup

Remove html from popup messages. Refresh view after card or account r…
This commit is contained in:
Gustavo Maximiliano Cortez 2017-02-22 14:41:01 -03:00 committed by GitHub
commit e74ceecdc5
4 changed files with 21 additions and 20 deletions

View file

@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('preferencesBitpayServicesCont
$scope.removeAccount = function(account) { $scope.removeAccount = function(account) {
var title = gettextCatalog.getString('Remove BitPay Account?'); var title = gettextCatalog.getString('Remove BitPay Account?');
var msg = gettextCatalog.getString('Removing your BitPay account will remove all associated BitPay account data from this device.<br/><br/>Are you sure you would like to remove your BitPay Account ({{email}}) from this device?', { var msg = gettextCatalog.getString('Removing your BitPay account will remove all associated BitPay account data from this device. Are you sure you would like to remove your BitPay Account ({{email}}) from this device?', {
email: account.email email: account.email
}); });
popupService.showConfirm(title, msg, null, null, function(res) { popupService.showConfirm(title, msg, null, null, function(res) {
@ -64,6 +64,9 @@ angular.module('copayApp.controllers').controller('preferencesBitpayServicesCont
if (cb) { if (cb) {
cb(); cb();
} }
$timeout(function(){
$rootScope.$apply();
}, 10);
}); });
}); });
}; };

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();
@ -16,27 +16,25 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
isoCode: config.wallet.settings.alternativeIsoCode isoCode: config.wallet.settings.alternativeIsoCode
}; };
$scope.bitpayCardEnabled = config.bitpayCard.enabled; // TODO move this to a generic service
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
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);
}); });
if ($scope.bitpayCardEnabled) { // 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;
});
}
if ($scope.glideraEnabled) { $timeout(function() {
storageService.getGlideraToken(glideraService.getEnvironment(), function(err, token) { $rootScope.$apply();
if (err) $log.error(err); }, 10);
$scope.glideraToken = token;
}); });
}
}); });
}; };

View file

@ -68,7 +68,7 @@ angular.module('copayApp.services').factory('bitpayAccountService', function($lo
var title = gettextCatalog.getString('Add BitPay Account?'); var title = gettextCatalog.getString('Add BitPay Account?');
var msgDetail = 'Add this BitPay account ({{email}})?'; var msgDetail = 'Add this BitPay account ({{email}})?';
if (pairingReason) { if (pairingReason) {
msgDetail = 'To {{reason}} you must first add your BitPay account.<br/><br/>{{email}}'; msgDetail = 'To {{reason}} you must first add your BitPay account - {{email}}';
} }
var msg = gettextCatalog.getString(msgDetail, { var msg = gettextCatalog.getString(msgDetail, {
reason: pairingReason, reason: pairingReason,

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>