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;