From f98acedbb2f8db0cbe71bd10442918dcd6cf00f8 Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 4 Feb 2020 09:52:43 +0900 Subject: [PATCH] bugfix : duplication message unread count retrieve --- .../components/left-nav.component.html | 4 +-- .../components/left-nav.component.ts | 30 +++++------------ .../components/left-side.component.ts | 33 +------------------ 3 files changed, 11 insertions(+), 56 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-nav.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-nav.component.html index 03a8bba4..64533d1d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-nav.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-nav.component.html @@ -34,8 +34,8 @@
; badgeMessageUnReadCount$: Observable; badgeMessageInterval: any; @@ -33,13 +26,10 @@ export class LeftNaviComponent implements OnInit, OnDestroy { constructor(private store: Store, private logger: NGXLogger) {} ngOnInit() { - this.badgeChatUnReadCountSubscription = this.store - .pipe( - select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) - ) - .subscribe(count => { - this.badgeChatUnReadCount = count; - }); + /** About Chat Badge */ + this.badgeChatUnReadCount$ = this.store.pipe( + select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) + ); /** About Message Badge */ this.badgeMessageUnReadCount$ = this.store.pipe( @@ -54,10 +44,6 @@ export class LeftNaviComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - if (!!this.badgeChatUnReadCountSubscription) { - this.badgeChatUnReadCountSubscription.unsubscribe(); - } - if (!!this.badgeMessageInterval) { clearInterval(this.badgeMessageInterval); } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts index 937549e2..63ca02fb 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts @@ -17,7 +17,7 @@ import { CreateChatDialogData, CreateChatDialogResult } from '@app/layouts/messenger/dialogs/chat/create-chat.dialog.component'; -import { Subscription, Observable, merge } from 'rxjs'; +import { Subscription, merge } from 'rxjs'; import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; @@ -76,11 +76,6 @@ export class LeftSideComponent implements OnInit, OnDestroy { onLangChangeSubscription: Subscription; - badgeChatUnReadCount: number; - badgeChatUnReadCountSubscription: Subscription; - badgeMessageUnReadCount$: Observable; - badgeMessageInterval: any; - /** 조직도에서 부서원 선택 */ selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; @@ -113,14 +108,6 @@ export class LeftSideComponent implements OnInit, OnDestroy { } ngOnInit() { - this.badgeChatUnReadCountSubscription = this.store - .pipe( - select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) - ) - .subscribe(count => { - this.badgeChatUnReadCount = count; - }); - this.loginResSubscription = this.store .pipe( select(AppStore.AccountSelector.AuthenticationSelector.loginRes), @@ -130,17 +117,6 @@ export class LeftSideComponent implements OnInit, OnDestroy { ) .subscribe(); - /** About Message Badge */ - this.badgeMessageUnReadCount$ = this.store.pipe( - select(AppStore.MessengerSelector.MessageSelector.unReadMessageCount) - ); - - this.getMessageUnreadCount(); - this.badgeMessageInterval = setInterval( - () => this.getMessageUnreadCount(), - 5 * 60 * 1000 - ); - this.setFabInitial(MainMenu.Group); this.currentTabLable = MainMenu.Group; @@ -164,19 +140,12 @@ export class LeftSideComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - if (!!this.badgeChatUnReadCountSubscription) { - this.badgeChatUnReadCountSubscription.unsubscribe(); - } if (!!this.loginResSubscription) { this.loginResSubscription.unsubscribe(); } if (!!this.onLangChangeSubscription) { this.onLangChangeSubscription.unsubscribe(); } - - if (!!this.badgeMessageInterval) { - clearInterval(this.badgeMessageInterval); - } } async onClickNewChat(type: string = 'NORMAL') {