Cleanup AppUser and AdminApp

This commit is contained in:
the-djmaze 2022-03-31 17:39:53 +02:00
parent cf3801cba0
commit 893364d52d
5 changed files with 20 additions and 24 deletions

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { Settings, SettingsGet } from 'Common/Globals';
import { changeTheme } from 'Common/Utils';
import { Settings } from 'Common/Globals';
import { logoutLink } from 'Common/Links';
import { i18nToNodes, initOnStartOrLangChange } from 'Common/Translator';
@ -33,17 +32,6 @@ export class AbstractApp {
}
}
refresh() {
// rl.adminArea() || !translatorReload(false, );
rl.adminArea() || (
LanguageStore.language(SettingsGet('Language'))
& ThemeStore.populate()
& changeTheme(SettingsGet('Theme'))
);
this.start();
}
bootstart() {
const register = (key, ClassObject, templateID) => ko.components.register(key, {
template: { element: templateID || (key + 'Component') },

View file

@ -10,12 +10,16 @@ import { LoginAdminScreen } from 'Screen/Admin/Login';
import { startScreens } from 'Knoin/Knoin';
import { AbstractApp } from 'App/Abstract';
class AdminApp extends AbstractApp {
export class AdminApp extends AbstractApp {
constructor() {
super(Remote);
this.weakPassword = ko.observable(false);
}
refresh() {
this.start();
}
start() {
if (!Settings.app('adminAllowed')) {
rl.route.root();
@ -28,5 +32,3 @@ class AdminApp extends AbstractApp {
}
}
}
export default new AdminApp();

View file

@ -1,6 +1,6 @@
import 'External/User/ko';
import { isArray, pString } from 'Common/Utils';
import { isArray, pString, changeTheme } from 'Common/Utils';
import { mailToHelper, setLayoutResizer, dropdownsDetectVisibility } from 'Common/UtilsUser';
import {
@ -41,6 +41,7 @@ import { FolderUserStore } from 'Stores/User/Folder';
import { PgpUserStore } from 'Stores/User/Pgp';
import { MessagelistUserStore } from 'Stores/User/Messagelist';
import { ThemeStore } from 'Stores/Theme';
import { LanguageStore } from 'Stores/Language';
import Remote from 'Remote/User/Fetch';
@ -68,7 +69,7 @@ import {
} from 'Common/Folders';
import { loadFolders } from 'Model/FolderCollection';
class AppUser extends AbstractApp {
export class AppUser extends AbstractApp {
constructor() {
super(Remote);
@ -93,6 +94,13 @@ class AppUser extends AbstractApp {
addEventListener('click', dropdownsDetectVisibility);
}
refresh() {
LanguageStore.language(SettingsGet('Language'));
ThemeStore.populate();
changeTheme(SettingsGet('Theme'));
this.start();
}
/**
* @param {number} iDeleteType
* @param {string} sFromFolderFullName
@ -376,5 +384,3 @@ class AppUser extends AbstractApp {
showScreenPopup(ComposePopupView, params);
}
}
export default new AppUser();

View file

@ -1,4 +1,4 @@
import bootstrap from 'bootstrap';
import App from 'App/Admin';
import { AdminApp } from 'App/Admin';
bootstrap(App);
bootstrap(new AdminApp);

View file

@ -1,4 +1,4 @@
import bootstrap from 'bootstrap';
import App from 'App/User';
import { AppUser } from 'App/User';
bootstrap(App);
bootstrap(new AppUser);