From 5b84d02f7b9d367c24403e457ced577422734346 Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 17 Feb 2020 10:49:09 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=20::=20wlndowstateChanged=20=EC=9D=98=20?= =?UTF-8?q?=EC=98=B5=EC=A0=80=EB=B2=84=EB=B8=94=EC=9D=B4=20dispatch=20?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=95=84=20noti=20=EC=AA=BD?= =?UTF-8?q?=EC=9D=B4=20=EC=9B=80=EC=A7=81=EC=9D=B4=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/services/notification.service.ts | 13 +++++++------ .../src/lib/services/browser-native.service.ts | 3 +++ .../src/lib/services/electron-native.service.ts | 16 ++++++++++++++++ .../src/lib/services/native.service.ts | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts index 7f9eff2c..dbec144a 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -209,10 +209,9 @@ export class AppNotificationService { (state: any) => state.messenger.sync.room.entities as Dictionary ) - ), - this.nativeService.windowStateChanged() + ) ), - tap(([notiOrRes, curRoomInfo, roomList, windowStateChanged]) => { + tap(([notiOrRes, curRoomInfo, roomList]) => { switch (notiOrRes.SSVC_TYPE) { case SSVC_TYPE_EVENT_SEND_RES: case SSVC_TYPE_EVENT_SEND_NOTI: @@ -241,14 +240,16 @@ export class AppNotificationService { doNoti = false; } + const windowState = this.nativeService.getWindowState(); + // 현재 열려 있는 방일경우 노티 안함. if ( !!curRoomInfo && !!curRoomInfo.roomSeq && curRoomInfo.roomSeq === noti.roomSeq && - !!windowStateChanged && - windowStateChanged !== WindowState.Minimized && - windowStateChanged !== WindowState.Hidden + !!windowState && + windowState !== WindowState.Minimized && + windowState !== WindowState.Hidden ) { doNoti = false; } diff --git a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts index cb833db0..88daa6e3 100644 --- a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts +++ b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts @@ -227,6 +227,9 @@ export class BrowserNativeService extends NativeService { windowMinimize(): void {} windowMaximize(): void {} + getWindowState(): WindowState { + return WindowState.Normal; + } appExit(): void {} diff --git a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts index 7a16a116..3114ae0c 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts @@ -391,6 +391,22 @@ export class ElectronNativeService implements NativeService { } } + getWindowState(): WindowState { + if (!remote.getCurrentWindow().isVisible()) { + return WindowState.Hidden; + } else if (remote.getCurrentWindow().isMinimized()) { + return WindowState.Minimized; + } else if (remote.getCurrentWindow().isNormal()) { + return WindowState.Normal; + } else if (remote.getCurrentWindow().isMaximized()) { + return WindowState.Maximized; + } else if (remote.getCurrentWindow().isFullScreen()) { + return WindowState.FullScreen; + } else { + return WindowState.Normal; + } + } + appExit(): void { this.ipcRenderer.send(AppChannel.Exit); } diff --git a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts index 03f97d15..66a40df4 100644 --- a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts +++ b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts @@ -72,6 +72,7 @@ export abstract class NativeService { abstract windowClose(): void; abstract windowMinimize(): void; abstract windowMaximize(): void; + abstract getWindowState(): WindowState; abstract zoomTo(factor: number): Promise; abstract appExit(): void;