Fix language selection - IOs

This commit is contained in:
Javier 2016-06-09 17:20:17 -03:00
commit 66fc3fe416
2 changed files with 15 additions and 26 deletions

View file

@ -1,20 +1,12 @@
<div <div class="topbar-container" ng-include="'views/includes/topbar.html'"
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Language'; goBackToState = 'preferencesGlobal'; noColor = true"> ng-init="titleSection='Language'; goBackToState = 'preferencesGlobal'; noColor = true">
</div> </div>
<div class="content preferences" ng-controller="preferencesLanguageController as prefLang" ng-init="prefLang.init()">
<div class="content preferences" ng-controller="preferencesLanguageController as prefLang">
<h4></h4> <h4></h4>
<ul class="no-bullet m0 ">
<li <ion-radio class="line-b size-12" ng-repeat="lang in prefLang.availableLanguages" ng-value="lang.isoCode" ng-model="data.currentLanguage"
ng-repeat="lang in prefLang.availableLanguages" ng-click="prefLang.save(lang.isoCode)">{{lang.name}}
ng-click="prefLang.save(lang.isoCode)" class="line-b p20 size-14"> </ion-radio>
<span>{{lang.name}}</span>
<i class="fi-check size-16 right" ng-show="prefLang.currentLanguage == lang.isoCode"></i>
</li>
</ul>
</div> </div>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View file

@ -3,11 +3,14 @@
angular.module('copayApp.controllers').controller('preferencesLanguageController', angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, $timeout, configService, profileService, uxLanguage, walletService, go) { function($scope, $log, $timeout, configService, profileService, uxLanguage, walletService, go) {
this.availableLanguages = uxLanguage.getLanguages(); this.init = function() {
this.currentLanguage = uxLanguage.getCurrentLanguage(); this.availableLanguages = uxLanguage.getLanguages();
$scope.data = {
currentLanguage: uxLanguage.getCurrentLanguage()
};
};
this.save = function(newLang) { this.save = function(newLang) {
var opts = { var opts = {
wallet: { wallet: {
settings: { settings: {
@ -20,16 +23,10 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
if (err) $log.warn(err); if (err) $log.warn(err);
go.preferencesGlobal(); go.preferencesGlobal();
uxLanguage.update(function() { uxLanguage.update(function() {
$timeout(function() { walletService.updateRemotePreferences(profileService.getClients(), {}, function() {
$scope.$apply(); $log.debug('Remote preferences saved');
}, 100); });
walletService.updateRemotePreferences(profileService.getClients(), {},
function() {
$log.debug('Remote preferences saved');
});
}); });
}); });
}; };