From af312d9ba1242a72ec122ab4c31ace05824fbd26 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 31 Jan 2020 14:32:17 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20194?= =?UTF-8?q?=20=EB=8C=80=ED=99=94=20=ED=9A=8C=EC=88=98=20=ED=9B=84=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20=EB=8C=80=ED=99=94=EB=B0=A9=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=ED=99=95=EC=9D=B8=20=EC=8B=9C=20=EB=8C=80=ED=99=94?= =?UTF-8?q?=EC=83=81=EB=8C=80=EC=97=86=EC=9D=8C=20=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A7=90=20198=20=EB=B6=80=EC=9E=AC=EC=A4=91?= =?UTF-8?q?=20=EC=8B=9C=EA=B0=84=20=EC=84=A4=EC=A0=95=20=ED=9B=84=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=20=EC=8B=9C=20=EB=B6=80=EC=9E=AC=EC=A4=91?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 로그아웃시 idle 체크 해제 알림대화타입 대화전달 못하게 막음. --- .../ucap-webmessenger-electron/src/index.ts | 16 +++++++++++++- .../src/lib/idle-checker.ts | 9 +++----- .../components/login.page.component.ts | 9 +++++++- .../src/app/store/messenger/sync/reducers.ts | 22 ++++++++++++------- .../lib/services/browser-native.service.ts | 14 +++++++----- .../lib/services/electron-native.service.ts | 18 ++++++++++----- .../src/lib/types/channel.type.ts | 1 + .../src/lib/services/native.service.ts | 9 +++++--- .../src/lib/models/info.ts | 8 ++++++- 9 files changed, 75 insertions(+), 31 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 313a4149..8925eafe 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -643,18 +643,32 @@ ipcMain.on( idle.destoryChecker(); idle = null; } + idle = new IdleChecker(appWindow.browserWindow); // default 10min idle.startChecker(); } ); +ipcMain.on( + IdleStateChannel.StopCheck, + (event: IpcMainEvent, ...args: any[]) => { + if (!!idle) { + idle.destoryChecker(); + idle = null; + } + } +); ipcMain.on( IdleStateChannel.ChangeLimitTime, (event: IpcMainEvent, ...args: any[]) => { const limitTime: number = args[0]; if (!!idle) { - idle.resetIdleTime(limitTime); + idle.destoryChecker(); + idle = null; } + + idle = new IdleChecker(appWindow.browserWindow); + idle.resetIdleTime(limitTime); } ); diff --git a/electron-projects/ucap-webmessenger-electron/src/lib/idle-checker.ts b/electron-projects/ucap-webmessenger-electron/src/lib/idle-checker.ts index 3d79ea35..bdaa5f63 100644 --- a/electron-projects/ucap-webmessenger-electron/src/lib/idle-checker.ts +++ b/electron-projects/ucap-webmessenger-electron/src/lib/idle-checker.ts @@ -44,26 +44,23 @@ export class IdleChecker { if (!!this.intervalObject) { clearInterval(this.intervalObject); + this.intervalObject = undefined; } this.limitSec = limitedMin * 60; - // storage.setIdleTimeLimit(limitedMin); - // global.opt_idleTimeLimit = limitedMin; - this.startChecker(); } public startChecker() { if (!this.intervalObject) { - this.intervalObject = setInterval(() => { - this.doCheckIdle(); - }, 1000); + this.intervalObject = setInterval(() => this.doCheckIdle(), 1000); } } public destoryChecker() { if (!!this.intervalObject) { clearInterval(this.intervalObject); + this.intervalObject = undefined; } } } diff --git a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts index d2772ed0..127eb536 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy, Inject } from '@angular/core'; import { Store, select } from '@ngrx/store'; @@ -34,6 +34,7 @@ import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types'; import { AppAuthenticationService } from '@app/services/authentication.service'; import { logoutInitialize } from '@app/store/account/authentication'; import { TranslateService } from '@ngx-translate/core'; +import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; @Component({ selector: 'app-page-account-login', @@ -84,6 +85,7 @@ export class LoginPageComponent implements OnInit, OnDestroy { ]; constructor( + @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private store: Store, private router: Router, private translateService: TranslateService, @@ -190,6 +192,11 @@ export class LoginPageComponent implements OnInit, OnDestroy { KEY_LOGOUT_INFO ); + if (!!personLogout) { + // if self logout clear idle check. + this.nativeService.idleStateStop(); + } + if (!!personLogout && !!personLogout.reasonCode) { let msg = this.translateService.instant('accounts.results.doLogout'); switch (personLogout.reasonCode) { diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts index 38d7ce31..2cac0931 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts @@ -234,13 +234,13 @@ export const reducer = createReducer( const roomUserList: RoomUserDetailData[] = []; const roomUserShortList: RoomUserData[] = []; - if (action.userInfoList) { + if (!!action.userInfoList && action.userInfoList.length > 0) { roomUserList.push({ roomSeq: action.roomInfo.roomSeq, userInfos: action.userInfoList }); } - if (action.userInfoShortList) { + if (!!action.userInfoShortList && action.userInfoShortList.length > 0) { roomUserShortList.push({ roomSeq: action.roomInfo.roomSeq, userInfos: action.userInfoShortList @@ -252,12 +252,18 @@ export const reducer = createReducer( room: adapterRoom.upsertOne(action.roomInfo, { ...state.room }), - roomUser: adapterRoomUser.upsertMany(roomUserList, { - ...state.roomUser - }), - roomUserShort: adapterRoomUserShort.upsertMany(roomUserShortList, { - ...state.roomUserShort - }) + roomUser: + roomUserList.length > 0 + ? adapterRoomUser.upsertMany(roomUserList, { + ...state.roomUser + }) + : state.roomUser, + roomUserShort: + roomUserShortList.length > 0 + ? adapterRoomUserShort.upsertMany(roomUserShortList, { + ...state.roomUserShort + }) + : state.roomUserShort }; }), 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 7460f818..50bec0b9 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 @@ -187,13 +187,15 @@ export class BrowserNativeService extends NativeService { }); } - selectSaveFilePath(defaultPath?: string): Promise<{ - canceled: boolean, - filePath: string + selectSaveFilePath( + defaultPath?: string + ): Promise<{ + canceled: boolean; + filePath: string; }> { return new Promise<{ - canceled: boolean, - filePath: string + canceled: boolean; + filePath: string; }>((resolve, reject) => { resolve({ canceled: false, @@ -245,6 +247,8 @@ export class BrowserNativeService extends NativeService { }); } + idleStateStop(): void {} + changeLimitOfIdleState(limitTime: number): void {} chatOpenRoom(): Observable { 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 2b37b986..7f545324 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 @@ -309,13 +309,15 @@ export class ElectronNativeService implements NativeService { }); } - selectSaveFilePath(defaultPath?: string): Promise<{ - canceled: boolean, - filePath: string + selectSaveFilePath( + defaultPath?: string + ): Promise<{ + canceled: boolean; + filePath: string; }> { return new Promise<{ - canceled: boolean, - filePath: string + canceled: boolean; + filePath: string; }>((resolve, reject) => { try { resolve( @@ -409,7 +411,7 @@ export class ElectronNativeService implements NativeService { .asObservable() .pipe(share()); } - + console.log('idleStateChanged'); this.ipcRenderer.send(IdleStateChannel.StartCheck); this.ipcRenderer.on( @@ -421,6 +423,10 @@ export class ElectronNativeService implements NativeService { return this.idleStateChanged$; } + idleStateStop(): void { + this.ipcRenderer.send(IdleStateChannel.StopCheck); + } + changeLimitOfIdleState(limitTime: number): void { this.ipcRenderer.send(IdleStateChannel.ChangeLimitTime, limitTime); } diff --git a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts index 8cdf96a8..fdc1801f 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts @@ -51,6 +51,7 @@ export enum WindowStateChannel { export enum IdleStateChannel { Changed = 'UCAP::idleState::changed', StartCheck = 'UCAP::idleState::startCheck', + StopCheck = 'UCAP::idleState::stopCheck', ChangeLimitTime = 'UCAP::idleState::changeLimitTime' } 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 e456dcb0..ec7962a8 100644 --- a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts +++ b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts @@ -59,9 +59,11 @@ export abstract class NativeService { abstract openTargetItem(filePath?: string): Promise; abstract getPath(name: NativePathName): Promise; abstract selectDirectory(): Promise; - abstract selectSaveFilePath(defaultPath?: string): Promise<{ - canceled: boolean, - filePath: string + abstract selectSaveFilePath( + defaultPath?: string + ): Promise<{ + canceled: boolean; + filePath: string; }>; abstract executeProcess(executableName: string): Promise; @@ -74,6 +76,7 @@ export abstract class NativeService { abstract appExit(): void; abstract idleStateChanged(): Observable; + abstract idleStateStop(): void; abstract changeLimitOfIdleState(limitTime: number): void; abstract chatOpenRoom(): Observable; diff --git a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts index de6b7c89..c4e9ce20 100644 --- a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts +++ b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts @@ -42,7 +42,13 @@ export function isForwardable( event: Info, eventInfoStatus: InfoResponse ): boolean { - if (event.type === EventType.File) { + if ( + event.type === EventType.Plan || + event.type === EventType.AllimTms || + event.type === EventType.AllimElephant + ) { + return false; + } else if (event.type === EventType.File) { if ( !!eventInfoStatus && !!eventInfoStatus.validFileBaseSeq &&