1. 알림 버그 수정 :: 알림, 소리, 알림+소리 변경시 소리 안나는 버그 수정.

2. 소리로 설정시 알림 안뜨고 소리만 날 수 있도록 수정.
3. 쪽지 수신시 자동 팝업 오픈 기능 추가.
This commit is contained in:
leejinho 2020-01-02 10:29:21 +09:00
parent 2b5d80a3d2
commit dbf62d321b
5 changed files with 105 additions and 58 deletions

View File

@ -45,8 +45,13 @@ import { OpenProfileOptions } from '@ucap-webmessenger/protocol-buddy';
import { DaesangProtocolService, SmsUtils } from '@ucap-webmessenger/daesang'; import { DaesangProtocolService, SmsUtils } from '@ucap-webmessenger/daesang';
import { CallService } from '@ucap-webmessenger/api-prompt'; import { CallService } from '@ucap-webmessenger/api-prompt';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import {
import { MessageApiService, MessageType } from '@ucap-webmessenger/api-message'; SessionStorageService,
LocalStorageService
} from '@ucap-webmessenger/web-storage';
import { MessageType } from '@ucap-webmessenger/api-message';
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
import { environment } from '../../../../environments/environment';
@Component({ @Component({
selector: 'app-page-messenger-main', selector: 'app-page-messenger-main',
@ -74,9 +79,9 @@ export class MainPageComponent implements OnInit, OnDestroy {
private store: Store<any>, private store: Store<any>,
private ngZone: NgZone, private ngZone: NgZone,
private statusProtocolService: StatusProtocolService, private statusProtocolService: StatusProtocolService,
private messageApiService: MessageApiService,
private daesangProtocolService: DaesangProtocolService, private daesangProtocolService: DaesangProtocolService,
private callService: CallService, private callService: CallService,
private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private dialogService: DialogService, private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
@ -137,6 +142,13 @@ export class MainPageComponent implements OnInit, OnDestroy {
this.msgOpenMessageSubscription = this.nativeService this.msgOpenMessageSubscription = this.nativeService
.msgOpenMessage() .msgOpenMessage()
.subscribe(messageSeq => { .subscribe(messageSeq => {
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
KEY_APP_USER_INFO,
environment.customConfig.appKey
);
// direct open detail
if (!appUserInfo.settings.notification.receiveForMessage) {
// unreadCount refresh.. // unreadCount refresh..
this.store.dispatch(MessageStore.retrieveUnreadCount({})); this.store.dispatch(MessageStore.retrieveUnreadCount({}));
@ -152,6 +164,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
}) })
); );
}); });
}
}); });
this.loginResSubscription = this.store this.loginResSubscription = this.store

View File

@ -210,13 +210,22 @@ export class AppNotificationService {
>(KEY_APP_USER_INFO, environment.customConfig.appKey); >(KEY_APP_USER_INFO, environment.customConfig.appKey);
if (appUserInfo.settings.notification.use) { if (appUserInfo.settings.notification.use) {
if (
appUserInfo.settings.notification.method ===
NotificationMethod.Sound
) {
const audio = new Audio(
'assets/sounds/messageAlarm.mp3'
);
audio.play();
} else {
const notiReq: NotificationRequest = { const notiReq: NotificationRequest = {
type: NotificationType.Event, type: NotificationType.Event,
seq: noti.roomSeq, seq: noti.roomSeq,
title: '메세지가 도착했습니다.', title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage( contents: StringUtil.convertFinalEventMessage(
noti.eventType, noti.eventType,
noti.message noti.info.sentMessageJson
), ),
image: '', image: '',
useSound: [ useSound: [
@ -228,14 +237,15 @@ export class AppNotificationService {
? true ? true
: false, : false,
displayTime: displayTime:
appUserInfo.settings.notification.alertExposureTime * appUserInfo.settings.notification
1000 .alertExposureTime * 1000
}; };
this.nativeService.notify(notiReq); this.nativeService.notify(notiReq);
} }
} }
} }
} }
}
break; break;
case SSVC_TYPE_EVENT_READ_RES: case SSVC_TYPE_EVENT_READ_RES:
case SSVC_TYPE_EVENT_READ_NOTI: case SSVC_TYPE_EVENT_READ_NOTI:
@ -578,6 +588,13 @@ export class AppNotificationService {
>(KEY_APP_USER_INFO, environment.customConfig.appKey); >(KEY_APP_USER_INFO, environment.customConfig.appKey);
if (appUserInfo.settings.notification.use) { if (appUserInfo.settings.notification.use) {
if (
appUserInfo.settings.notification.method ===
NotificationMethod.Sound
) {
const audio = new Audio('assets/sounds/messageAlarm.mp3');
audio.play();
} else {
const notiReq: NotificationRequest = { const notiReq: NotificationRequest = {
type: NotificationType.Message, type: NotificationType.Message,
seq: noti.keyId, seq: noti.keyId,
@ -587,15 +604,29 @@ export class AppNotificationService {
useSound: [ useSound: [
NotificationMethod.Sound, NotificationMethod.Sound,
NotificationMethod.SoundAndAlert NotificationMethod.SoundAndAlert
].some(n => n === appUserInfo.settings.notification.method) ].some(
n => n === appUserInfo.settings.notification.method
)
? true ? true
: false, : false,
displayTime: displayTime:
appUserInfo.settings.notification.alertExposureTime * 1000 appUserInfo.settings.notification.alertExposureTime *
1000
}; };
this.nativeService.notify(notiReq); this.nativeService.notify(notiReq);
} }
} }
// direct open detail
if (appUserInfo.settings.notification.receiveForMessage) {
this.store.dispatch(
MessageStore.detailMessage({
messageType: MessageType.Receive,
msgId: Number(noti.keyId)
})
);
}
}
break; break;
default: default:
break; break;

View File

@ -24,13 +24,13 @@
[value]="setting.method" [value]="setting.method"
(selectionChange)="onSelectionChangeMethod($event)" (selectionChange)="onSelectionChangeMethod($event)"
> >
<mat-option value="SOUND"> <mat-option [value]="NotificationMethod.Sound">
소리 소리
</mat-option> </mat-option>
<mat-option value="ALERT"> <mat-option [value]="NotificationMethod.Alert">
알림창 알림창
</mat-option> </mat-option>
<mat-option value="SOUND_ALERT"> <mat-option [value]="NotificationMethod.SoundAndAlert">
소리 + 알림창 소리 + 알림창
</mat-option> </mat-option>
</mat-select> </mat-select>

View File

@ -13,6 +13,7 @@ import {
MatCheckboxChange MatCheckboxChange
} from '@angular/material'; } from '@angular/material';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { NotificationMethod } from '@ucap-webmessenger/core';
@Component({ @Component({
selector: 'ucap-settings-notification', selector: 'ucap-settings-notification',
@ -26,6 +27,8 @@ export class NotificationComponent implements OnInit {
@Output() @Output()
changed = new EventEmitter<NotificationSetting>(); changed = new EventEmitter<NotificationSetting>();
NotificationMethod = NotificationMethod;
constructor( constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private logger: NGXLogger private logger: NGXLogger