From 4c751b294d4f58e82fc76f1af4ba5f20007fd9e0 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 27 Mar 2020 15:01:03 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8C=80=ED=99=94=EB=B0=A9=20=EC=83=81?= =?UTF-8?q?=EB=8C=80=20=EC=98=A4=ED=94=84=EB=9D=BC=EC=9D=B8=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=ED=91=9C=EC=8B=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80.=20>>=20=EB=94=94=EC=9E=90=EC=9D=B8=20=ED=95=84?= =?UTF-8?q?=EC=9A=94.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/messages.component.html | 24 +++++++- .../components/messages.component.ts | 59 +++++++++++++++++-- .../src/app/store/messenger/room/effects.ts | 1 - .../src/app/store/messenger/status/effects.ts | 20 +++++++ .../src/assets/i18n/en.json | 2 + .../src/assets/i18n/ko.json | 2 + 6 files changed, 101 insertions(+), 7 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 20681eae..8bfe301d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -50,12 +50,34 @@
{{ getConvertTimer(roomInfoSubject.value.timeRoomInterval) }}
+
+ + {{ 'chat.existOfflineUser' | translate }} + + + {{ 'chat.existOfflineUsers' | translate }} + +

(undefined); + userStatusListSubscription: Subscription; + offLineUsers: UserInfo[] = []; + eventListSubscription: Subscription; eventListSubject = new BehaviorSubject[]>(undefined); eventListNewSubject = new BehaviorSubject[]>(undefined); @@ -327,6 +341,35 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { this.changeDetectorRef.detectChanges(); }); + this.userStatusListSubscription = combineLatest([ + this.store.pipe( + select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist) + ), + this.store.pipe( + select( + AppStore.MessengerSelector.StatusSelector.selectEntitiesStatusBulkInfo + ) + ) + ]) + .pipe( + tap(([userInfoList, presences]) => { + if (!!userInfoList && userInfoList.length > 0) { + userInfoList.forEach(userInfo => { + const presence = presences[userInfo.seq]; + + if ( + !!presence && + presence.pcStatus === PresenceStatusCode.OnLine + ) { + } else { + this.offLineUsers.push(userInfo); + } + }); + } + }) + ) + .subscribe(); + this.eventListProcessing$ = this.store.pipe( select(AppStore.MessengerSelector.EventSelector.infoListProcessing) ); @@ -456,6 +499,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { if (!!this.userInfoListSubscription) { this.userInfoListSubscription.unsubscribe(); } + if (!!this.userStatusListSubscription) { + this.userStatusListSubscription.unsubscribe(); + } if (!!this.eventListSubscription) { this.eventListSubscription.unsubscribe(); } @@ -503,6 +549,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { // Read here Clear.. this.firstCheckReadHere = true; + // off line user clear.. + this.offLineUsers = []; + // Chat Formfield Clear.. if (!!this.chatForm) { this.chatForm.replyInput.nativeElement.value = ''; @@ -571,9 +620,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { } onClickSendClickToCall(type: string) { - if(type === 'LINE') { + if (type === 'LINE') { this.sendCall.emit(this._roomUserInfos[0].lineNumber); - } else if(type === 'MOBILE') { + } else if (type === 'MOBILE') { this.sendCall.emit(this._roomUserInfos[0].hpNumber); } } diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts index 9d8a4e81..f725cb9a 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts @@ -82,7 +82,6 @@ import { AlertDialogData, AlertDialogResult } from '@ucap-webmessenger/ui'; -import { ActivatedRouteSnapshot } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; @Injectable() diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts index f672ba82..928604e7 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts @@ -5,6 +5,7 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; +import * as RoomStore from '@app/store/messenger/room'; import * as SyncStore from '@app/store/messenger/sync'; import * as AuthStore from '@app/store/account/authentication'; import { @@ -143,6 +144,25 @@ export class Effects { { dispatch: false } ); + mroomUserStatusCheck$ = createEffect( + () => + this.actions$.pipe( + ofType(RoomStore.infoSuccess), + map(action => action.userInfoList), + tap(userInfoList => { + if (!!userInfoList && userInfoList.length > 0) { + this.store.dispatch( + bulkInfo({ + divCd: 'roomuserBulk', + userSeqs: userInfoList.map(userinfo => userinfo.seq) + }) + ); + } + }) + ), + { dispatch: false } + ); + constructor( private actions$: Actions, private store: Store, diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/en.json b/projects/ucap-webmessenger-app/src/assets/i18n/en.json index aa11888d..bccd8684 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/en.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/en.json @@ -238,6 +238,8 @@ "btnSticker": "Sticker", "btnTranslate": "Translate", "noRoomUser": "No chat users", + "existOfflineUser": "offline", + "existOfflineUsers": "Some offline", "event": { "inviteToRoomWith": "{{owner}} invited {{inviter}}.", "exitFromRoomWith": "{{exitor}} has left.", diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json index e0093ff7..c9afcd7e 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json @@ -238,6 +238,8 @@ "btnSticker": "스티커", "btnTranslate": "번역", "noRoomUser": "대화상대 없음", + "existOfflineUser": "오프라인 입니다.", + "existOfflineUsers": "일부 인원이 오프라인 입니다.", "event": { "inviteToRoomWith": "{{owner}}이 {{inviter}}을 초대했습니다.", "exitFromRoomWith": "{{exitor}}님이 퇴장하셨습니다.",