Skip to content

Commit 7695774

Browse files
committed
- Update sources
1 parent bebc12b commit 7695774

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src-electron/service/app/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ export class AppService implements AppServiceTrait {
5757
});
5858
app.whenReady().then(
5959
async () => {
60-
log.info(`Starting service ${ServiceType.maa}...`);
6160
await this._maaService.create();
6261
log.info(`Service ${ServiceType.maa} started`);
63-
log.info(`Starting service ${ServiceType.tray}...`);
62+
6463
this._trayService.create();
6564
log.info(`Service ${ServiceType.tray} started`);
66-
log.info(`Starting service ${ServiceType.window}...`);
65+
6766
this._windowService.getWindow(WindowType.main).create();
6867
log.info(`Service ${ServiceType.window} started`);
68+
6969
log.info(`${packageJson.productName} is ready`);
7070
},
7171
() => {},

src-electron/service/window/base/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { BrowserWindow } from 'electron';
2-
import Logger from 'electron-log';
32

43
import { DEFAULT_CONSTRUCT_OPTIONS } from 'app/src-electron/service/window/base/constants';
54
import type { ConstructOptions } from 'app/src-electron/service/window/base/types';
65

76
import { WINDOW_URL_MAPPING } from 'src/types/service/window/constants';
87
import type { WindowType } from 'src/types/service/window/types';
8+
import log from 'electron-log';
99

1010
export abstract class BaseWindow {
1111
private readonly _constructOptions: ConstructOptions;
12-
private readonly _url: string;
12+
private readonly _hash: string;
1313
protected _window?: BrowserWindow | undefined;
1414

1515
protected constructor(windowType: WindowType, constructOptions?: ConstructOptions) {
1616
this._constructOptions = {
1717
...DEFAULT_CONSTRUCT_OPTIONS,
1818
...constructOptions,
1919
};
20-
this._url = `${process.env.APP_URL}#${WINDOW_URL_MAPPING[windowType]}`;
20+
this._hash = WINDOW_URL_MAPPING[windowType];
2121
}
2222

2323
create() {
@@ -41,7 +41,11 @@ export abstract class BaseWindow {
4141
}
4242
}
4343
});
44-
this._window.loadURL(this._url).catch((e) => Logger.warn('loadURL', e));
44+
if (process.env.DEV) {
45+
this._window.loadURL(`${process.env.APP_URL}#${this._hash}`).catch((e) => log.warn('loadURL', e));
46+
} else {
47+
this._window.loadFile('index.html', { hash: this._hash }).catch((e) => log.warn('loadFile', e));
48+
}
4549

4650
return this._window;
4751
}

0 commit comments

Comments
 (0)