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,21 +142,29 @@ export class MainPageComponent implements OnInit, OnDestroy {
this.msgOpenMessageSubscription = this.nativeService this.msgOpenMessageSubscription = this.nativeService
.msgOpenMessage() .msgOpenMessage()
.subscribe(messageSeq => { .subscribe(messageSeq => {
// unreadCount refresh.. const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
this.store.dispatch(MessageStore.retrieveUnreadCount({})); KEY_APP_USER_INFO,
environment.customConfig.appKey
);
this.ngZone.run(() => { // direct open detail
/** if (!appUserInfo.settings.notification.receiveForMessage) {
* . // unreadCount refresh..
* state Message.component.ts . this.store.dispatch(MessageStore.retrieveUnreadCount({}));
*/
this.store.dispatch( this.ngZone.run(() => {
MessageStore.detailMessage({ /**
messageType: MessageType.Receive, * .
msgId: Number(messageSeq) * state Message.component.ts .
}) */
); this.store.dispatch(
}); MessageStore.detailMessage({
messageType: MessageType.Receive,
msgId: Number(messageSeq)
})
);
});
}
}); });
this.loginResSubscription = this.store this.loginResSubscription = this.store

View File

@ -210,28 +210,38 @@ 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) {
const notiReq: NotificationRequest = { if (
type: NotificationType.Event, appUserInfo.settings.notification.method ===
seq: noti.roomSeq, NotificationMethod.Sound
title: '메세지가 도착했습니다.', ) {
contents: StringUtil.convertFinalEventMessage( const audio = new Audio(
noti.eventType, 'assets/sounds/messageAlarm.mp3'
noti.message );
), audio.play();
image: '', } else {
useSound: [ const notiReq: NotificationRequest = {
NotificationMethod.Sound, type: NotificationType.Event,
NotificationMethod.SoundAndAlert seq: noti.roomSeq,
].some( title: '메세지가 도착했습니다.',
n => n === appUserInfo.settings.notification.method contents: StringUtil.convertFinalEventMessage(
) noti.eventType,
? true noti.info.sentMessageJson
: false, ),
displayTime: image: '',
appUserInfo.settings.notification.alertExposureTime * useSound: [
1000 NotificationMethod.Sound,
}; NotificationMethod.SoundAndAlert
this.nativeService.notify(notiReq); ].some(
n => n === appUserInfo.settings.notification.method
)
? true
: false,
displayTime:
appUserInfo.settings.notification
.alertExposureTime * 1000
};
this.nativeService.notify(notiReq);
}
} }
} }
} }
@ -578,22 +588,43 @@ 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) {
const notiReq: NotificationRequest = { if (
type: NotificationType.Message, appUserInfo.settings.notification.method ===
seq: noti.keyId, NotificationMethod.Sound
title: '쪽지가 도착했습니다.', ) {
contents: noti.text, const audio = new Audio('assets/sounds/messageAlarm.mp3');
image: noti.senderInfo.profileImageFile, audio.play();
useSound: [ } else {
NotificationMethod.Sound, const notiReq: NotificationRequest = {
NotificationMethod.SoundAndAlert type: NotificationType.Message,
].some(n => n === appUserInfo.settings.notification.method) seq: noti.keyId,
? true title: '쪽지가 도착했습니다.',
: false, contents: noti.text,
displayTime: image: noti.senderInfo.profileImageFile,
appUserInfo.settings.notification.alertExposureTime * 1000 useSound: [
}; NotificationMethod.Sound,
this.nativeService.notify(notiReq); NotificationMethod.SoundAndAlert
].some(
n => n === appUserInfo.settings.notification.method
)
? true
: false,
displayTime:
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; 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