showing N/A when rate services not available

This commit is contained in:
Ivan Socolsky 2014-11-07 13:00:40 -03:00
parent 692852617f
commit b8e7613822
4 changed files with 12 additions and 8 deletions

View File

@ -34,7 +34,7 @@ angular.module('copayApp.controllers').controller('MoreController',
name: w.settings.alternativeName, name: w.settings.alternativeName,
isoCode: w.settings.alternativeIsoCode isoCode: w.settings.alternativeIsoCode
}; };
$scope.alternativeOpts = rateService.isAvailable ? $scope.alternativeOpts = rateService.isAvailable() ?
rateService.listAlternatives() : [$scope.selectedAlternative]; rateService.listAlternatives() : [$scope.selectedAlternative];
rateService.whenAvailable(function() { rateService.whenAvailable(function() {

View File

@ -270,15 +270,18 @@ angular.module('copayApp.services')
} }
r.balanceByAddr = balanceByAddr; r.balanceByAddr = balanceByAddr;
root.updateAddressList(); root.updateAddressList();
r.updatingBalance = false;
rateService.whenAvailable(function() { if (rateService.isAvailable()) {
r.totalBalanceAlternative = rateService.toFiat(balanceSat, w.settings.alternativeIsoCode); r.totalBalanceAlternative = rateService.toFiat(balanceSat, w.settings.alternativeIsoCode);
r.alternativeIsoCode = w.settings.alternativeIsoCode; r.alternativeIsoCode = w.settings.alternativeIsoCode;
r.lockedBalanceAlternative = rateService.toFiat(balanceSat - safeBalanceSat, w.settings.alternativeIsoCode); r.lockedBalanceAlternative = rateService.toFiat(balanceSat - safeBalanceSat, w.settings.alternativeIsoCode);
r.alternativeConversionRate = rateService.toFiat(100000000, w.settings.alternativeIsoCode); r.alternativeConversionRate = rateService.toFiat(100000000, w.settings.alternativeIsoCode);
return cb(null, r) r.alternativeBalanceAvailable = true;
}); };
r.updatingBalance = false;
return cb(null, r)
}); });
}; };

View File

@ -20,9 +20,9 @@
</strong> </strong>
</span> </span>
<span class="size-14 db m5t text-gray"> <span class="size-14 db m5t text-gray">
<span ng-if="!$root.updatingBalance">{{totalBalanceAlternative |noFractionNumber:2}}</span> <span ng-if="!$root.updatingBalance && alternativeBalanceAvailable">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
<span ng-if="!$root.updatingBalance && !alternativeBalanceAvailable">N/A</span>
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span> <span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
{{alternativeIsoCode}}
</span> </span>
</div> </div>
</div> </div>

View File

@ -15,7 +15,8 @@
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span> <span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
<div ng-if="$root.wallet && !$root.updatingBalance" data-options="disable_for_touch:true"> <div ng-if="$root.wallet && !$root.updatingBalance" data-options="disable_for_touch:true">
<b class="m5r">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b> <b class="m5r">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b>
<span class="alt-currency">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span> <span ng-if="alternativeBalanceAvailable" class="alt-currency">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
<span ng-if="!alternativeBalanceAvailable" class="alt-currency">N/A</span>
</div> </div>
</div> </div>
</div> </div>