electron-store 로 인한 이슈 보완처리. 2차.
This commit is contained in:
parent
5c5ad1a38d
commit
48ece1c325
|
@ -132,7 +132,7 @@ export class AppWindow {
|
||||||
this.window.once(ElectronBrowserWindowChannel.ReadyToShow, () => {
|
this.window.once(ElectronBrowserWindowChannel.ReadyToShow, () => {
|
||||||
this.window.close();
|
this.window.close();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (appStorage.startupHideWindow) {
|
if (!!appStorage && appStorage.startupHideWindow) {
|
||||||
this.window.close();
|
this.window.close();
|
||||||
} else {
|
} else {
|
||||||
this.window.show();
|
this.window.show();
|
||||||
|
|
|
@ -61,7 +61,7 @@ import {
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
|
|
||||||
import { RendererUpdater } from './lib/renderer-updater';
|
import { RendererUpdater } from './lib/renderer-updater';
|
||||||
import { appStorage } from './lib/storage';
|
import { Storage } from './lib/storage';
|
||||||
|
|
||||||
require('v8-compile-cache');
|
require('v8-compile-cache');
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ let updateWindowService: ElectronUpdateWindowService | null;
|
||||||
|
|
||||||
tmp.setGracefulCleanup();
|
tmp.setGracefulCleanup();
|
||||||
|
|
||||||
|
let appStorage: Storage;
|
||||||
|
|
||||||
function handleUncaughtException(error: Error) {
|
function handleUncaughtException(error: Error) {
|
||||||
preventQuit = true;
|
preventQuit = true;
|
||||||
|
|
||||||
|
@ -174,6 +176,11 @@ if (isDuplicateInstance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
|
try {
|
||||||
|
appStorage = new Storage();
|
||||||
|
} catch (e) {
|
||||||
|
log.error('[appStorage = new Storage()]]', e);
|
||||||
|
}
|
||||||
const window = new AppWindow(appIconPath, appStorage);
|
const window = new AppWindow(appIconPath, appStorage);
|
||||||
|
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
|
@ -212,7 +219,7 @@ function createWindow() {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onDidLoad(() => {
|
window.onDidLoad(() => {
|
||||||
if (!appStorage.startupHideWindow) {
|
if (!!appStorage && !appStorage.startupHideWindow) {
|
||||||
// not used?
|
// not used?
|
||||||
window.show();
|
window.show();
|
||||||
} else {
|
} else {
|
||||||
|
@ -441,8 +448,10 @@ ipcMain.on(
|
||||||
ipcMain.on(
|
ipcMain.on(
|
||||||
MessengerChannel.ClearAppStorage,
|
MessengerChannel.ClearAppStorage,
|
||||||
(event: IpcMainEvent, ...args: any[]) => {
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
if (!!!!appStorage) {
|
||||||
appStorage.reset();
|
appStorage.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
ipcMain.on(
|
ipcMain.on(
|
||||||
|
@ -479,6 +488,7 @@ ipcMain.on(
|
||||||
(event: IpcMainEvent, ...args: any[]) => {
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
const isStartupHideWindow = args[0] as boolean;
|
const isStartupHideWindow = args[0] as boolean;
|
||||||
|
|
||||||
|
if (!!!!appStorage) {
|
||||||
appStorage.startupHideWindow = isStartupHideWindow;
|
appStorage.startupHideWindow = isStartupHideWindow;
|
||||||
log.info(
|
log.info(
|
||||||
'StartupHideWindow is changed from ',
|
'StartupHideWindow is changed from ',
|
||||||
|
@ -486,6 +496,7 @@ ipcMain.on(
|
||||||
' to ',
|
' to ',
|
||||||
appStorage.startupHideWindow
|
appStorage.startupHideWindow
|
||||||
);
|
);
|
||||||
|
}
|
||||||
event.returnValue = true;
|
event.returnValue = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -495,7 +506,7 @@ ipcMain.on(
|
||||||
(event: IpcMainEvent, ...args: any[]) => {
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
const downloadPath = args[0] as string;
|
const downloadPath = args[0] as string;
|
||||||
|
|
||||||
if (!!downloadPath && downloadPath.length > 0) {
|
if (!!appStorage && !!downloadPath && downloadPath.length > 0) {
|
||||||
appStorage.downloadPath = downloadPath;
|
appStorage.downloadPath = downloadPath;
|
||||||
log.info('downloadPath is changed to ', appStorage.downloadPath);
|
log.info('downloadPath is changed to ', appStorage.downloadPath);
|
||||||
|
|
||||||
|
@ -566,9 +577,9 @@ ipcMain.on(
|
||||||
|
|
||||||
let basePath = path.join(
|
let basePath = path.join(
|
||||||
app.getPath('documents'),
|
app.getPath('documents'),
|
||||||
appStorage.constDefaultDownloadFolder
|
!!appStorage ? appStorage.constDefaultDownloadFolder : ''
|
||||||
);
|
);
|
||||||
if (!!appStorage.downloadPath) {
|
if (!!appStorage && !!appStorage.downloadPath) {
|
||||||
basePath = appStorage.downloadPath;
|
basePath = appStorage.downloadPath;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -608,7 +619,7 @@ ipcMain.on(
|
||||||
const make: boolean = args[1];
|
const make: boolean = args[1];
|
||||||
if (!folderItem) {
|
if (!folderItem) {
|
||||||
let basePath = app.getPath('downloads');
|
let basePath = app.getPath('downloads');
|
||||||
if (!!appStorage.downloadPath) {
|
if (!!appStorage && !!appStorage.downloadPath) {
|
||||||
try {
|
try {
|
||||||
basePath = appStorage.downloadPath;
|
basePath = appStorage.downloadPath;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
"@angular/core": "^8.2.14",
|
"@angular/core": "^8.2.14",
|
||||||
"auto-launch": "^5.0.5",
|
"auto-launch": "^5.0.5",
|
||||||
"electron-log": "^3.0.9",
|
"electron-log": "^3.0.9",
|
||||||
"electron-store": "^5.1.0",
|
"electron-store": "^5.1.1",
|
||||||
"electron-updater": "^4.2.0",
|
"electron-updater": "^4.2.0",
|
||||||
"electron-window-state": "^5.0.3",
|
"electron-window-state": "^5.0.3",
|
||||||
"file-type": "^14.1.2",
|
"file-type": "^14.1.2",
|
||||||
|
|
|
@ -79,6 +79,12 @@ export class AppAuthenticationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// if (!!environment.productConfig.defaultSettings.general.autoLaunch) {
|
||||||
|
// this.nativeService.changeAutoLaunch(
|
||||||
|
// environment.productConfig.defaultSettings.general.autoLaunch
|
||||||
|
// );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
appUserInfo = {
|
appUserInfo = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user