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 4db4588c..b6997e94 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 @@ -24,7 +24,7 @@ import { QueryProtocolService } from '@ucap-webmessenger/protocol-query'; import { StatusProtocolService } from '@ucap-webmessenger/protocol-status'; -import { StatusType, StatusCode } from '@ucap-webmessenger/core'; +import { StatusType, StatusCode, DeviceType } from '@ucap-webmessenger/core'; import { DialogService, ConfirmDialogComponent, @@ -53,7 +53,9 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { MessageApiService, MessageType, - DetailRequest + DetailRequest, + MessageDetailInfo, + DelRequest } from '@ucap-webmessenger/api-message'; import { MessageStatusCode } from '@ucap-webmessenger/api'; import { @@ -166,10 +168,10 @@ export class MainPageComponent implements OnInit, OnDestroy { } as DetailRequest) .pipe( take(1), - map(res => { + map(async res => { if (res.responseCode === MessageStatusCode.Success) { // detail view.. - this.dialogService.open< + const result = await this.dialogService.open< MessageDetailDialogComponent, MessageDetailDialogData, MessageDetailDialogResult @@ -182,7 +184,14 @@ export class MainPageComponent implements OnInit, OnDestroy { } }); - // this.changeDetectorRef.detectChanges(); + if (!!result) { + switch (result.returnType) { + case 'DEL': + // 단건 삭제. + this.doMessageDelete([result.messageInfo]); + break; + } + } } else { } }), @@ -377,4 +386,29 @@ export class MainPageComponent implements OnInit, OnDestroy { onCloseRightDrawer() { this.rightDrawer.close(); } + + /** 쪽지(수신,발신) 삭제 */ + doMessageDelete(messageInfo: MessageDetailInfo[]): void { + const msgList: { msgId: number }[] = []; + messageInfo.forEach(info => msgList.push({ msgId: info.msgId })); + this.messageApiService + .deleteMessage({ + userSeq: this.loginRes.userSeq, + deviceType: DeviceType.PC, + tokenKey: this.loginRes.tokenString, + type: messageInfo[0].type, + msgList + } as DelRequest) + .pipe( + take(1), + map(async res => { + if (res.responseCode === MessageStatusCode.Success) { + } else { + this.logger.error('message delete Error!'); + } + }), + catchError(error => of(this.logger.error(error))) + ) + .subscribe(); + } } diff --git a/projects/ucap-webmessenger-app/src/app/services/native.service.ts b/projects/ucap-webmessenger-app/src/app/services/native.service.ts index 41eb4c89..f10c25e1 100644 --- a/projects/ucap-webmessenger-app/src/app/services/native.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/native.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Inject } from '@angular/core'; +import { Injectable, Inject, NgZone } from '@angular/core'; import { DOCUMENT } from '@angular/common'; import { UCAP_NATIVE_SERVICE, @@ -30,6 +30,7 @@ export class AppNativeService { private publicApiService: PublicApiService, private sessionStorageService: SessionStorageService, @Inject(DOCUMENT) private document: Document, + private ngZone: NgZone, private store: Store, private logger: NGXLogger ) {} @@ -40,7 +41,9 @@ export class AppNativeService { }); this.nativeService.changeStatus().subscribe(statusCode => {}); this.nativeService.showSetting().subscribe(() => { - this.store.dispatch(SettingsStore.showDialog()); + this.ngZone.run(() => { + this.store.dispatch(SettingsStore.showDialog()); + }); }); } diff --git a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts index 7553bc51..a92251d3 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -190,7 +190,8 @@ export class AppNotificationService { ? true : false, displayTime: - appUserInfo.settings.notification.alertExposureTime + appUserInfo.settings.notification.alertExposureTime * + 1000 }; this.nativeService.notify(notiReq); } @@ -540,7 +541,7 @@ export class AppNotificationService { ? true : false, displayTime: - appUserInfo.settings.notification.alertExposureTime + appUserInfo.settings.notification.alertExposureTime * 1000 }; this.nativeService.notify(notiReq); }