1
0
mirror of https://github.com/NicolasConstant/sengi synced 2025-01-31 02:37:10 +01:00

fix language saving

This commit is contained in:
Nicolas Constant 2023-08-03 22:44:14 -04:00
parent 98e7d54c33
commit 503cb6c9d4
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 13 additions and 2 deletions

View File

@ -57,7 +57,7 @@
<button (click)="onRemoveLang(l)">remove</button>
</div>
<div class="sub-section">
<input type="text" (input)="onSearchLang($event.target.value)" />
<input type="text" (input)="onSearchLang($event.target.value)" [(ngModel)]="searchLang" />
</div>
<div *ngFor="let l of searchedLangs">
{{ l.iso639 }}

View File

@ -137,14 +137,23 @@ export class SettingsComponent implements OnInit {
configuredLangs: ILanguage[] = [];
searchedLangs: ILanguage[] = [];
searchLang: string;
onSearchLang(input: string) {
console.warn(input);
this.searchedLangs = this.languageService.searchLanguage(input);
}
onAddLang(lang: ILanguage): boolean {
if(this.configuredLangs.find(x => x.iso639 === lang.iso639)) return false;
this.configuredLangs.push(lang);
this.languageService.addLanguage(lang);
this.searchLang = '';
this.searchedLangs.length = 0;
return false;
}

View File

@ -10,7 +10,8 @@ export class LanguageService {
}
getConfiguredLanguages(): ILanguage[] {
return this.settingsService.getSettings().configuredLanguages;
const langs = this.settingsService.getSettings().configuredLanguages;
return langs;
}
addLanguage(lang: ILanguage){

View File

@ -178,6 +178,7 @@ export class SettingsState {
newSettings.autoFollowOnListEnabled = oldSettings.autoFollowOnListEnabled;
newSettings.twitterBridgeEnabled = oldSettings.twitterBridgeEnabled;
newSettings.twitterBridgeInstance = oldSettings.twitterBridgeInstance;
newSettings.configuredLanguages = oldSettings.configuredLanguages;
return newSettings;
}