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 { StorageResultType, Notification } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { getNotification } from 'Common/Translator';
import Remote from 'Remote/Admin/Fetch';
@ -12,7 +13,7 @@ class LoginAdminView extends AbstractViewCenter {
constructor() {
super('Admin/Login', 'AdminLogin');
this.hideSubmitButton = rl.settings.app('hideSubmitButton');
this.hideSubmitButton = Settings.app('hideSubmitButton');
this.addObservables({
login: '',

View file

@ -8,13 +8,13 @@ import { PackageAdminStore } from 'Stores/Admin/Package';
import { AbstractViewRight } from 'Knoin/AbstractViews';
import { leftPanelDisabled } from 'Common/Globals';
import { leftPanelDisabled, Settings } from 'Common/Globals';
class PaneSettingsAdminView extends AbstractViewRight {
constructor() {
super('Admin/Settings/Pane', 'AdminPane');
this.version = ko.observable(rl.settings.app('version'));
this.version = ko.observable(Settings.app('version'));
this.leftPanelDisabled = leftPanelDisabled;

View file

@ -22,7 +22,7 @@ import { serverRequest } from 'Common/Links';
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
import { timestampToString } from 'Common/Momentor';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { Settings } from 'Common/Globals';
import { Settings, SettingsGet } from 'Common/Globals';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
@ -1189,7 +1189,7 @@ class ComposePopupView extends AbstractViewPopup {
initUploader() {
if (this.composeUploaderButton()) {
const uploadCache = {},
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
oJua = new Jua({
action: serverRequest('Upload'),
name: 'uploader',

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { SetSystemFoldersNotification } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { Settings } from 'Common/Globals';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -50,7 +51,7 @@ class FolderSystemPopupView extends AbstractViewPopup {
this.trashFolder = FolderStore.trashFolder;
this.archiveFolder = FolderStore.archiveFolder;
const settingsSet = rl.settings.set,
const settingsSet = Settings.set,
fSetSystemFolders = () => {
settingsSet('SentFolder', FolderStore.sentFolder());
settingsSet('DraftFolder', FolderStore.draftFolder());

View file

@ -1,4 +1,5 @@
import { Capa, StorageResultType } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { pString } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
@ -33,7 +34,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
viewEnable_: false
});
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.addComputables({
viewEnable: {

View file

@ -20,8 +20,8 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
constructor(name) {
super(name, 'SystemDropDown');
this.allowSettings = !!Settings.capa(Capa.Settings);
this.allowHelp = !!Settings.capa(Capa.Help);
this.allowSettings = Settings.capa(Capa.Settings);
this.allowHelp = Settings.capa(Capa.Help);
this.currentAudio = AppStore.currentAudio;

View file

@ -19,7 +19,7 @@ import Remote from 'Remote/User/Fetch';
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewCenter } from 'Knoin/AbstractViews';
import { Settings } from 'Common/Globals';
import { Settings, SettingsGet } from 'Common/Globals';
import { LanguagesPopupView } from 'View/Popup/Languages';
@ -44,7 +44,7 @@ class LoginUserView extends AbstractViewCenter {
this.hideSubmitButton = Settings.app('hideSubmitButton');
this.addObservables({
loadingDesc: Settings.get('LoadingDescription'),
loadingDesc: SettingsGet('LoadingDescription'),
email: '',
password: '',
@ -73,7 +73,7 @@ class LoginUserView extends AbstractViewCenter {
this.formError = ko.observable(false).extend({ falseTimeout: 500 });
this.allowLanguagesOnLogin = !!Settings.get('AllowLanguagesOnLogin');
this.allowLanguagesOnLogin = !!SettingsGet('AllowLanguagesOnLogin');
this.language = LanguageStore.language;
this.languages = LanguageStore.languages;
@ -109,8 +109,8 @@ class LoginUserView extends AbstractViewCenter {
signMeType: iValue => this.signMe(LoginSignMeType.DefaultOn === iValue)
});
if (Settings.get('AdditionalLoginError') && !this.submitError()) {
this.submitError(Settings.get('AdditionalLoginError'));
if (SettingsGet('AdditionalLoginError') && !this.submitError()) {
this.submitError(SettingsGet('AdditionalLoginError'));
}
decorateKoCommands(this, {
@ -207,7 +207,7 @@ class LoginUserView extends AbstractViewCenter {
onBuild() {
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
signMe = (Settings.get('SignMe') || 'unused').toLowerCase();
signMe = (SettingsGet('SignMe') || 'unused').toLowerCase();
switch (signMe) {
case LoginSignMeTypeAsString.DefaultOff:

View file

@ -15,7 +15,7 @@ import {
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
import { doc, leftPanelDisabled, moveAction, Settings, SettingsGet } from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File';
@ -60,7 +60,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
this.iGoToUpUpOrDownDownTimeout = 0;
this.newMoveToFolder = !!Settings.get('NewMoveToFolder');
this.newMoveToFolder = !!SettingsGet('NewMoveToFolder');
this.allowReload = Settings.capa(Capa.Reload);
this.allowSearch = Settings.capa(Capa.Search);