From 77ac22d12206e4b44a7c8f7eef09280c25e64f0b Mon Sep 17 00:00:00 2001 From: Richard Park Date: Mon, 23 Dec 2019 14:47:35 +0900 Subject: [PATCH] message notification is modified --- .../components/main.page.component.ts | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts index 7d885103..4db4588c 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts @@ -5,7 +5,8 @@ import { Inject, OnDestroy, ViewChild, - ChangeDetectorRef + ChangeDetectorRef, + NgZone } from '@angular/core'; import { Store, select } from '@ngrx/store'; @@ -86,6 +87,7 @@ export class MainPageComponent implements OnInit, OnDestroy { constructor( @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private store: Store, + private ngZone: NgZone, private statusProtocolService: StatusProtocolService, private messageApiService: MessageApiService, private daesangProtocolService: DaesangProtocolService, @@ -153,39 +155,41 @@ export class MainPageComponent implements OnInit, OnDestroy { .subscribe(messageSeq => { console.log(messageSeq); - // this.messageApiService - // .detailMessage({ - // userSeq: this.loginRes.userSeq, - // deviceType: this.environmentsInfo.deviceType, - // tokenKey: this.loginRes.tokenString, - // type: MessageType.Receive, - // msgId: Number(messageSeq) - // } as DetailRequest) - // .pipe( - // take(1), - // map(res => { - // if (res.responseCode === MessageStatusCode.Success) { - // // detail view.. - // this.dialogService.open< - // MessageDetailDialogComponent, - // MessageDetailDialogData, - // MessageDetailDialogResult - // >(MessageDetailDialogComponent, { - // width: '600px', - // data: { - // detail: res, - // loginRes: this.loginRes, - // environmentsInfo: this.environmentsInfo - // } - // }); + this.ngZone.run(() => { + this.messageApiService + .detailMessage({ + userSeq: this.loginRes.userSeq, + deviceType: this.environmentsInfo.deviceType, + tokenKey: this.loginRes.tokenString, + type: MessageType.Receive, + msgId: Number(messageSeq) + } as DetailRequest) + .pipe( + take(1), + map(res => { + if (res.responseCode === MessageStatusCode.Success) { + // detail view.. + this.dialogService.open< + MessageDetailDialogComponent, + MessageDetailDialogData, + MessageDetailDialogResult + >(MessageDetailDialogComponent, { + width: '600px', + data: { + detail: res, + loginRes: this.loginRes, + environmentsInfo: this.environmentsInfo + } + }); - // // this.changeDetectorRef.detectChanges(); - // } else { - // } - // }), - // catchError(error => of(this.logger.error(error))) - // ) - // .subscribe(); + // this.changeDetectorRef.detectChanges(); + } else { + } + }), + catchError(error => of(this.logger.error(error))) + ) + .subscribe(); + }); }); this.loginResSubscription = this.store