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

@ -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;
}