Merge branch 'master' of https://git.loafle.net/ucap-web/next-ucap-messenger
This commit is contained in:
commit
2ce0f3af3b
|
@ -469,6 +469,10 @@ export class OrganizationComponent
|
||||||
|
|
||||||
/** 전체 체크여부 */
|
/** 전체 체크여부 */
|
||||||
getCheckedAllUser() {
|
getCheckedAllUser() {
|
||||||
|
if (!this.loginRes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const compareList: UserInfoSS[] = this.isShowSearch
|
const compareList: UserInfoSS[] = this.isShowSearch
|
||||||
? this.searchUserInfos
|
? this.searchUserInfos
|
||||||
: this.selectedDepartmentUserInfoList;
|
: this.selectedDepartmentUserInfoList;
|
||||||
|
|
|
@ -116,6 +116,19 @@ import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { deleteMessageSuccess } from '@app/store/messenger/message';
|
import { deleteMessageSuccess } from '@app/store/messenger/message';
|
||||||
import { ServerErrorCode } from '@ucap-webmessenger/protocol';
|
import { ServerErrorCode } from '@ucap-webmessenger/protocol';
|
||||||
|
import {
|
||||||
|
OptionProtocolService,
|
||||||
|
SSVC_TYPE_OPTION_REG_UPD_RES,
|
||||||
|
RegUpdateResponse,
|
||||||
|
RegUpdateNotification
|
||||||
|
} from '@ucap-webmessenger/protocol-option';
|
||||||
|
import {
|
||||||
|
GeneralSetting,
|
||||||
|
Settings,
|
||||||
|
NotificationSetting,
|
||||||
|
ChatSetting
|
||||||
|
} from '@ucap-webmessenger/ui-settings';
|
||||||
|
import clone from 'clone';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppNotificationService {
|
export class AppNotificationService {
|
||||||
|
@ -128,6 +141,7 @@ export class AppNotificationService {
|
||||||
private buddyProtocolService: BuddyProtocolService,
|
private buddyProtocolService: BuddyProtocolService,
|
||||||
private statusProtocolService: StatusProtocolService,
|
private statusProtocolService: StatusProtocolService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
|
private optionProtocolService: OptionProtocolService,
|
||||||
private umgProtocolService: UmgProtocolService,
|
private umgProtocolService: UmgProtocolService,
|
||||||
private localStorageService: LocalStorageService,
|
private localStorageService: LocalStorageService,
|
||||||
private sessionStorageService: SessionStorageService,
|
private sessionStorageService: SessionStorageService,
|
||||||
|
@ -643,6 +657,56 @@ export class AppNotificationService {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
this.optionProtocolService.notification$
|
||||||
|
.pipe(
|
||||||
|
tap(notiOrRes => {
|
||||||
|
switch (notiOrRes.SSVC_TYPE) {
|
||||||
|
case SSVC_TYPE_OPTION_REG_UPD_RES:
|
||||||
|
{
|
||||||
|
const noti = notiOrRes as RegUpdateNotification;
|
||||||
|
this.logger.debug(
|
||||||
|
'Notification::optionProtocolService::RegUpdateNotification',
|
||||||
|
noti
|
||||||
|
);
|
||||||
|
|
||||||
|
const appUserInfo: AppUserInfo = this.localStorageService.encGet<
|
||||||
|
AppUserInfo
|
||||||
|
>(KEY_APP_USER_INFO, environment.customConfig.appKey);
|
||||||
|
|
||||||
|
const modifiedSettings: Settings = clone(appUserInfo.settings);
|
||||||
|
modifiedSettings.notification.method = noti.notificationMethod;
|
||||||
|
modifiedSettings.notification.method = noti.notificationMethod0;
|
||||||
|
modifiedSettings.notification.receiveForMobile =
|
||||||
|
noti.mobileNotification;
|
||||||
|
modifiedSettings.notification.use = noti.receiveNotification;
|
||||||
|
modifiedSettings.notification.alertExposureTime =
|
||||||
|
noti.notificationExposureTime;
|
||||||
|
|
||||||
|
modifiedSettings.chat.fontFamily = noti.fontFamily;
|
||||||
|
modifiedSettings.chat.fontSize = noti.fontSize;
|
||||||
|
|
||||||
|
modifiedSettings.presence.absenceTime = noti.absenceTime;
|
||||||
|
|
||||||
|
modifiedSettings.general.timezone = noti.timeZone;
|
||||||
|
modifiedSettings.general.locale = noti.menuLanguage;
|
||||||
|
modifiedSettings.general.hrInfoLocale =
|
||||||
|
noti.hrInformationLanguage;
|
||||||
|
|
||||||
|
appUserInfo.settings = modifiedSettings;
|
||||||
|
|
||||||
|
this.localStorageService.encSet<AppUserInfo>(
|
||||||
|
KEY_APP_USER_INFO,
|
||||||
|
appUserInfo,
|
||||||
|
environment.customConfig.appKey
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
this.umgProtocolService.notification$
|
this.umgProtocolService.notification$
|
||||||
.pipe(
|
.pipe(
|
||||||
tap(notiOrRes => {
|
tap(notiOrRes => {
|
||||||
|
|
|
@ -8,7 +8,8 @@ import {
|
||||||
ProtocolDecoder,
|
ProtocolDecoder,
|
||||||
ProtocolMessage,
|
ProtocolMessage,
|
||||||
PacketBodyValue,
|
PacketBodyValue,
|
||||||
decodeProtocolMessage
|
decodeProtocolMessage,
|
||||||
|
ProtocolNotification
|
||||||
} from '@ucap-webmessenger/protocol';
|
} from '@ucap-webmessenger/protocol';
|
||||||
|
|
||||||
export interface RegUpdateRequest extends ProtocolRequest {
|
export interface RegUpdateRequest extends ProtocolRequest {
|
||||||
|
@ -70,6 +71,10 @@ export interface RegUpdateResponse extends ProtocolResponse {
|
||||||
translationKey?: string;
|
translationKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RegUpdateNotification
|
||||||
|
extends RegUpdateResponse,
|
||||||
|
ProtocolNotification {}
|
||||||
|
|
||||||
export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
|
export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
|
||||||
req: RegUpdateRequest
|
req: RegUpdateRequest
|
||||||
) => {
|
) => {
|
||||||
|
@ -151,3 +156,24 @@ export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = (
|
||||||
translationKey: message.bodyList[13]
|
translationKey: message.bodyList[13]
|
||||||
} as RegUpdateResponse);
|
} as RegUpdateResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const decodeRegUpdateNotification: ProtocolDecoder<RegUpdateNotification> = (
|
||||||
|
message: ProtocolMessage
|
||||||
|
) => {
|
||||||
|
return decodeProtocolMessage(message, {
|
||||||
|
notificationMethod: message.bodyList[0] as NotificationMethod,
|
||||||
|
mobileNotification: message.bodyList[1] === 1 ? true : false,
|
||||||
|
fontFamily: message.bodyList[2],
|
||||||
|
fontSize: message.bodyList[3],
|
||||||
|
receiveNotification: message.bodyList[4] === 1 ? true : false,
|
||||||
|
notificationMethod0: message.bodyList[5],
|
||||||
|
notificationExposureTime: message.bodyList[6],
|
||||||
|
timeZone: message.bodyList[7],
|
||||||
|
timeZoneValue: message.bodyList[8],
|
||||||
|
absenceTime: message.bodyList[9],
|
||||||
|
menuLanguage: message.bodyList[10],
|
||||||
|
hrInformationLanguage: message.bodyList[11],
|
||||||
|
deviceType: message.bodyList[12],
|
||||||
|
translationKey: message.bodyList[13]
|
||||||
|
} as RegUpdateResponse);
|
||||||
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { take, map } from 'rxjs/operators';
|
import { take, map, share, filter, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||||
import {
|
import {
|
||||||
|
@ -11,7 +11,8 @@ import {
|
||||||
SSVC_TYPE_OPTION_REG_VIEW_REQ,
|
SSVC_TYPE_OPTION_REG_VIEW_REQ,
|
||||||
SSVC_TYPE_OPTION_REG_UPD_REQ,
|
SSVC_TYPE_OPTION_REG_UPD_REQ,
|
||||||
SSVC_TYPE_OPTION_CALL_VIEW_REQ,
|
SSVC_TYPE_OPTION_CALL_VIEW_REQ,
|
||||||
SSVC_TYPE_OPTION_CALL_UPD_REQ
|
SSVC_TYPE_OPTION_CALL_UPD_REQ,
|
||||||
|
SSVC_TYPE_OPTION_REG_UPD_RES
|
||||||
} from '../types/service';
|
} from '../types/service';
|
||||||
import {
|
import {
|
||||||
encodeView,
|
encodeView,
|
||||||
|
@ -35,7 +36,9 @@ import {
|
||||||
RegUpdateRequest,
|
RegUpdateRequest,
|
||||||
RegUpdateResponse,
|
RegUpdateResponse,
|
||||||
encodeRegUpdate,
|
encodeRegUpdate,
|
||||||
decodeRegUpdate
|
decodeRegUpdate,
|
||||||
|
decodeRegUpdateNotification,
|
||||||
|
RegUpdateNotification
|
||||||
} from '../protocols/reg-update';
|
} from '../protocols/reg-update';
|
||||||
import {
|
import {
|
||||||
CallViewRequest,
|
CallViewRequest,
|
||||||
|
@ -50,11 +53,38 @@ import {
|
||||||
decodeCallUpdate
|
decodeCallUpdate
|
||||||
} from '../protocols/call-update';
|
} from '../protocols/call-update';
|
||||||
|
|
||||||
|
type Notifications = RegUpdateNotification;
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class OptionProtocolService {
|
export class OptionProtocolService {
|
||||||
constructor(private protocolService: ProtocolService) {}
|
private notificationSubject: Subject<Notifications>;
|
||||||
|
public notification$: Observable<Notifications>;
|
||||||
|
|
||||||
|
constructor(private protocolService: ProtocolService) {
|
||||||
|
this.notificationSubject = new Subject();
|
||||||
|
this.notification$ = this.notificationSubject.asObservable().pipe(share());
|
||||||
|
|
||||||
|
this.protocolService.serverMessage
|
||||||
|
.pipe(
|
||||||
|
filter(message => message.serviceType === SVC_TYPE_OPTION),
|
||||||
|
tap(message => {
|
||||||
|
switch (message.subServiceType) {
|
||||||
|
case SSVC_TYPE_OPTION_REG_UPD_RES:
|
||||||
|
{
|
||||||
|
this.notificationSubject.next(
|
||||||
|
decodeRegUpdateNotification(message)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
public view(req: ViewRequest): Observable<ViewResponse> {
|
public view(req: ViewRequest): Observable<ViewResponse> {
|
||||||
return this.protocolService
|
return this.protocolService
|
||||||
|
|
Loading…
Reference in New Issue
Block a user