From 6efb17515a060cbb58b03d27feb5ed7be13b70b1 Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Tue, 4 Oct 2016 23:42:39 -0400 Subject: [PATCH] feature(tour): fetch USDBTC rate for tour graphic --- public/views/onboarding/tour.html | 2 +- src/js/controllers/onboarding/tour.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/public/views/onboarding/tour.html b/public/views/onboarding/tour.html index 2e93309bc..a2bcf7b15 100644 --- a/public/views/onboarding/tour.html +++ b/public/views/onboarding/tour.html @@ -30,7 +30,7 @@

Bitcoin is a currency.

You can trade it for other currencies like US Dollars, Euros, or Pounds.

-
1 BTC = $1,000
+
1 BTC = {{localCurrencySymbol}}{{localCurrencyPerBtc}}

The exchange rate changes with the market.

diff --git a/src/js/controllers/onboarding/tour.js b/src/js/controllers/onboarding/tour.js index 2590d8074..aa2cdd92e 100644 --- a/src/js/controllers/onboarding/tour.js +++ b/src/js/controllers/onboarding/tour.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.controllers').controller('tourController', - function($scope, $state, $log, $timeout, ongoingProcess, profileService) { + function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService) { var tries = 0; @@ -17,6 +17,14 @@ angular.module('copayApp.controllers').controller('tourController', } }; + rateService.whenAvailable(function() { + var localCurrency = 'USD'; + var btcAmount = 1; + var rate = rateService.toFiat(btcAmount * 1e8, localCurrency); + $scope.localCurrencySymbol = '$'; + $scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10)); + }); + $scope.createDefaultWallet = function() { ongoingProcess.set('creatingWallet', true); profileService.createDefaultWallet(function(err, walletClient) {