bug fixed

This commit is contained in:
병준 박 2019-11-29 18:32:30 +09:00
parent eb542bd923
commit bf333785b9
2 changed files with 16 additions and 8 deletions

View File

@ -16,7 +16,7 @@ import {
CreateChatDialogData, CreateChatDialogData,
CreateChatDialogResult CreateChatDialogResult
} from '@app/layouts/messenger/dialogs/chat/create-chat.dialog.component'; } from '@app/layouts/messenger/dialogs/chat/create-chat.dialog.component';
import { Observable, Subscription, of } from 'rxjs'; import { Subscription, of } from 'rxjs';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
@ -28,8 +28,7 @@ import {
UserInfoF, UserInfoF,
UserInfoDN UserInfoDN
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { MatTabChangeEvent, MatTabGroup } from '@angular/material'; import { MatTabChangeEvent } from '@angular/material';
import { RightDrawer } from '@app/types';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
@ -38,7 +37,7 @@ import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { MessageApiService } from '@ucap-webmessenger/api-message'; import { MessageApiService } from '@ucap-webmessenger/api-message';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
import { UnreadCountRequest } from 'projects/ucap-webmessenger-api-message/src/lib/apis/unread-count'; import { UnreadCountRequest } from 'projects/ucap-webmessenger-api-message/src/lib/apis/unread-count';
import { map, catchError } from 'rxjs/operators'; import { map, catchError, tap } from 'rxjs/operators';
import { MessageStatusCode } from '@ucap-webmessenger/api'; import { MessageStatusCode } from '@ucap-webmessenger/api';
export enum MainMenu { export enum MainMenu {
@ -82,6 +81,7 @@ export class LeftSideComponent implements OnInit, OnDestroy {
sessionVerinfo: VersionInfo2Response; sessionVerinfo: VersionInfo2Response;
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
@ -90,9 +90,6 @@ export class LeftSideComponent implements OnInit, OnDestroy {
private messageApiService: MessageApiService, private messageApiService: MessageApiService,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.loginRes = this.sessionStorageService.get<LoginResponse>(
KEY_LOGIN_RES_INFO
);
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO KEY_VER_INFO
); );
@ -107,6 +104,15 @@ export class LeftSideComponent implements OnInit, OnDestroy {
this.badgeChatUnReadCount = count; this.badgeChatUnReadCount = count;
}); });
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
this.loginRes = loginRes;
})
)
.subscribe();
this.getMessageUnreadCount(); this.getMessageUnreadCount();
this.badgeMessageInterval = setInterval( this.badgeMessageInterval = setInterval(
() => this.getMessageUnreadCount(), () => this.getMessageUnreadCount(),
@ -124,6 +130,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
if (!!this.badgeMessageUnReadCountSubscription) { if (!!this.badgeMessageUnReadCountSubscription) {
this.badgeMessageUnReadCountSubscription.unsubscribe(); this.badgeMessageUnReadCountSubscription.unsubscribe();
} }
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
if (!!this.badgeMessageInterval) { if (!!this.badgeMessageInterval) {
clearInterval(this.badgeMessageInterval); clearInterval(this.badgeMessageInterval);

View File

@ -62,7 +62,6 @@ export class ImageDirective implements OnInit, AfterViewInit, OnChanges {
if (!!pathChanges && !pathChanges.firstChange) { if (!!pathChanges && !pathChanges.firstChange) {
this.loadImage(); this.loadImage();
this.logger.debug('ucapImage.ngOnChanges', changes);
} }
} }