bug fixed

This commit is contained in:
Richard Park 2020-01-20 17:26:38 +09:00
parent 5bf67d8a7a
commit 243cbf0fc7

View File

@ -7,7 +7,8 @@ import {
ViewChild,
OnDestroy,
ChangeDetectionStrategy,
ElementRef
ElementRef,
ChangeDetectorRef
} from '@angular/core';
import {
@ -146,6 +147,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
constructor(
private logger: NGXLogger,
private datePipe: DatePipe,
private changeDetectorRef: ChangeDetectorRef,
private translateService: TranslateService
) {}
@ -157,12 +159,12 @@ export class MessagesComponent implements OnInit, OnDestroy {
this.loginRes = loginRes;
});
this.roomInfoSubscription = this.roomInfo$.subscribe(roomInfo => {
this.eventList = undefined;
this.newEventList = undefined;
this.searchedList = undefined;
this.eventInfoStatus = undefined;
this.eventRemained = undefined;
this.userInfos = undefined;
// this.eventList = undefined;
// this.newEventList = undefined;
// this.searchedList = undefined;
// this.eventInfoStatus = undefined;
// this.eventRemained = undefined;
// this.userInfos = undefined;
this.initEventMore();
this.roomInfo = roomInfo;
@ -180,6 +182,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
}
this.eventList = eventList;
this.changeDetectorRef.detectChanges();
if (this.searchingMode) {
const baseseq = this.baseEventSeq;
@ -284,6 +287,9 @@ export class MessagesComponent implements OnInit, OnDestroy {
}
getUnreadCount(message: Info<EventJson>): string | number {
// if (!this.userInfos || 0 === this.userInfos.length) {
// return '';
// }
const unreadCnt = this.userInfos.filter(user => {
if (message.senderSeq === user.seq) {
// 본인 글은 unreadCount 에 포함하지 않는다.
@ -392,9 +398,6 @@ export class MessagesComponent implements OnInit, OnDestroy {
setTimeout(() => {
this.scrollToBottom();
// setTimeout(() => {
// this.chatMessagesContainer.nativeElement.classList.remove('hide');
// }, 100);
});
}
@ -433,23 +436,15 @@ export class MessagesComponent implements OnInit, OnDestroy {
this.firstCheckReadHere = false;
} else {
this.virtualScroller.scrollInto(
this.eventList[this.eventList.length - 1],
this.virtualScroller.scrollToIndex(
this.eventList.length - 1,
true,
0,
0,
() => {
if (!this.scrollUpInitalized) {
this.chatMessagesContainer.nativeElement.classList.remove(
'hide'
);
}
this.chatMessagesContainer.nativeElement.classList.remove('hide');
}
);
// setTimeout(() => {
// this.psChatContent.scrollToBottom(0, speed);
// });
}
}
}