Improvement - 172 - Make default price display in fiat
This commit is contained in:
parent
463eed2583
commit
12f1c2e28a
9 changed files with 118 additions and 2 deletions
42
src/js/controllers/preferencesPriceDisplay.js
Normal file
42
src/js/controllers/preferencesPriceDisplay.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesPriceDisplayController', function($scope, $q, $timeout, configService, $ionicNavBarDelegate) {
|
||||
|
||||
$scope.save = function(priceDisplay) {
|
||||
|
||||
if ($scope.noSave) return;
|
||||
|
||||
var opts = {
|
||||
wallet: {
|
||||
settings: {
|
||||
priceDisplay: priceDisplay
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$ionicNavBarDelegate.showBar(true);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.init();
|
||||
});
|
||||
|
||||
$scope.init = function () {
|
||||
configService.whenAvailable(function(config) {
|
||||
$scope.selectedPriceDisplay = config.wallet.settings.priceDisplay;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
@ -16,6 +16,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
|
||||
$scope.selectedPriceDisplay = config.wallet.settings.priceDisplay;
|
||||
|
||||
// TODO move this to a generic service
|
||||
bitpayAccountService.getAccounts(function(err, data) {
|
||||
if (err) $log.error(err);
|
||||
|
|
|
|||
|
|
@ -367,6 +367,15 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
||||
configService.whenAvailable(function (config) {
|
||||
$scope.selectedPriceDisplay = config.wallet.settings.priceDisplay;
|
||||
|
||||
$timeout(function () {
|
||||
$scope.apply();
|
||||
});
|
||||
});
|
||||
|
||||
$scope.walletId = data.stateParams.walletId;
|
||||
$scope.wallet = profileService.getWallet($scope.walletId);
|
||||
if (!$scope.wallet) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue