Improve Settings handling

This commit is contained in:
djmaze 2021-03-10 11:44:48 +01:00
parent e7b1ce7509
commit 34b25eedea
39 changed files with 160 additions and 150 deletions

View file

@ -1,6 +1,7 @@
import ko from 'ko';
import { Capa, StorageResultType } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import AccountStore from 'Stores/User/Account';
import { IdentityUserStore } from 'Stores/User/Identity';
@ -13,8 +14,8 @@ import { IdentityPopupView } from 'View/Popup/Identity';
export class AccountsUserSettings {
constructor() {
this.allowAdditionalAccount = rl.settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = rl.settings.capa(Capa.Identities);
this.allowAdditionalAccount = Settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = Settings.capa(Capa.Identities);
this.accounts = AccountStore.accounts;
this.identities = IdentityUserStore;

View file

@ -1,12 +1,10 @@
import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { SaveSettingsStep } from 'Common/Enums';
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin';
@ -44,7 +42,7 @@ export class GeneralUserSettings {
this.threadsAllowed = AppStore.threadsAllowed;
this.useThreads = SettingsStore.useThreads;
this.replySameFolder = SettingsStore.replySameFolder;
this.allowLanguagesOnSettings = !!rl.settings.get('AllowLanguagesOnSettings');
this.allowLanguagesOnSettings = !!SettingsGet('AllowLanguagesOnSettings');
this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin';
@ -14,8 +15,8 @@ import { TwoFactorConfigurationPopupView } from 'View/Popup/TwoFactorConfigurati
export class SecurityUserSettings {
constructor() {
this.capaAutoLogout = rl.settings.capa(Capa.AutoLogout);
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.autoLogout = SettinsStore.autoLogout;
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);

View file

@ -4,7 +4,7 @@ import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
import { changeTheme, convertThemeName } from 'Common/Utils';
import { userBackground, themePreviewLink, serverRequest } from 'Common/Links';
import { i18n } from 'Common/Translator';
import { doc, $htmlCL } from 'Common/Globals';
import { doc, $htmlCL, Settings } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
@ -23,7 +23,7 @@ export class ThemesUserSettings {
this.background.loading = ko.observable(false);
this.background.error = ko.observable('');
this.capaUserBackground = ko.observable(rl.settings.capa(Capa.UserBackground));
this.capaUserBackground = ko.observable(Settings.capa(Capa.UserBackground));
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });