open window before loading becca

This commit is contained in:
zadam
2022-11-23 23:31:05 +01:00
parent 723db97094
commit 2fbcd9aaf7
8 changed files with 32 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ const sqlInit = require('./src/services/sql_init');
const appIconService = require('./src/services/app_icon');
const windowService = require('./src/services/window');
const tray = require('./src/services/tray');
const beccaLoader = require("./src/becca/becca_loader");
// Adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();
@@ -28,14 +29,17 @@ app.on('ready', async () => {
// if db is not initialized -> setup process
// if db is initialized, then we need to wait until the migration process is finished
if (sqlInit.isDbInitialized()) {
await sqlInit.dbReady;
// first let electron open the window, it will probably keep initializing for some time in async
windowService.createMainWindow(app);
await windowService.createMainWindow(app);
// then becca load will block the backend process for a while
await sqlInit.dbReady;
beccaLoader.loadInitially();
if (process.platform === 'darwin') {
app.on('activate', async () => {
if (BrowserWindow.getAllWindows().length === 0) {
await windowService.createMainWindow(app);
windowService.createMainWindow(app);
}
});
}