Merge pull request #308 from Bitcoin-com/wallet/task/490

Bug - 490 - Korean Won isn't automatically selected when phone is in Korean (fiat currency)
This commit is contained in:
Jean-Baptiste Dominguez 2018-09-04 15:27:32 +09:00 committed by GitHub
commit ce3fcacac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tourController', angular.module('copayApp.controllers').controller('tourController',
function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService, popupService, gettextCatalog, startupService, storageService, walletService, $q) { function ($scope, $state, $log, $timeout, $filter, ongoingProcess, configService, profileService, rateService, popupService, gettextCatalog, lodash, startupService, storageService, uxLanguage, walletService, $q) {
$scope.data = { $scope.data = {
index: 0 index: 0
@ -46,6 +46,28 @@ angular.module('copayApp.controllers').controller('tourController',
creatingWallet = true; creatingWallet = true;
ongoingProcess.set('creatingWallet', true); ongoingProcess.set('creatingWallet', true);
$timeout(function() { $timeout(function() {
uxLanguage.init(function(lang) {
var rateCode = uxLanguage.getRateCode(lang);
console.log("When Available: rateService");
rateService.whenAvailable(function() {
var alternatives = rateService.listAlternatives(true);
var newAltCurrency = lodash.find(alternatives, {
'isoCode': rateCode
});
configService.whenAvailable(function(config) {
var opts = {
wallet: {
settings: {
alternativeName: newAltCurrency.name,
alternativeIsoCode: newAltCurrency.isoCode,
}
}
};
configService.set(opts, function(err) {
if (err) $log.warn(err);
profileService.createDefaultWallet(function(err, walletClients) { profileService.createDefaultWallet(function(err, walletClients) {
if (err) { if (err) {
$log.warn(err); $log.warn(err);
@ -64,7 +86,8 @@ angular.module('copayApp.controllers').controller('tourController',
return $scope.createDefaultWallet(); return $scope.createDefaultWallet();
} }
}, 2000); }, 2000);
}; }
;
ongoingProcess.set('creatingWallet', false); ongoingProcess.set('creatingWallet', false);
var bchWallet = walletClients[0]; var bchWallet = walletClients[0];
@ -102,6 +125,11 @@ angular.module('copayApp.controllers').controller('tourController',
$state.go('tabs.home'); $state.go('tabs.home');
}); });
}); });
});
});
$log.debug('Setting default currency : ' + newAltCurrency);
});
})
}, 300); }, 300);
}; };
}); });