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' 'resources/notification/sounds/messageAlarm.mp3'
) )
: '', : '',
displayTime: !!noti.displayTime ? noti.displayTime : undefined,
onClick: e => { onClick: e => {
appWindow.browserWindow.flashFrame(false); appWindow.browserWindow.flashFrame(false);
if (noti.type === NotificationType.Event) { if (noti.type === NotificationType.Event) {

View File

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

View File

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