Improvement - 247 - Wallet should default currency based on language selected
This commit is contained in:
parent
eba2a19ca2
commit
463eed2583
2 changed files with 62 additions and 7 deletions
|
|
@ -1199,11 +1199,46 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
});
|
||||
})
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, startupService, ionicToast, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, emailService, /* plugins START HERE => */ buydotbitcoindotcomService, glideraService, amazonService, bitpayCardService, applicationService, mercadoLibreService) {
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, startupService, ionicToast, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, emailService, /* plugins START HERE => */ buydotbitcoindotcomService, glideraService, amazonService, bitpayCardService, applicationService, mercadoLibreService, rateService) {
|
||||
|
||||
$ionicPlatform.ready(function() {
|
||||
|
||||
// Init language
|
||||
uxLanguage.init(function (lang) {
|
||||
|
||||
uxLanguage.init();
|
||||
// Try to load the profile
|
||||
profileService.loadAndBindProfile(function(err) {
|
||||
|
||||
// If err, first time so I define the currency rate by language
|
||||
if (err) {
|
||||
var rateCode = uxLanguage.getRateCode(lang);
|
||||
|
||||
$ionicPlatform.ready(function() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
$log.debug('Setting default currency : ' + newAltCurrency);
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
if (screen.width < 768 && platformInfo.isCordova)
|
||||
screen.lockOrientation('portrait');
|
||||
|
||||
|
|
@ -1278,6 +1313,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
$log.debug('No profile... redirecting');
|
||||
$state.go('onboarding.tour');
|
||||
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
|
||||
$scope.setRateByLanguage();
|
||||
if (lodash.isEmpty(profileService.getWallets())) {
|
||||
$log.debug('No wallets and no disclaimer... redirecting');
|
||||
$state.go('onboarding.tour');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue