대화방 상대 오프라인 정보 표시 기능 추가. >> 디자인 필요.

This commit is contained in:
leejinho 2020-03-27 15:01:03 +09:00
parent 63fe2c3875
commit 4c751b294d
6 changed files with 101 additions and 7 deletions

View File

@ -50,12 +50,34 @@
<div class="room-info"> <div class="room-info">
<div <div
*ngIf="roomInfoSubject.value && roomInfoSubject.value.isTimeRoom" *ngIf="roomInfoSubject.value && roomInfoSubject.value.isTimeRoom"
class="room-type text-accent-color " class="room-type text-accent-color"
> >
<span class="bg-accent-darkest" <span class="bg-accent-darkest"
>{{ getConvertTimer(roomInfoSubject.value.timeRoomInterval) }} >{{ getConvertTimer(roomInfoSubject.value.timeRoomInterval) }}
</span> </span>
</div> </div>
<div
*ngIf="
roomInfoSubject.value &&
(roomInfoSubject.value.roomType === RoomType.Single ||
roomInfoSubject.value.roomType === RoomType.Multi) &&
offLineUsers.length > 0
"
class="room-type text-accent-color"
>
<span
*ngIf="roomInfoSubject.value.roomType === RoomType.Single"
class="bg-accent-darkest"
>
{{ 'chat.existOfflineUser' | translate }}
</span>
<span
*ngIf="roomInfoSubject.value.roomType === RoomType.Multi"
class="bg-accent-darkest"
>
{{ 'chat.existOfflineUsers' | translate }}
</span>
</div>
<h3 class="room-name"> <h3 class="room-name">
<ng-container <ng-container
*ngIf="!roomInfoSubject.value || !userInfoListSubject.value" *ngIf="!roomInfoSubject.value || !userInfoListSubject.value"

View File

@ -32,7 +32,14 @@ import {
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { Observable, Subscription, forkJoin, of, BehaviorSubject } from 'rxjs'; import {
Observable,
Subscription,
forkJoin,
of,
BehaviorSubject,
combineLatest
} from 'rxjs';
import { import {
Info, Info,
@ -103,7 +110,12 @@ import {
FileViewerDialogData, FileViewerDialogData,
FileViewerDialogResult FileViewerDialogResult
} from '@app/layouts/common/dialogs/file-viewer.dialog.component'; } from '@app/layouts/common/dialogs/file-viewer.dialog.component';
import { FileUtil, StickerFilesInfo, MimeUtil } from '@ucap-webmessenger/core'; import {
FileUtil,
StickerFilesInfo,
MimeUtil,
StatusCode as PresenceStatusCode
} from '@ucap-webmessenger/core';
import { StatusCode } from '@ucap-webmessenger/api'; import { StatusCode } from '@ucap-webmessenger/api';
import { import {
@ -144,7 +156,6 @@ import {
EventDownloadRequest EventDownloadRequest
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import moment from 'moment'; import moment from 'moment';
import { start } from 'repl';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -191,6 +202,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
userInfoListSubscription: Subscription; userInfoListSubscription: Subscription;
userInfoListSubject = new BehaviorSubject<UserInfo[]>(undefined); userInfoListSubject = new BehaviorSubject<UserInfo[]>(undefined);
userStatusListSubscription: Subscription;
offLineUsers: UserInfo[] = [];
eventListSubscription: Subscription; eventListSubscription: Subscription;
eventListSubject = new BehaviorSubject<Info<EventJson>[]>(undefined); eventListSubject = new BehaviorSubject<Info<EventJson>[]>(undefined);
eventListNewSubject = new BehaviorSubject<Info<EventJson>[]>(undefined); eventListNewSubject = new BehaviorSubject<Info<EventJson>[]>(undefined);
@ -327,6 +341,35 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.changeDetectorRef.detectChanges(); 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( this.eventListProcessing$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoListProcessing) select(AppStore.MessengerSelector.EventSelector.infoListProcessing)
); );
@ -456,6 +499,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
if (!!this.userInfoListSubscription) { if (!!this.userInfoListSubscription) {
this.userInfoListSubscription.unsubscribe(); this.userInfoListSubscription.unsubscribe();
} }
if (!!this.userStatusListSubscription) {
this.userStatusListSubscription.unsubscribe();
}
if (!!this.eventListSubscription) { if (!!this.eventListSubscription) {
this.eventListSubscription.unsubscribe(); this.eventListSubscription.unsubscribe();
} }
@ -503,6 +549,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
// Read here Clear.. // Read here Clear..
this.firstCheckReadHere = true; this.firstCheckReadHere = true;
// off line user clear..
this.offLineUsers = [];
// Chat Formfield Clear.. // Chat Formfield Clear..
if (!!this.chatForm) { if (!!this.chatForm) {
this.chatForm.replyInput.nativeElement.value = ''; this.chatForm.replyInput.nativeElement.value = '';
@ -571,9 +620,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
onClickSendClickToCall(type: string) { onClickSendClickToCall(type: string) {
if(type === 'LINE') { if (type === 'LINE') {
this.sendCall.emit(this._roomUserInfos[0].lineNumber); this.sendCall.emit(this._roomUserInfos[0].lineNumber);
} else if(type === 'MOBILE') { } else if (type === 'MOBILE') {
this.sendCall.emit(this._roomUserInfos[0].hpNumber); this.sendCall.emit(this._roomUserInfos[0].hpNumber);
} }
} }

View File

@ -82,7 +82,6 @@ import {
AlertDialogData, AlertDialogData,
AlertDialogResult AlertDialogResult
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { ActivatedRouteSnapshot } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
@Injectable() @Injectable()

View File

@ -5,6 +5,7 @@ import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import * as RoomStore from '@app/store/messenger/room';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
import * as AuthStore from '@app/store/account/authentication'; import * as AuthStore from '@app/store/account/authentication';
import { import {
@ -143,6 +144,25 @@ export class Effects {
{ dispatch: false } { 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( constructor(
private actions$: Actions, private actions$: Actions,
private store: Store<any>, private store: Store<any>,

View File

@ -238,6 +238,8 @@
"btnSticker": "Sticker", "btnSticker": "Sticker",
"btnTranslate": "Translate", "btnTranslate": "Translate",
"noRoomUser": "No chat users", "noRoomUser": "No chat users",
"existOfflineUser": "offline",
"existOfflineUsers": "Some offline",
"event": { "event": {
"inviteToRoomWith": "{{owner}} invited {{inviter}}.", "inviteToRoomWith": "{{owner}} invited {{inviter}}.",
"exitFromRoomWith": "{{exitor}} has left.", "exitFromRoomWith": "{{exitor}} has left.",

View File

@ -238,6 +238,8 @@
"btnSticker": "스티커", "btnSticker": "스티커",
"btnTranslate": "번역", "btnTranslate": "번역",
"noRoomUser": "대화상대 없음", "noRoomUser": "대화상대 없음",
"existOfflineUser": "오프라인 입니다.",
"existOfflineUsers": "일부 인원이 오프라인 입니다.",
"event": { "event": {
"inviteToRoomWith": "{{owner}}이 {{inviter}}을 초대했습니다.", "inviteToRoomWith": "{{owner}}이 {{inviter}}을 초대했습니다.",
"exitFromRoomWith": "{{exitor}}님이 퇴장하셨습니다.", "exitFromRoomWith": "{{exitor}}님이 퇴장하셨습니다.",