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
} 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();
}
}

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 {
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<any>,
private logger: NGXLogger
) {}
@ -40,8 +41,10 @@ export class AppNativeService {
});
this.nativeService.changeStatus().subscribe(statusCode => {});
this.nativeService.showSetting().subscribe(() => {
this.ngZone.run(() => {
this.store.dispatch(SettingsStore.showDialog());
});
});
}
subscribeAfterLogin(): void {

View File

@ -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);
}