From e562e4b334087d2e6d62d8f5574a2b2793d82a3c Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Thu, 6 Feb 2020 18:20:45 +0900 Subject: [PATCH 1/2] [ISSUE 224] fixed --- .../ucap-webmessenger-electron/src/app/AppWindow.ts | 7 +++++-- electron-projects/ucap-webmessenger-electron/src/index.ts | 3 +-- .../ucap-webmessenger-electron/src/lib/storage.ts | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index 6db3f7a6..a7af6014 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -5,7 +5,6 @@ import { app, BrowserWindow, screen, ipcMain, IpcMainEvent } from 'electron'; import windowStateKeeper from 'electron-window-state'; import { EventEmitter } from 'events'; -import { now } from '../util/now'; import { registerWindowStateChangedEvents } from '../lib/window-state'; import { ElectronAppChannel, @@ -13,6 +12,9 @@ import { ElectronWebContentsChannel } from '@ucap-webmessenger/electron-core'; +import { appStorage } from '../lib/storage'; +import { now } from '../util/now'; + export class AppWindow { private window: BrowserWindow | null = null; @@ -55,7 +57,8 @@ export class AppWindow { nodeIntegration: true }, acceptFirstMouse: true, - icon: this.appIconPath + icon: this.appIconPath, + show: !appStorage.startupHideWindow }; if (__DARWIN__) { diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 73bbcf9e..433602d5 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -55,7 +55,7 @@ import { import log from 'electron-log'; import { RendererUpdater } from './lib/renderer-updater'; -import { Storage } from './lib/storage'; +import { appStorage } from './lib/storage'; const appIconPath = __LINUX__ ? __DEV__ @@ -88,7 +88,6 @@ let preventQuit = false; let notificationService: ElectronNotificationService | null; let updateWindowService: ElectronUpdateWindowService | null; -const appStorage: Storage = new Storage(); function handleUncaughtException(error: Error) { preventQuit = true; diff --git a/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts b/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts index a0413e33..0956accf 100644 --- a/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts +++ b/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts @@ -45,3 +45,5 @@ export class Storage { this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath); } } + +export const appStorage: Storage = new Storage(); From cffe62986ee024b4071ddecdb21b4174706717ff Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Thu, 6 Feb 2020 18:24:02 +0900 Subject: [PATCH 2/2] start mode is changed --- .../ucap-webmessenger-electron/src/app/AppWindow.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index a7af6014..0e1b4d68 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -58,7 +58,7 @@ export class AppWindow { }, acceptFirstMouse: true, icon: this.appIconPath, - show: !appStorage.startupHideWindow + show: false }; if (__DARWIN__) { @@ -120,6 +120,9 @@ export class AppWindow { // can be tidied up once https://github.com/electron/electron/issues/12971 // has been confirmed as resolved this.window.once(ElectronBrowserWindowChannel.ReadyToShow, () => { + if (!appStorage.startupHideWindow) { + this.window.show(); + } this.window.on(ElectronBrowserWindowChannel.Unmaximize, () => { setTimeout(() => { const bounds = this.window.getBounds();