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

View file

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