notification setting is applied

This commit is contained in:
병준 박 2019-12-20 20:25:51 +09:00
parent fb802e0bf3
commit b1fb9ba6b8
3 changed files with 53 additions and 24 deletions

View File

@ -535,6 +535,7 @@ ipcMain.on(
'resources/notification/sounds/messageAlarm.mp3'
)
: '',
displayTime: !!noti.displayTime ? noti.displayTime : undefined,
onClick: e => {
appWindow.browserWindow.flashFrame(false);
if (noti.type === NotificationType.Event) {

View File

@ -95,6 +95,10 @@ import {
SSVC_TYPE_UMG_NOTI,
UmgNotiNotification
} from '@ucap-webmessenger/protocol-umg';
import { LocalStorageService } from '@ucap-webmessenger/web-storage';
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
import { environment } from '../../environments/environment';
@Injectable()
export class AppNotificationService {
@ -107,6 +111,7 @@ export class AppNotificationService {
private buddyProtocolService: BuddyProtocolService,
private statusProtocolService: StatusProtocolService,
private umgProtocolService: UmgProtocolService,
private localStorageService: LocalStorageService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private store: Store<any>,
private logger: NGXLogger
@ -164,19 +169,31 @@ export class AppNotificationService {
// notification..
if (notiOrRes.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_NOTI) {
const notiReq: NotificationRequest = {
type: NotificationType.Event,
seq: noti.roomSeq,
title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage(
noti.eventType,
noti.message
),
image: '',
useSound: true,
interval: 0
};
this.nativeService.notify(notiReq);
const appUserInfo = this.localStorageService.encGet<
AppUserInfo
>(KEY_APP_USER_INFO, environment.customConfig.appKey);
if (appUserInfo.settings.notification.use) {
const notiReq: NotificationRequest = {
type: NotificationType.Event,
seq: noti.roomSeq,
title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage(
noti.eventType,
noti.message
),
image: '',
useSound:
'SOUND' === appUserInfo.settings.notification.method ||
'SOUND_ALERT' ===
appUserInfo.settings.notification.method
? true
: false,
displayTime:
appUserInfo.settings.notification.alertExposureTime
};
this.nativeService.notify(notiReq);
}
}
}
break;
@ -506,16 +523,27 @@ export class AppNotificationService {
);
console.log(noti);
// notification..
const notiReq: NotificationRequest = {
type: NotificationType.Message,
seq: noti.keyId,
title: '쪽지가 도착했습니다.',
contents: noti.text,
image: noti.senderInfo.profileImageFile,
useSound: true,
interval: 0
};
this.nativeService.notify(notiReq);
const appUserInfo = this.localStorageService.encGet<
AppUserInfo
>(KEY_APP_USER_INFO, environment.customConfig.appKey);
if (appUserInfo.settings.notification.use) {
const notiReq: NotificationRequest = {
type: NotificationType.Message,
seq: noti.keyId,
title: '쪽지가 도착했습니다.',
contents: noti.text,
image: noti.senderInfo.profileImageFile,
useSound:
'SOUND' === appUserInfo.settings.notification.method ||
'SOUND_ALERT' === appUserInfo.settings.notification.method
? true
: false,
displayTime:
appUserInfo.settings.notification.alertExposureTime
};
this.nativeService.notify(notiReq);
}
}
break;
default:

View File

@ -7,5 +7,5 @@ export interface NotificationRequest {
contents: string;
image: string;
useSound: boolean;
interval?: number;
displayTime?: number;
}