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 { CallService } from '@ucap-webmessenger/api-prompt';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { MessageApiService, MessageType } from '@ucap-webmessenger/api-message';
import {
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({
selector: 'app-page-messenger-main',
@ -74,9 +79,9 @@ export class MainPageComponent implements OnInit, OnDestroy {
private store: Store<any>,
private ngZone: NgZone,
private statusProtocolService: StatusProtocolService,
private messageApiService: MessageApiService,
private daesangProtocolService: DaesangProtocolService,
private callService: CallService,
private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
private logger: NGXLogger
@ -137,6 +142,13 @@ export class MainPageComponent implements OnInit, OnDestroy {
this.msgOpenMessageSubscription = this.nativeService
.msgOpenMessage()
.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..
this.store.dispatch(MessageStore.retrieveUnreadCount({}));
@ -152,6 +164,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
})
);
});
}
});
this.loginResSubscription = this.store

View File

@ -210,13 +210,22 @@ export class AppNotificationService {
>(KEY_APP_USER_INFO, environment.customConfig.appKey);
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 = {
type: NotificationType.Event,
seq: noti.roomSeq,
title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage(
noti.eventType,
noti.message
noti.info.sentMessageJson
),
image: '',
useSound: [
@ -228,14 +237,15 @@ export class AppNotificationService {
? true
: false,
displayTime:
appUserInfo.settings.notification.alertExposureTime *
1000
appUserInfo.settings.notification
.alertExposureTime * 1000
};
this.nativeService.notify(notiReq);
}
}
}
}
}
break;
case SSVC_TYPE_EVENT_READ_RES:
case SSVC_TYPE_EVENT_READ_NOTI:
@ -578,6 +588,13 @@ export class AppNotificationService {
>(KEY_APP_USER_INFO, environment.customConfig.appKey);
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 = {
type: NotificationType.Message,
seq: noti.keyId,
@ -587,15 +604,29 @@ export class AppNotificationService {
useSound: [
NotificationMethod.Sound,
NotificationMethod.SoundAndAlert
].some(n => n === appUserInfo.settings.notification.method)
].some(
n => n === appUserInfo.settings.notification.method
)
? true
: false,
displayTime:
appUserInfo.settings.notification.alertExposureTime * 1000
appUserInfo.settings.notification.alertExposureTime *
1000
};
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;
default:
break;

View File

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

View File

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