1:1 대화방일 경우 대화방 제목 오프라인 정보 표시에 오프라인/부재중 분기표현하도록 수정.

This commit is contained in:
leejinho 2020-04-02 08:31:47 +09:00
parent de9cca2a5b
commit 64f2589e32
3 changed files with 23 additions and 8 deletions

View File

@ -162,6 +162,7 @@ import {
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import moment from 'moment'; import moment from 'moment';
import { ElectronBrowserWindowChannel } from '@ucap-webmessenger/electron-core'; import { ElectronBrowserWindowChannel } from '@ucap-webmessenger/electron-core';
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -209,7 +210,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
userInfoListSubject = new BehaviorSubject<UserInfo[]>(undefined); userInfoListSubject = new BehaviorSubject<UserInfo[]>(undefined);
userStatusListSubscription: Subscription; userStatusListSubscription: Subscription;
offLineUsers: UserInfo[] = []; offLineUsers: { userInfo: UserInfo; presence: StatusBulkInfo | null }[] = [];
eventListSubscription: Subscription; eventListSubscription: Subscription;
eventListSubject = new BehaviorSubject<Info<EventJson>[]>(undefined); eventListSubject = new BehaviorSubject<Info<EventJson>[]>(undefined);
@ -408,7 +409,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
.forEach(userInfo => { .forEach(userInfo => {
const presence = presences[userInfo.seq]; const presence = presences[userInfo.seq];
const existIndex = !!this.offLineUsers const existIndex = !!this.offLineUsers
? this.offLineUsers.findIndex(e => e.seq === userInfo.seq) ? this.offLineUsers.findIndex(
e => e.userInfo.seq === userInfo.seq
)
: -1; : -1;
if ( if (
@ -422,7 +425,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
} else { } else {
if (existIndex === -1) { if (existIndex === -1) {
this.offLineUsers.push(userInfo); this.offLineUsers.push({ userInfo, presence });
} }
} }
}); });
@ -699,14 +702,24 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
!!this.roomInfoSubject.value && !!this.roomInfoSubject.value &&
this.roomInfoSubject.value.roomType === RoomType.Single this.roomInfoSubject.value.roomType === RoomType.Single
) { ) {
const trgtUser = this.offLineUsers[0];
const name = new UiTranslatePipe( const name = new UiTranslatePipe(
this.uiTranslateService, this.uiTranslateService,
this.changeDetectorRef this.changeDetectorRef
).transform(this.offLineUsers[0], 'name'); ).transform(trgtUser.userInfo, 'name');
if (
!!trgtUser.presence &&
trgtUser.presence.pcStatus === PresenceStatusCode.Away
) {
offlineStr = this.translateService.instant('chat.existAwayUser', {
offlineUser: name
});
} else {
offlineStr = this.translateService.instant('chat.existOfflineUser', { offlineStr = this.translateService.instant('chat.existOfflineUser', {
offlineUser: name offlineUser: name
}); });
}
} else if ( } else if (
!!this.roomInfoSubject.value && !!this.roomInfoSubject.value &&
this.roomInfoSubject.value.roomType === RoomType.Multi this.roomInfoSubject.value.roomType === RoomType.Multi

View File

@ -244,6 +244,7 @@
"btnSticker": "Sticker", "btnSticker": "Sticker",
"btnTranslate": "Translate", "btnTranslate": "Translate",
"noRoomUser": "No chat users", "noRoomUser": "No chat users",
"existAwayUser": "{{offlineUser}} may not respond because it is [away].",
"existOfflineUser": "{{offlineUser}} may not respond because it is [offline].", "existOfflineUser": "{{offlineUser}} may not respond because it is [offline].",
"existOfflineUsers": "Some chat partners may not respond because they are not online.", "existOfflineUsers": "Some chat partners may not respond because they are not online.",
"event": { "event": {

View File

@ -244,6 +244,7 @@
"btnSticker": "스티커", "btnSticker": "스티커",
"btnTranslate": "번역", "btnTranslate": "번역",
"noRoomUser": "대화상대 없음", "noRoomUser": "대화상대 없음",
"existAwayUser": "{{offlineUser}}님이 [부재중]이므로 응답하지 않을 수도 있습니다.",
"existOfflineUser": "{{offlineUser}}님이 [오프라인]이므로 응답하지 않을 수도 있습니다.", "existOfflineUser": "{{offlineUser}}님이 [오프라인]이므로 응답하지 않을 수도 있습니다.",
"existOfflineUsers": "일부 대화상대는 온라인 상태가 아니어서 응답하지 않을 수도 있습니다.", "existOfflineUsers": "일부 대화상대는 온라인 상태가 아니어서 응답하지 않을 수도 있습니다.",
"event": { "event": {