노티 팝업에 사용자 정보 표시하도록 수정.
1. searching in buddy 2. searching in current opened room 3. searching for protocols
This commit is contained in:
parent
ca9e8942e7
commit
a725d91326
|
@ -1,6 +1,13 @@
|
||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { tap, withLatestFrom } from 'rxjs/operators';
|
import {
|
||||||
|
tap,
|
||||||
|
withLatestFrom,
|
||||||
|
take,
|
||||||
|
map,
|
||||||
|
catchError,
|
||||||
|
finalize
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
|
@ -116,7 +123,12 @@ import { environment } from '../../environments/environment';
|
||||||
import { NotificationMethod, LocaleCode } from '@ucap-webmessenger/core';
|
import { NotificationMethod, LocaleCode } from '@ucap-webmessenger/core';
|
||||||
import { Dictionary } from '@ngrx/entity';
|
import { Dictionary } from '@ngrx/entity';
|
||||||
import { MessageType } from '@ucap-webmessenger/api-message';
|
import { MessageType } from '@ucap-webmessenger/api-message';
|
||||||
import { LogoutInfo, KEY_LOGOUT_INFO, KEY_VER_INFO } from '@app/types';
|
import {
|
||||||
|
LogoutInfo,
|
||||||
|
KEY_LOGOUT_INFO,
|
||||||
|
KEY_VER_INFO,
|
||||||
|
KEY_LOGIN_RES_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';
|
||||||
|
@ -138,6 +150,8 @@ import { UserInfo, RoomUserData } from '@ucap-webmessenger/protocol-sync';
|
||||||
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
||||||
import { QueryProtocolService } from '@ucap-webmessenger/protocol-query';
|
import { QueryProtocolService } from '@ucap-webmessenger/protocol-query';
|
||||||
import { UserInfoListState } from '@app/store/messenger/room';
|
import { UserInfoListState } from '@app/store/messenger/room';
|
||||||
|
import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppNotificationService {
|
export class AppNotificationService {
|
||||||
|
@ -149,6 +163,7 @@ export class AppNotificationService {
|
||||||
private groupProtocolService: GroupProtocolService,
|
private groupProtocolService: GroupProtocolService,
|
||||||
private buddyProtocolService: BuddyProtocolService,
|
private buddyProtocolService: BuddyProtocolService,
|
||||||
private queryProtocolService: QueryProtocolService,
|
private queryProtocolService: QueryProtocolService,
|
||||||
|
private daesangProtocolService: DaesangProtocolService,
|
||||||
private statusProtocolService: StatusProtocolService,
|
private statusProtocolService: StatusProtocolService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private ucapTranslateService: UcapTranslateService,
|
private ucapTranslateService: UcapTranslateService,
|
||||||
|
@ -233,25 +248,10 @@ export class AppNotificationService {
|
||||||
(state: any) =>
|
(state: any) =>
|
||||||
state.messenger.sync.buddy2.entities as Dictionary<UserInfo>
|
state.messenger.sync.buddy2.entities as Dictionary<UserInfo>
|
||||||
)
|
)
|
||||||
),
|
|
||||||
this.store.pipe(
|
|
||||||
select(
|
|
||||||
(state: any) =>
|
|
||||||
state.messenger.sync.roomUserShort.entities as Dictionary<
|
|
||||||
RoomUserData
|
|
||||||
>
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
tap(
|
tap(
|
||||||
([
|
([notiOrRes, curRoomInfo, curRoomUserInfo, roomList, buddyList]) => {
|
||||||
notiOrRes,
|
|
||||||
curRoomInfo,
|
|
||||||
curRoomUserInfo,
|
|
||||||
roomList,
|
|
||||||
buddyList,
|
|
||||||
roomUserShorts
|
|
||||||
]) => {
|
|
||||||
switch (notiOrRes.SSVC_TYPE) {
|
switch (notiOrRes.SSVC_TYPE) {
|
||||||
case SSVC_TYPE_EVENT_SEND_RES:
|
case SSVC_TYPE_EVENT_SEND_RES:
|
||||||
case SSVC_TYPE_EVENT_SEND_NOTI:
|
case SSVC_TYPE_EVENT_SEND_NOTI:
|
||||||
|
@ -356,32 +356,70 @@ export class AppNotificationService {
|
||||||
senderInfo = curRoomUserInfo[noti.SENDER_SEQ];
|
senderInfo = curRoomUserInfo[noti.SENDER_SEQ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// STEP 3 >> In All Room Users.
|
// STEP 3 >> user protocol
|
||||||
if (!senderInfo) {
|
if (!senderInfo) {
|
||||||
for (const key in roomUserShorts) {
|
const loginRes = this.sessionStorageService.get<
|
||||||
if (key === undefined) {
|
LoginResponse
|
||||||
continue;
|
>(KEY_LOGIN_RES_INFO);
|
||||||
}
|
|
||||||
|
|
||||||
if (roomUserShorts.hasOwnProperty(key)) {
|
this.daesangProtocolService
|
||||||
const element = roomUserShorts[key];
|
.dataUserDaesang({
|
||||||
const filteredUserInfos = element.userInfos.filter(
|
divCd: 'OPENNOTI',
|
||||||
info => info.seq === noti.SENDER_SEQ
|
seq: noti.SENDER_SEQ,
|
||||||
);
|
senderCompanyCode:
|
||||||
|
loginRes.userInfo.companyCode,
|
||||||
|
senderEmployeeType:
|
||||||
|
loginRes.userInfo.employeeType
|
||||||
|
})
|
||||||
|
.pipe(
|
||||||
|
take(1),
|
||||||
|
map(res => {
|
||||||
|
if (!!res && !!res.userInfo) {
|
||||||
|
senderInfo = res.userInfo;
|
||||||
|
let name = senderInfo.name;
|
||||||
|
let grade = senderInfo.grade;
|
||||||
|
|
||||||
if (
|
switch (
|
||||||
!!filteredUserInfos &&
|
this.ucapTranslateService.currentLang.toUpperCase()
|
||||||
filteredUserInfos.length > 0
|
|
||||||
) {
|
) {
|
||||||
senderInfo = filteredUserInfos[0];
|
case LocaleCode.English:
|
||||||
|
name = senderInfo.nameEn;
|
||||||
|
grade = senderInfo.gradeEn;
|
||||||
|
break;
|
||||||
|
case LocaleCode.Chinese:
|
||||||
|
name = senderInfo.nameCn;
|
||||||
|
grade = senderInfo.gradeCn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
notiReq.title = this.translateService.instant(
|
||||||
|
'notification.titleChatEventArrivedByUser',
|
||||||
|
{
|
||||||
|
userInfo: !!grade
|
||||||
|
? `${name} ${grade}`
|
||||||
|
: name
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Image set.
|
||||||
|
if (!!senderInfo.profileImageFile) {
|
||||||
|
const sessionVerinfo = this.sessionStorageService.get<
|
||||||
|
VersionInfo2Response
|
||||||
|
>(KEY_VER_INFO);
|
||||||
|
notiReq.image = `${sessionVerinfo.profileRoot}${senderInfo.profileImageFile}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
catchError(error => {
|
||||||
|
return of();
|
||||||
|
}),
|
||||||
|
finalize(() => {
|
||||||
|
this.nativeService.notify(notiReq);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
|
} else {
|
||||||
// Sender Info setting.
|
// Sender Info setting.
|
||||||
if (!!senderInfo) {
|
|
||||||
// name set
|
// name set
|
||||||
let name = senderInfo.name;
|
let name = senderInfo.name;
|
||||||
let grade = senderInfo.grade;
|
let grade = senderInfo.grade;
|
||||||
|
@ -413,7 +451,6 @@ export class AppNotificationService {
|
||||||
>(KEY_VER_INFO);
|
>(KEY_VER_INFO);
|
||||||
notiReq.image = `${sessionVerinfo.profileRoot}${senderInfo.profileImageFile}`;
|
notiReq.image = `${sessionVerinfo.profileRoot}${senderInfo.profileImageFile}`;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// express noti popup
|
// express noti popup
|
||||||
this.nativeService.notify(notiReq);
|
this.nativeService.notify(notiReq);
|
||||||
|
@ -423,6 +460,7 @@ export class AppNotificationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user