This commit is contained in:
leejinho 2019-12-23 16:53:28 +09:00
commit a813656c0e
3 changed files with 47 additions and 9 deletions

View File

@ -24,7 +24,7 @@ import {
QueryProtocolService QueryProtocolService
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status'; import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { StatusType, StatusCode } from '@ucap-webmessenger/core'; import { StatusType, StatusCode, DeviceType } from '@ucap-webmessenger/core';
import { import {
DialogService, DialogService,
ConfirmDialogComponent, ConfirmDialogComponent,
@ -53,7 +53,9 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { import {
MessageApiService, MessageApiService,
MessageType, MessageType,
DetailRequest DetailRequest,
MessageDetailInfo,
DelRequest
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import { MessageStatusCode } from '@ucap-webmessenger/api'; import { MessageStatusCode } from '@ucap-webmessenger/api';
import { import {
@ -166,10 +168,10 @@ export class MainPageComponent implements OnInit, OnDestroy {
} as DetailRequest) } as DetailRequest)
.pipe( .pipe(
take(1), take(1),
map(res => { map(async res => {
if (res.responseCode === MessageStatusCode.Success) { if (res.responseCode === MessageStatusCode.Success) {
// detail view.. // detail view..
this.dialogService.open< const result = await this.dialogService.open<
MessageDetailDialogComponent, MessageDetailDialogComponent,
MessageDetailDialogData, MessageDetailDialogData,
MessageDetailDialogResult 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 { } else {
} }
}), }),
@ -377,4 +386,29 @@ export class MainPageComponent implements OnInit, OnDestroy {
onCloseRightDrawer() { onCloseRightDrawer() {
this.rightDrawer.close(); 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();
}
} }

View File

@ -1,4 +1,4 @@
import { Injectable, Inject } from '@angular/core'; import { Injectable, Inject, NgZone } from '@angular/core';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { import {
UCAP_NATIVE_SERVICE, UCAP_NATIVE_SERVICE,
@ -30,6 +30,7 @@ export class AppNativeService {
private publicApiService: PublicApiService, private publicApiService: PublicApiService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
@Inject(DOCUMENT) private document: Document, @Inject(DOCUMENT) private document: Document,
private ngZone: NgZone,
private store: Store<any>, private store: Store<any>,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
@ -40,8 +41,10 @@ export class AppNativeService {
}); });
this.nativeService.changeStatus().subscribe(statusCode => {}); this.nativeService.changeStatus().subscribe(statusCode => {});
this.nativeService.showSetting().subscribe(() => { this.nativeService.showSetting().subscribe(() => {
this.ngZone.run(() => {
this.store.dispatch(SettingsStore.showDialog()); this.store.dispatch(SettingsStore.showDialog());
}); });
});
} }
subscribeAfterLogin(): void { subscribeAfterLogin(): void {

View File

@ -190,7 +190,8 @@ export class AppNotificationService {
? true ? true
: false, : false,
displayTime: displayTime:
appUserInfo.settings.notification.alertExposureTime appUserInfo.settings.notification.alertExposureTime *
1000
}; };
this.nativeService.notify(notiReq); this.nativeService.notify(notiReq);
} }
@ -540,7 +541,7 @@ export class AppNotificationService {
? true ? true
: false, : false,
displayTime: displayTime:
appUserInfo.settings.notification.alertExposureTime appUserInfo.settings.notification.alertExposureTime * 1000
}; };
this.nativeService.notify(notiReq); this.nativeService.notify(notiReq);
} }