diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 98110195..bec8dde9 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -28,7 +28,8 @@ import { NotificationChannel, ChatChannel, MessengerChannel, - MessageChannel + MessageChannel, + AppChannel } from '@ucap-webmessenger/native-electron'; import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification'; import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window'; @@ -231,8 +232,7 @@ function createTray() { // selector: 'terminate:', click: () => { // 메신저에 로그아웃 후 종료 - appWindow = null; - app.exit(); + appExit(); } } ]); @@ -715,6 +715,10 @@ ipcMain.on( } ); +ipcMain.on(AppChannel.Exit, (event: IpcMainEvent, ...args: any[]) => { + appExit(); +}); + autoUpdater.on('checking-for-update', () => { log.info('Checking for update...'); }); @@ -748,3 +752,8 @@ autoUpdater.on('update-downloaded', info => { updateWindowService.setDownloadComplete(); autoUpdater.quitAndInstall(true, true); }); + +function appExit() { + appWindow = null; + app.exit(); +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index f1f11d22..a86d852e 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -563,7 +563,8 @@ export class GroupComponent implements OnInit, OnDestroy { >(SelectGroupDialogComponent, { width: '600px', data: { - title: this.translateService.instant('group.selectTargetGroup') + title: this.translateService.instant('group.selectTargetGroup'), + ignoreGroup: [group] } }); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html index ea4bcd20..4f968eb7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html @@ -88,10 +88,10 @@ -
+
- +
-
- +
+ + +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html index b00f5106..77995867 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html @@ -81,6 +81,7 @@ (click)="onToggleUser(userInfo)" (contextmenu)="onContextMenuOrgUser($event, userInfo)" [matTooltip]="getTooltip(userInfo)" + matTooltipShowDelay="500" matTooltipPosition="after" > @@ -105,6 +106,7 @@ (click)="onToggleUser(userInfo)" (contextmenu)="onContextMenuOrgUser($event, userInfo)" [matTooltip]="getTooltip(userInfo)" + matTooltipShowDelay="500" matTooltipPosition="after" > diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index ba4ec505..7177bf8f 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -638,170 +638,190 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { if (!!this.isShowTranslation && this.destLocale.trim().length > 0) { /** CASE : Translation */ - const destLocale = this.destLocale; - const original = message; - const roomSeq = this.roomInfoSubject.value.roomSeq; - - if (!!this.isTranslationProcess) { - return; + // 번역할 대화 없이 스티커만 전송할 경우. + if (!message || message.trim().length === 0) { + this.sendMessageOfSticker(message); + } else { + this.sendMessageOfTranslate(message); } - - this.isTranslationProcess = true; - this.commonApiService - .translationSave({ - userSeq: this.loginResSubject.value.userSeq, - deviceType: this.environmentsInfo.deviceType, - token: this.loginResSubject.value.tokenString, - roomSeq, - original, - srcLocale: '', - destLocale - } as TranslationSaveRequest) - .pipe( - take(1), - map(res => { - if (res.statusCode === StatusCode.Success) { - let sentMessage = ''; - let eventType = EventType.Translation; - let previewObject: - | TranslationEventJson - | MassTranslationEventJson; - - if (res.translationSeq > 0) { - // Mass Text Translation - previewObject = res; - sentMessage = res.returnJson; - eventType = EventType.MassTranslation; - } else { - // Normal Text Translation - previewObject = { - locale: destLocale, - original, - translation: res.translation, - stickername: '', - stickerfile: !!this.selectedSticker - ? this.selectedSticker.index - : '' - }; - - sentMessage = JSON.stringify(previewObject); - eventType = EventType.Translation; - } - - if (!!this.translationPreview) { - // preview - this.translationPreviewInfo = { - previewInfo: res, - translationType: eventType - }; - } else { - // direct send - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq, - eventType, - sentMessage - } - }) - ); - - if (!!this.translationPreviewInfo) { - this.translationPreviewInfo = null; - } - } - - if (!!this.selectedSticker) { - this.isShowStickerSelector = false; - this.setStickerHistory(this.selectedSticker); - this.selectedSticker = null; - } - } else { - this.logger.error(res); - } - }), - catchError(error => of(this.logger.error(error))) - ) - .subscribe(() => { - this.isTranslationProcess = false; - }); } else if (!!this.selectedSticker) { /** CASE : Sticker */ - if ( - !!message && - message.trim().length > - environment.productConfig.CommonSetting.masstextLength - ) { - const result = await this.dialogService.open< - AlertDialogComponent, - AlertDialogData, - AlertDialogResult - >(AlertDialogComponent, { - width: '360px', - data: { - title: this.translateService.instant('chat.errors.label'), - message: this.translateService.instant( - 'chat.errors.maxLengthOfMassText', - { - maxLength: - environment.productConfig.CommonSetting.masstextLength - } - ) - } - }); - return; - } - - const stickerJson: StickerEventJson = { - name: '스티커', - file: this.selectedSticker.index, - chat: !!message ? message.trim() : '' - }; - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.Sticker, - sentMessage: JSON.stringify(stickerJson) - } - }) - ); - this.isShowStickerSelector = false; - this.setStickerHistory(this.selectedSticker); - this.selectedSticker = null; + this.sendMessageOfSticker(message); } else if ( message.trim().length > environment.productConfig.CommonSetting.masstextLength ) { /** CASE : MASS TEXT */ - this.store.dispatch( - EventStore.sendMass({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.MassText, - // sentMessage: message.replace(/\n/gi, '\r\n') - sentMessage: message - } - }) - ); + this.sendMessageOfMassText(message); } else { /** CASE : Normal Text */ - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.Character, - sentMessage: message - } - }) - ); + this.sendMessageOfNormal(message); } } + /** Send Normal message */ + sendMessageOfNormal(message: string) { + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.Character, + sentMessage: message + } + }) + ); + } + /** Send Sticker message */ + async sendMessageOfSticker(message: string, isCheck: boolean = true) { + if ( + !!isCheck && + !!message && + message.trim().length > + environment.productConfig.CommonSetting.masstextLength + ) { + const result = await this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + width: '360px', + data: { + title: this.translateService.instant('chat.errors.label'), + message: this.translateService.instant( + 'chat.errors.maxLengthOfMassText', + { + maxLength: environment.productConfig.CommonSetting.masstextLength + } + ) + } + }); + return; + } + + const stickerJson: StickerEventJson = { + name: '스티커', + file: this.selectedSticker.index, + chat: !!message ? message.trim() : '' + }; + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.Sticker, + sentMessage: JSON.stringify(stickerJson) + } + }) + ); + this.isShowStickerSelector = false; + this.setStickerHistory(this.selectedSticker); + this.selectedSticker = null; + } + /** Send Masstext message */ + sendMessageOfMassText(message: string) { + this.store.dispatch( + EventStore.sendMass({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.MassText, + // sentMessage: message.replace(/\n/gi, '\r\n') + sentMessage: message + } + }) + ); + } + /** Send Translation message */ + sendMessageOfTranslate(message: string) { + const destLocale = this.destLocale; + const original = message; + const roomSeq = this.roomInfoSubject.value.roomSeq; + + if (!!this.isTranslationProcess) { + return; + } + + this.isTranslationProcess = true; + this.commonApiService + .translationSave({ + userSeq: this.loginResSubject.value.userSeq, + deviceType: this.environmentsInfo.deviceType, + token: this.loginResSubject.value.tokenString, + roomSeq, + original, + srcLocale: '', + destLocale + } as TranslationSaveRequest) + .pipe( + take(1), + map(res => { + if (res.statusCode === StatusCode.Success) { + let sentMessage = ''; + let eventType = EventType.Translation; + let previewObject: TranslationEventJson | MassTranslationEventJson; + + if (res.translationSeq > 0) { + // Mass Text Translation + previewObject = res; + sentMessage = res.returnJson; + eventType = EventType.MassTranslation; + } else { + // Normal Text Translation + previewObject = { + locale: destLocale, + original, + translation: res.translation, + stickername: '', + stickerfile: !!this.selectedSticker + ? this.selectedSticker.index + : '' + }; + + sentMessage = JSON.stringify(previewObject); + eventType = EventType.Translation; + } + + if (!!this.translationPreview) { + // preview + this.translationPreviewInfo = { + previewInfo: res, + translationType: eventType + }; + } else { + // direct send + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq, + eventType, + sentMessage + } + }) + ); + + if (!!this.translationPreviewInfo) { + this.translationPreviewInfo = null; + } + } + + if (!!this.selectedSticker) { + this.isShowStickerSelector = false; + this.setStickerHistory(this.selectedSticker); + this.selectedSticker = null; + } + } else { + this.logger.error(res); + } + }), + catchError(error => of(this.logger.error(error))) + ) + .subscribe(() => { + this.isTranslationProcess = false; + }); + } + onClickReceiveAlarm() { this.store.dispatch( RoomStore.updateOnlyAlarm({ roomInfo: this.roomInfoSubject.value }) @@ -1592,6 +1612,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { const trgtUserSeq: number[] = []; result.group.userSeqs.map(seq => trgtUserSeq.push(seq)); this.userInfoListSubject.value + .filter(v => v.isJoinRoom) .filter(v => result.group.userSeqs.indexOf(v.seq) < 0) .forEach(user => { trgtUserSeq.push(user.seq); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html index 7920b211..bfe1f51d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html @@ -63,6 +63,7 @@ {{ groupBuddy.group.name }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts index 20918071..9504004b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts @@ -24,6 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; export interface SelectGroupDialogData { title: string; + ignoreGroup?: GroupDetailData[]; } export interface SelectGroupDialogResult { @@ -71,6 +72,44 @@ export class SelectGroupDialogComponent implements OnInit { ) ]).pipe( map(([buddyList, groupList]) => { + // sort.. + if (!!groupList && groupList.length > 0) { + const tempOrderArr: GroupDetailData[] = []; + let myDeptGroup: GroupDetailData; + let defaultGroup: GroupDetailData; + const normalGroup: GroupDetailData[] = []; + + groupList.forEach(group => { + if ( + !!environment.productConfig.CommonSetting.useMyDeptGroup && + environment.productConfig.CommonSetting.myDeptGroupSeq === + group.seq + ) { + myDeptGroup = group; + } else if (0 === group.seq) { + defaultGroup = group; + } else { + normalGroup.push(group); + } + }); + + if (!!myDeptGroup) { + tempOrderArr.push(myDeptGroup); + } + + tempOrderArr.push( + ...normalGroup.sort((a, b) => + a.name < b.name ? -1 : a.name > b.name ? 1 : 0 + ) + ); + + if (!!defaultGroup) { + tempOrderArr.push(defaultGroup); + } + + groupList = tempOrderArr; + } + /** 수정불가 그룹 */ let fixedGroupSeqs: number[]; if (!!environment.productConfig.CommonSetting.fixedGroupSeqs) { @@ -90,6 +129,17 @@ export class SelectGroupDialogComponent implements OnInit { } } + /** 선택 무시 그룹 필터링. */ + if (!!this.data.ignoreGroup && this.data.ignoreGroup.length > 0) { + if ( + this.data.ignoreGroup.filter( + groupDetail => groupDetail.seq === group.seq + ).length > 0 + ) { + continue; + } + } + groupBuddyList.push({ group, buddyList: buddyList.filter(buddy => { @@ -140,4 +190,18 @@ export class SelectGroupDialogComponent implements OnInit { group: this.selectedGroup }); } + + getDisabled(groupBuddyList: { + group: GroupDetailData; + buddyList: UserInfo[]; + }): boolean { + if (!!this.data.ignoreGroup && this.data.ignoreGroup.length > 0) { + return ( + this.data.ignoreGroup.filter( + groupDetail => groupDetail.seq === groupBuddyList.group.seq + ).length > 0 + ); + } + return false; + } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html index 9cc4cb61..7604d648 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html @@ -257,27 +257,28 @@ yPosition="below" (closed)="onClosedProfileMenu($event)" > -
- -
-
- -
- -
- -
-
- -
-
- -
- -
- -
- -
- -
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ -
- -
-
- - -
-
- -
-
- -
-
- -
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+
-
- {{ 'presence.settingOfAwayTime' | translate }} -
- -
- - {{ awayTime }}{{ 'common.units.minute' | translate }} + +
+ {{ 'presence.settingOfAwayTime' | translate }}
- + +
+ + {{ awayTime + }}{{ 'common.units.minute' | translate }} +
+
+
+<<<<<<< HEAD + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts index 8d657c49..021a4412 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts @@ -309,6 +309,10 @@ export class TopBarComponent implements OnInit, OnDestroy { this.store.dispatch(AuthenticationStore.logoutConfirmation()); } + onClickQuit(): void { + this.nativeService.appExit(); + } + getMyProfileImageWidget(): string { if (!!this.loginRes) { return this.loginRes.userInfo.profileImageFile; diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/en.json b/projects/ucap-webmessenger-app/src/assets/i18n/en.json index d7f892f4..40e42f6d 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/en.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/en.json @@ -406,6 +406,7 @@ } }, "messages": { + "quit": "Quit", "yes": "Yes", "no": "No", "confirm": "Confirm", diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json index 75795d8e..a5de9e29 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json @@ -406,6 +406,7 @@ } }, "messages": { + "quit": "종료", "yes": "예", "no": "아니오", "confirm": "확인", diff --git a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts index dd3a7db5..5acb611f 100644 --- a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts +++ b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts @@ -221,6 +221,8 @@ export class BrowserNativeService extends NativeService { windowMaximize(): void {} + appExit(): void {} + zoomTo(factor: number): Promise { return new Promise((resolve, reject) => { resolve(-1); diff --git a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts index 97fdfb19..4ef37352 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts @@ -22,7 +22,8 @@ import { ChatChannel, MessengerChannel, MessageChannel, - ProcessChannel + ProcessChannel, + AppChannel } from '../types/channel.type'; import { Injectable } from '@angular/core'; import { TranslateLoaderService } from '../translate/electron-loader'; @@ -388,6 +389,10 @@ export class ElectronNativeService implements NativeService { } } + appExit(): void { + this.ipcRenderer.send(AppChannel.Exit); + } + zoomTo(factor: number): Promise { return new Promise((resolve, reject) => { try { diff --git a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts index 611c8d76..f9f210de 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts @@ -53,3 +53,7 @@ export enum IdleStateChannel { StartCheck = 'UCAP::idleState::startCheck', ChangeLimitTime = 'UCAP::idleState::changeLimitTime' } + +export enum AppChannel { + Exit = 'UCAP::app::exit' +} diff --git a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts index d4967761..55334b9c 100644 --- a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts +++ b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts @@ -68,6 +68,7 @@ export abstract class NativeService { abstract windowMinimize(): void; abstract windowMaximize(): void; abstract zoomTo(factor: number): Promise; + abstract appExit(): void; abstract idleStateChanged(): Observable; abstract changeLimitOfIdleState(limitTime: number): void; diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts index 1587a7bd..6c16307f 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts @@ -142,6 +142,7 @@ export class MessagesComponent implements OnInit, OnDestroy { readToHereEvent: Info; swapped = false; + hidden = false; constructor( private logger: NGXLogger, @@ -384,9 +385,10 @@ export class MessagesComponent implements OnInit, OnDestroy { to: Info, preCallback: () => void, postCallback: () => void, - useSwap: boolean = true + useHide: boolean, + useSwap: boolean ) { - this.preSwapScroll(useSwap); + this.preSwapScroll(useHide, useSwap); if (!!preCallback) { preCallback(); } @@ -395,12 +397,12 @@ export class MessagesComponent implements OnInit, OnDestroy { if (!!postCallback) { postCallback(); } - this.postSwapScroll(useSwap); + this.postSwapScroll(useHide, useSwap); }, 100); }); } - preSwapScroll(useSwap: boolean = true) { + preSwapScroll(useHide: boolean, useSwap: boolean) { if (useSwap && !this.swapped) { this.chatMessagesBuffer.nativeElement.innerHTML = this.chatMessagesContainer.nativeElement.innerHTML; this.chatMessagesBuffer.nativeElement.scrollTop = this.chatMessagesContainer.nativeElement.scrollTop; @@ -408,10 +410,13 @@ export class MessagesComponent implements OnInit, OnDestroy { this.swapped = true; } - this.chatMessagesContainer.nativeElement.classList.add('hide'); + if (useHide && !this.hidden) { + this.chatMessagesContainer.nativeElement.classList.add('hide'); + this.hidden = true; + } } - postSwapScroll(useSwap: boolean = true) { + postSwapScroll(useHide: boolean, useSwap: boolean) { if (useSwap && this.swapped) { this.chatMessagesBuffer.nativeElement.innerHTML = ''; this.chatMessagesBuffer.nativeElement.scrollTop = 0; @@ -419,7 +424,10 @@ export class MessagesComponent implements OnInit, OnDestroy { this.swapped = false; } - this.chatMessagesContainer.nativeElement.classList.remove('hide'); + if (useHide && this.hidden) { + this.chatMessagesContainer.nativeElement.classList.remove('hide'); + this.hidden = false; + } } ready(): void { @@ -434,7 +442,9 @@ export class MessagesComponent implements OnInit, OnDestroy { () => {}, () => { this.firstCheckReadHere = false; - } + }, + true, + true ); } else { this.swapScroll( @@ -442,7 +452,9 @@ export class MessagesComponent implements OnInit, OnDestroy { () => {}, () => { this.storedScrollItem = undefined; - } + }, + true, + true ); } } else if (this.scrollUpInitalized) { @@ -460,15 +472,31 @@ export class MessagesComponent implements OnInit, OnDestroy { () => {}, () => { this.firstCheckReadHere = false; - } + }, + true, + true ); } else { - this.swapScroll( - this.eventList[this.eventList.length - 1], - () => {}, - () => {}, - false - ); + if ( + this.virtualScroller.viewPortInfo.endIndex === + this.eventList.length - 2 + ) { + this.swapScroll( + this.eventList[this.eventList.length - 1], + () => {}, + () => {}, + false, + false + ); + } else { + this.swapScroll( + this.eventList[this.eventList.length - 1], + () => {}, + () => {}, + true, + false + ); + } } } } @@ -499,7 +527,7 @@ export class MessagesComponent implements OnInit, OnDestroy { if (this.scrollUpInitalized && this.eventRemained) { this.storeScrollPosition(); - this.preSwapScroll(); + this.preSwapScroll(true, true); this.moreEvent.emit(this.eventList[0].seq);