diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index cb813086..e16fe64d 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -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) { 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 adc1185b..7553bc51 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -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, 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: diff --git a/projects/ucap-webmessenger-native/src/lib/models/notification.ts b/projects/ucap-webmessenger-native/src/lib/models/notification.ts index d1de44ed..0403e156 100644 --- a/projects/ucap-webmessenger-native/src/lib/models/notification.ts +++ b/projects/ucap-webmessenger-native/src/lib/models/notification.ts @@ -7,5 +7,5 @@ export interface NotificationRequest { contents: string; image: string; useSound: boolean; - interval?: number; + displayTime?: number; }