removed app-model prepare

This commit is contained in:
antelle 2020-05-05 16:34:39 +02:00
parent 52741cf46a
commit ffdc438091
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
3 changed files with 16 additions and 15 deletions

View File

@ -25,6 +25,8 @@ import { KdbxwebInit } from 'util/kdbxweb/kdbxweb-init';
import { Locale } from 'util/locale';
import { AppView } from 'views/app-view';
import 'hbs-helpers';
import { AutoType } from './auto-type';
import { Storage } from './storage';
StartProfiler.milestone('loading modules');
@ -41,6 +43,7 @@ ready(() => {
.then(initModules)
.then(loadRemoteConfig)
.then(ensureCanRun)
.then(initStorage)
.then(showApp)
.then(postInit)
.catch(e => {
@ -87,6 +90,7 @@ ready(() => {
PopupNotifier.init();
KdbxwebInit.init();
FocusDetector.init();
AutoType.init();
window.kw = ExportApi;
return PluginManager.init().then(() => {
StartProfiler.milestone('initializing modules');
@ -128,6 +132,13 @@ ready(() => {
});
}
function initStorage() {
for (const prv of Object.values(Storage)) {
prv.init();
}
StartProfiler.milestone('initializing storage');
}
function showApp() {
return Promise.resolve().then(() => {
const skipHttpsWarning =
@ -169,9 +180,6 @@ ready(() => {
}
function showView() {
appModel.prepare();
StartProfiler.milestone('preparing app model');
new AppView(appModel).render();
StartProfiler.milestone('first view rendering');

View File

@ -6,6 +6,7 @@ import { Launcher } from 'comp/launcher';
import { Alerts } from 'comp/ui/alerts';
import { Timeouts } from 'const/timeouts';
import { AppSettingsModel } from 'models/app-settings-model';
import { AppModel } from 'models/app-model';
import { Locale } from 'util/locale';
import { Logger } from 'util/logger';
import { AutoTypeSelectView } from 'views/auto-type/auto-type-select-view';
@ -20,11 +21,10 @@ const AutoType = {
pendingEvent: null,
running: false,
init(appModel) {
init() {
if (!this.enabled) {
return;
}
this.appModel = appModel;
Events.on('auto-type', e => this.handleEvent(e));
Events.on('main-window-blur', e => this.resetPendingEvent(e));
Events.on('main-window-will-close', e => this.resetPendingEvent(e));
@ -206,9 +206,9 @@ const AutoType = {
selectEntryAndRun() {
this.getActiveWindowInfo((e, windowInfo) => {
const filter = new AutoTypeFilter(windowInfo, this.appModel);
const filter = new AutoTypeFilter(windowInfo, AppModel.instance);
const evt = { filter, windowInfo };
if (!this.appModel.files.hasOpenFiles()) {
if (!AppModel.instance.files.hasOpenFiles()) {
this.pendingEvent = evt;
logger.debug('auto-type event delayed');
this.focusMainWindow();

View File

@ -47,14 +47,7 @@ class AppModel {
Events.on('unset-keyfile', this.unsetKeyFile.bind(this));
this.appLogger = new Logger('app');
AppModel.instance = this; // For KeeWebHttp. TODO: kill this
}
prepare() {
AutoType.init(this);
for (const prv of Object.values(Storage)) {
prv.init();
}
AppModel.instance = this;
}
loadConfig(configLocation) {