대화방 오프라인 표시 문구 수정

This commit is contained in:
leejinho 2020-03-30 10:19:49 +09:00
parent 56d9c7fe8d
commit 7482f697e4
4 changed files with 55 additions and 20 deletions

View File

@ -135,12 +135,7 @@
" "
class="member-state-msg text-warn-color" class="member-state-msg text-warn-color"
> >
<span *ngIf="roomInfoSubject.value.roomType === RoomType.Single"> {{ getOfflineString() }}
{{ 'chat.existOfflineUser' | translate }}
</span>
<span *ngIf="roomInfoSubject.value.roomType === RoomType.Multi">
{{ 'chat.existOfflineUsers' | translate }}
</span>
</div> </div>
</div> </div>
<div class="room-option"> <div class="room-option">

View File

@ -354,18 +354,33 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
.pipe( .pipe(
tap(([userInfoList, presences]) => { tap(([userInfoList, presences]) => {
if (!!userInfoList && userInfoList.length > 0) { if (!!userInfoList && userInfoList.length > 0) {
userInfoList.forEach(userInfo => { userInfoList
.filter(
info =>
info.seq !== this.loginResSubject.value.userSeq &&
!!info.isJoinRoom
)
.forEach(userInfo => {
const presence = presences[userInfo.seq]; const presence = presences[userInfo.seq];
const existIndex = !!this.offLineUsers
? this.offLineUsers.findIndex(e => e.seq === userInfo.seq)
: -1;
if ( if (
!!presence && !!presence &&
presence.pcStatus === PresenceStatusCode.OnLine presence.pcStatus === PresenceStatusCode.OnLine
) { ) {
if (existIndex > -1) {
this.offLineUsers.splice(existIndex, 1);
}
} else { } else {
if (existIndex === -1) {
this.offLineUsers.push(userInfo); this.offLineUsers.push(userInfo);
} }
}
}); });
} }
console.log(this.offLineUsers);
}) })
) )
.subscribe(); .subscribe();
@ -619,6 +634,31 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
} }
getOfflineString() {
let offlineStr = '';
if (!!this.offLineUsers && this.offLineUsers.length > 0) {
if (
!!this.roomInfoSubject.value &&
this.roomInfoSubject.value.roomType === RoomType.Single
) {
const name = new UiTranslatePipe(
this.uiTranslateService,
this.changeDetectorRef
).transform(this.offLineUsers[0], 'name');
offlineStr = this.translateService.instant('chat.existOfflineUser', {
offlineUser: name
});
} else if (
!!this.roomInfoSubject.value &&
this.roomInfoSubject.value.roomType === RoomType.Multi
) {
offlineStr = this.translateService.instant('chat.existOfflineUsers');
}
}
return offlineStr;
}
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);

View File

@ -238,8 +238,8 @@
"btnSticker": "Sticker", "btnSticker": "Sticker",
"btnTranslate": "Translate", "btnTranslate": "Translate",
"noRoomUser": "No chat users", "noRoomUser": "No chat users",
"existOfflineUser": "offline", "existOfflineUser": "{{offlineUser}} may not respond because it is [offline].",
"existOfflineUsers": "Some offline", "existOfflineUsers": "Some chat partners may not respond because they are not online.",
"event": { "event": {
"inviteToRoomWith": "{{owner}} invited {{inviter}}.", "inviteToRoomWith": "{{owner}} invited {{inviter}}.",
"exitFromRoomWith": "{{exitor}} has left.", "exitFromRoomWith": "{{exitor}} has left.",

View File

@ -238,8 +238,8 @@
"btnSticker": "스티커", "btnSticker": "스티커",
"btnTranslate": "번역", "btnTranslate": "번역",
"noRoomUser": "대화상대 없음", "noRoomUser": "대화상대 없음",
"existOfflineUser": "오프라인 입니다.", "existOfflineUser": "{{offlineUser}}님이 [오프라인]이므로 응답하지 않을 수도 있습니다.",
"existOfflineUsers": "일부 인원이 오프라인 입니다.", "existOfflineUsers": "일부 대화상대는 온라인 상태가 아니어서 응답하지 않을 수도 있습니다.",
"event": { "event": {
"inviteToRoomWith": "{{owner}}이 {{inviter}}을 초대했습니다.", "inviteToRoomWith": "{{owner}}이 {{inviter}}을 초대했습니다.",
"exitFromRoomWith": "{{exitor}}님이 퇴장하셨습니다.", "exitFromRoomWith": "{{exitor}}님이 퇴장하셨습니다.",