bugfix :: wlndowstateChanged 의 옵저버블이 dispatch 되지 않아 noti 쪽이 움직이지 않는 문제 수정.

This commit is contained in:
leejinho 2020-02-17 10:49:09 +09:00
parent 4287216dd0
commit 5b84d02f7b
4 changed files with 27 additions and 6 deletions

View File

@ -209,10 +209,9 @@ export class AppNotificationService {
(state: any) =>
state.messenger.sync.room.entities as Dictionary<RoomInfo>
)
),
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;
}

View File

@ -227,6 +227,9 @@ export class BrowserNativeService extends NativeService {
windowMinimize(): void {}
windowMaximize(): void {}
getWindowState(): WindowState {
return WindowState.Normal;
}
appExit(): void {}

View File

@ -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);
}

View File

@ -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<number>;
abstract appExit(): void;