bwc
This commit is contained in:
parent
04fb7ba032
commit
320de62f13
348 changed files with 7745 additions and 30874 deletions
57
src/js/controllers/preferencesAltCurrency.js
Normal file
57
src/js/controllers/preferencesAltCurrency.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
|
||||
function($scope, $rootScope, configService, go, rateService, lodash) {
|
||||
this.hideAdv = true;
|
||||
this.hidePriv = true;
|
||||
this.hideSecret = true;
|
||||
this.error = null;
|
||||
this.success = null;
|
||||
|
||||
var config = configService.getSync();
|
||||
|
||||
this.selectedAlternative = {
|
||||
name: config.wallet.settings.alternativeName,
|
||||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
|
||||
this.alternativeOpts = [this.selectedAlternative]; //default value
|
||||
|
||||
var self = this;
|
||||
rateService.whenAvailable(function() {
|
||||
self.alternativeOpts = rateService.listAlternatives();
|
||||
lodash.remove(self.alternativeOpts, function(n) {
|
||||
return n.isoCode == 'BTC';
|
||||
});
|
||||
|
||||
for (var ii in self.alternativeOpts) {
|
||||
if (config.wallet.settings.alternativeIsoCode === self.alternativeOpts[ii].isoCode) {
|
||||
self.selectedAlternative = self.alternativeOpts[ii];
|
||||
}
|
||||
}
|
||||
$scope.$digest();
|
||||
});
|
||||
|
||||
|
||||
this.save = function(newAltCurrency) {
|
||||
var opts = {
|
||||
wallet: {
|
||||
settings: {
|
||||
alternativeName: newAltCurrency.name,
|
||||
alternativeIsoCode: newAltCurrency.isoCode,
|
||||
}
|
||||
}
|
||||
};
|
||||
this.selectedAlternative = {
|
||||
name: newAltCurrency.name,
|
||||
isoCode: newAltCurrency.isoCode,
|
||||
};
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) console.log(err);
|
||||
$scope.$emit('Local/ConfigurationUpdated');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue