Improved boot.js with existing global window.rl

Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
djmaze 2020-09-04 12:05:17 +02:00
parent f90dbcc84b
commit aeb5275648
57 changed files with 284 additions and 380 deletions

View file

@ -3,8 +3,6 @@ import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import { getApp } from 'Helper/Apps/Admin';
@ -21,10 +19,11 @@ class LoginAdminView extends AbstractViewNext {
constructor() {
super();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
const appSettingsGet = rl.settings.app;
this.mobile = !!appSettingsGet('mobile');
this.mobileDevice = !!appSettingsGet('mobileDevice');
this.hideSubmitButton = Settings.appSettingsGet('hideSubmitButton') ? '' : null;
this.hideSubmitButton = appSettingsGet('hideSubmitButton') ? '' : null;
this.login = ko.observable('');
this.password = ko.observable('');

View file

@ -1,7 +1,5 @@
import ko from 'ko';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import DomainStore from 'Stores/Admin/Domain';
@ -22,7 +20,7 @@ class PaneSettingsAdminView extends AbstractViewNext {
constructor() {
super();
this.version = ko.observable(Settings.appSettingsGet('version'));
this.version = ko.observable(rl.settings.app('version'));
this.adminManLoading = ko.computed(
() =>

View file

@ -39,8 +39,6 @@ import MessageStore from 'Stores/User/Message';
import Remote from 'Remote/User/Ajax';
import * as Settings from 'Storage/Settings';
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
import { getApp } from 'Helper/Apps/User';
@ -48,6 +46,8 @@ import { getApp } from 'Helper/Apps/User';
import { popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const Settings = rl.settings;
@popup({
name: 'View/Popup/Compose',
templateID: 'PopupsCompose'
@ -1138,7 +1138,7 @@ class ComposePopupView extends AbstractViewNext {
});
}
if (Settings.appSettingsGet('allowCtrlEnterOnCompose')) {
if (Settings.app('allowCtrlEnterOnCompose')) {
key('ctrl+enter, command+enter', KeyState.Compose, () => {
this.sendCommand();
return false;
@ -1184,7 +1184,7 @@ class ComposePopupView extends AbstractViewNext {
initUploader() {
if (this.composeUploaderButton()) {
const uploadCache = {},
attachmentSizeLimit = pInt(Settings.settingsGet('AttachmentLimit')),
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
oJua = new Jua({
action: upload(),
name: 'uploader',

View file

@ -30,8 +30,6 @@ import ContactStore from 'Stores/User/Contact';
import Remote from 'Remote/User/Ajax';
import * as Settings from 'Storage/Settings';
import { EmailModel } from 'Model/Email';
import { ContactModel } from 'Model/Contact';
import { ContactPropertyModel } from 'Model/ContactProperty';
@ -221,7 +219,7 @@ class ContactsPopupView extends AbstractViewNext {
@command((self) => 0 < self.contactsCheckedOrSelected().length)
newMessageCommand() {
if (!Settings.capa(Capa.Composer)) {
if (!rl.settings.capa(Capa.Composer)) {
return false;
}
@ -658,7 +656,7 @@ class ContactsPopupView extends AbstractViewNext {
if (this.bBackToCompose) {
this.bBackToCompose = false;
if (Settings.capa(Capa.Composer)) {
if (rl.settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'));
}
}

View file

@ -7,7 +7,6 @@ import { initOnStartOrLangChange, i18n } from 'Common/Translator';
import FolderStore from 'Stores/User/Folder';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax';
import { popup } from 'Knoin/Knoin';
@ -55,12 +54,13 @@ class FolderSystemPopupView extends AbstractViewNext {
this.trashFolder = FolderStore.trashFolder;
this.archiveFolder = FolderStore.archiveFolder;
const fSetSystemFolders = () => {
Settings.settingsSet('SentFolder', FolderStore.sentFolder());
Settings.settingsSet('DraftFolder', FolderStore.draftFolder());
Settings.settingsSet('SpamFolder', FolderStore.spamFolder());
Settings.settingsSet('TrashFolder', FolderStore.trashFolder());
Settings.settingsSet('ArchiveFolder', FolderStore.archiveFolder());
const settingsSet = rl.settings.set,
fSetSystemFolders = () => {
settingsSet('SentFolder', FolderStore.sentFolder());
settingsSet('DraftFolder', FolderStore.draftFolder());
settingsSet('SpamFolder', FolderStore.spamFolder());
settingsSet('TrashFolder', FolderStore.trashFolder());
settingsSet('ArchiveFolder', FolderStore.archiveFolder());
},
fSaveSystemFolders = (()=>{
fSetSystemFolders();

View file

@ -4,8 +4,6 @@ import { Capa, StorageResultType } from 'Common/Enums';
import { pString } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax';
import { getApp } from 'Helper/Apps/User';
@ -23,7 +21,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
this.lock = ko.observable(false);
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
this.processing = ko.observable(false);
this.clearing = ko.observable(false);

View file

@ -7,22 +7,23 @@ import MessageStore from 'Stores/User/Message';
import { Capa, KeyState } from 'Common/Enums';
import { settings } from 'Common/Links';
import * as Settings from 'Storage/Settings';
import { getApp } from 'Helper/Apps/User';
import { showScreenPopup, setHash } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const Settings = rl.settings;
class AbstractSystemDropDownUserView extends AbstractViewNext {
constructor() {
super();
this.logoImg = (Settings.settingsGet('UserLogo')||'').trim();
this.logoTitle = (Settings.settingsGet('UserLogoTitle')||'').trim();
this.logoImg = (Settings.get('UserLogo')||'').trim();
this.logoTitle = (Settings.get('UserLogoTitle')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
this.mobile = !!Settings.app('mobile');
this.mobileDevice = !!Settings.app('mobileDevice');
this.allowSettings = !!Settings.capa(Capa.Settings);
this.allowHelp = !!Settings.capa(Capa.Help);

View file

@ -15,7 +15,6 @@ import { getNotification, getNotificationFromResponse, reload as translatorReloa
import AppStore from 'Stores/User/App';
import LanguageStore from 'Stores/Language';
import * as Settings from 'Storage/Settings';
import * as Local from 'Storage/Client';
import Remote from 'Remote/User/Ajax';
@ -25,6 +24,8 @@ import { getApp } from 'Helper/Apps/User';
import { view, command, ViewType, routeOff, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const Settings = rl.settings;
@view({
name: ['View/App/Login', 'View/User/Login'],
type: ViewType.Center,
@ -34,9 +35,9 @@ class LoginUserView extends AbstractViewNext {
constructor() {
super();
this.hideSubmitButton = Settings.appSettingsGet('hideSubmitButton') ? '' : null;
this.hideSubmitButton = Settings.app('hideSubmitButton') ? '' : null;
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
this.welcome = ko.observable(!!Settings.get('UseLoginWelcomePage'));
this.email = ko.observable('');
this.password = ko.observable('');
@ -48,14 +49,14 @@ class LoginUserView extends AbstractViewNext {
this.additionalCode.visibility = ko.observable(false);
this.additionalCodeSignMe = ko.observable(false);
this.logoImg = (Settings.settingsGet('LoginLogo')||'').trim();
this.loginDescription = (Settings.settingsGet('LoginDescription')||'').trim();
this.logoImg = (Settings.get('LoginLogo')||'').trim();
this.loginDescription = (Settings.get('LoginDescription')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
this.mobile = !!Settings.app('mobile');
this.mobileDevice = !!Settings.app('mobileDevice');
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
this.forgotPasswordLinkUrl = Settings.app('forgotPasswordLinkUrl');
this.registrationLinkUrl = Settings.app('registrationLinkUrl');
this.emailError = ko.observable(false);
this.passwordError = ko.observable(false);
@ -130,8 +131,8 @@ class LoginUserView extends AbstractViewNext {
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
this.submitError(Settings.settingsGet('AdditionalLoginError'));
if (Settings.get('AdditionalLoginError') && !this.submitError()) {
this.submitError(Settings.get('AdditionalLoginError'));
}
}
@ -231,7 +232,7 @@ class LoginUserView extends AbstractViewNext {
onBuild() {
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase();
signMe = (Settings.get('SignMe') || 'unused').toLowerCase();
switch (signMe) {
case LoginSignMeTypeAsString.DefaultOff:

View file

@ -10,13 +10,13 @@ import SettingsStore from 'Stores/User/Settings';
import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import * as Settings from 'Storage/Settings';
import { getApp } from 'Helper/Apps/User';
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const Settings = rl.settings;
@view({
name: 'View/User/MailBox/FolderList',
type: ViewType.Left,
@ -60,7 +60,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
onBuild(dom) {
const qs = s => dom.querySelector(s),
eqs = (ev, s) => ev.target.closestWithin(s, dom),
isMobile = Settings.appSettingsGet('mobile'),
isMobile = Settings.app('mobile'),
fSelectFolder = (el, event, starred) => {
const isMove = moveAction();
if (isMobile) {

View file

@ -35,7 +35,6 @@ import SettingsStore from 'Stores/User/Settings';
import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax';
import { getApp } from 'Helper/Apps/User';
@ -44,6 +43,7 @@ import { view, command, ViewType, showScreenPopup, setHash, popupVisibility } fr
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const
Settings = rl.settings,
canBeMovedHelper = (self) => self.canBeMoved(),
ifvisible = window.ifvisible;
@ -62,7 +62,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.iGoToUpUpOrDownDownTimeout = 0;
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobile = !!Settings.app('mobile');
this.newMoveToFolder = AppStore.newMoveToFolder;
this.allowReload = !!Settings.capa(Capa.Reload);
@ -944,7 +944,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
}
initUploaderForAppend() {
if (!Settings.appSettingsGet('allowAppendMessage') || !this.dragOverArea()) {
if (!Settings.app('allowAppendMessage') || !this.dragOverArea()) {
return false;
}

View file

@ -38,7 +38,6 @@ import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import * as Local from 'Storage/Client';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax';
import Promises from 'Promises/User/Ajax';
@ -48,6 +47,8 @@ import { getApp } from 'Helper/Apps/User';
import { view, command, ViewType, showScreenPopup, createCommand } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const Settings = rl.settings;
@view({
name: 'View/User/MailBox/MessageView',
type: ViewType.Right,
@ -87,10 +88,10 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.logoImg = (Settings.settingsGet('UserLogoMessage')||'').trim();
this.logoIframe = (Settings.settingsGet('UserIframeMessage')||'').trim();
this.logoImg = (Settings.get('UserLogoMessage')||'').trim();
this.logoIframe = (Settings.get('UserIframeMessage')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobile = !!Settings.app('mobile');
this.attachmentsActions = AppStore.attachmentsActions;

View file

@ -3,8 +3,6 @@ import { leftPanelDisabled } from 'Common/Globals';
import { settings, inbox } from 'Common/Links';
import { getFolderInboxName } from 'Common/Cache';
import * as Settings from 'Storage/Settings';
import { view, ViewType, setHash, settingsMenuKeysHandler } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -22,7 +20,7 @@ class MenuSettingsUserView extends AbstractViewNext {
this.leftPanelDisabled = leftPanelDisabled;
this.mobile = Settings.appSettingsGet('mobile');
this.mobile = rl.settings.app('mobile');
this.menu = screen.menu;
}

View file

@ -2,8 +2,6 @@ import { inbox } from 'Common/Links';
import { getFolderInboxName } from 'Common/Cache';
import { leftPanelDisabled } from 'Common/Globals';
import * as Settings from 'Storage/Settings';
import MessageStore from 'Stores/User/Message';
import { view, ViewType, setHash } from 'Knoin/Knoin';
@ -18,7 +16,7 @@ class PaneSettingsUserView extends AbstractViewNext {
constructor() {
super();
this.mobile = Settings.appSettingsGet('mobile');
this.mobile = rl.settings.app('mobile');
this.leftPanelDisabled = leftPanelDisabled;
}