urlInfo 정보 수집

This commit is contained in:
leejinho 2019-12-13 14:38:42 +09:00
parent 0271d86add
commit dc26faa618
17 changed files with 252 additions and 38 deletions

View File

@ -9,6 +9,7 @@ import {
export interface UrlInfoRequest extends APIRequest {
deviceType: DeviceType;
loginId?: string;
}
export interface UrlInfoResponse extends APIResponse {
@ -26,8 +27,19 @@ export interface UrlInfoResponse extends APIResponse {
synapViewUrl?: string;
}
export interface DaesangUrlInfoResponse extends UrlInfoResponse {
webLink: WebLink[];
webLinkAllowedList: string[];
}
export interface WebLink {
key: string;
title: string;
url: string;
}
const urlInfoEncodeMap = {
deviceType: 'p_device_type'
deviceType: 'p_device_type',
loginId: 'p_user_id'
};
export const encodeUrlInfo: APIEncoder<UrlInfoRequest> = (
@ -54,3 +66,149 @@ export const decodeUrlInfo: APIDecoder<UrlInfoResponse> = (res: any) => {
synapViewUrl: res.SynapViewURL
} as UrlInfoResponse;
};
export const decodeUrlInfoDaesang: APIDecoder<DaesangUrlInfoResponse> = (
res: any
) => {
const webLink: WebLink[] = [];
if (!!res.WebLinkWebhard) {
const arr = res.WebLinkWebhard.split(',');
webLink.push({
key: 'WebLinkWebhard',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkDsp) {
const arr = res.WebLinkDsp.split(',');
webLink.push({
key: 'WebLinkDsp',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkSms) {
const arr = res.WebLinkSms.split(',');
webLink.push({
key: 'WebLinkSms',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkConf) {
const arr = res.WebLinkConf.split(',');
webLink.push({
key: 'WebLinkConf',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkEp) {
const arr = res.WebLinkEp.split(',');
webLink.push({
key: 'WebLinkEp',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkSop) {
const arr = res.WebLinkSop.split(',');
webLink.push({
key: 'WebLinkSop',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkSom) {
const arr = res.WebLinkSom.split(',');
webLink.push({
key: 'WebLinkSom',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkElephant) {
const arr = res.WebLinkElephant.split(',');
webLink.push({
key: 'WebLinkElephant',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkItsvcdesk) {
const arr = res.WebLinkItsvcdesk.split(',');
webLink.push({
key: 'WebLinkItsvcdesk',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkUrgntNews) {
const arr = res.WebLinkUrgntNews.split(',');
webLink.push({
key: 'WebLinkUrgntNews',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkMailCnt) {
const arr = res.WebLinkMailCnt.split(',');
webLink.push({
key: 'WebLinkMailCnt',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkMail) {
const arr = res.WebLinkMail.split(',');
webLink.push({
key: 'WebLinkMail',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkPaymentCnt) {
const arr = res.WebLinkPaymentCnt.split(',');
webLink.push({
key: 'WebLinkPaymentCnt',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkPayment) {
const arr = res.WebLinkPayment.split(',');
webLink.push({
key: 'WebLinkPayment',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
if (!!res.WebLinkChgPassword) {
const arr = res.WebLinkChgPassword.split(',');
webLink.push({
key: 'WebLinkChgPassword',
title: arr.length > 1 ? arr[0] : '',
url: arr.length > 1 ? arr[1] : arr[0]
});
}
return {
statusCode: res.StatusCode,
errorMessage: res.ErrorMessage,
portCheckUrl: res.PortCheckURL,
messageUrl: res.MsgURL,
messageUrl2: res.MsgURL2,
passwordUrl: res.PasswordURL,
planUrl: res.PlanURL,
planUrl2: res.PlanURL2,
vocUrl: res.VocURL,
confUrl: res.ConfURL,
uprApiUrl: res.UprApiURL,
uprSvcUrl: res.UprSvcURL,
uprDownloadUrl: res.UprDownloadURL,
synapViewUrl: res.SynapViewURL,
webLink,
webLinkAllowedList: res.WebLinkAllowedList.split(',')
} as DaesangUrlInfoResponse;
};

View File

@ -8,25 +8,27 @@ import {
CheckUserInfoExRequest,
CheckUserInfoExResponse,
encodeCheckUserInfoEx,
decodeCheckUserInfoEx,
decodeCheckUserInfoEx
} from '../apis/check-user-info-ex';
import {
CompanyListRequest,
CompanyListResponse,
encodeCompanyList,
decodeCompanyList,
decodeCompanyList
} from '../apis/company-list';
import {
TokenUpdateRequest,
TokenUpdateResponse,
encodeTokenUpdate,
decodeTokenUpdate,
decodeTokenUpdate
} from '../apis/token-update';
import {
UrlInfoResponse,
UrlInfoRequest,
encodeUrlInfo,
decodeUrlInfo,
DaesangUrlInfoResponse,
decodeUrlInfoDaesang
} from '../apis/url-info';
import { _MODULE_CONFIG } from '../config/token';
@ -35,7 +37,7 @@ import { Urls } from '../config/urls';
import { UrlConfig } from '@ucap-webmessenger/core';
@Injectable({
providedIn: 'root',
providedIn: 'root'
})
export class ExternalApiService {
readonly urls: Urls;
@ -58,7 +60,7 @@ export class ExternalApiService {
this.urls.checkUserInfoEx,
{},
{
params: encodeCheckUserInfoEx(req),
params: encodeCheckUserInfoEx(req)
}
)
.pipe(map(res => decodeCheckUserInfoEx(res)));
@ -70,7 +72,7 @@ export class ExternalApiService {
this.urls.companyList,
{},
{
params: encodeCompanyList(req),
params: encodeCompanyList(req)
}
)
.pipe(map(res => decodeCompanyList(res)));
@ -82,7 +84,7 @@ export class ExternalApiService {
this.urls.tokenUpdate,
{},
{
params: encodeTokenUpdate(req),
params: encodeTokenUpdate(req)
}
)
.pipe(map(res => decodeTokenUpdate(res)));
@ -94,9 +96,22 @@ export class ExternalApiService {
this.urls.urlInfo,
{},
{
params: encodeUrlInfo(req),
params: encodeUrlInfo(req)
}
)
.pipe(map(res => decodeUrlInfo(res)));
}
public urlInfoDaesang(
req: UrlInfoRequest
): Observable<DaesangUrlInfoResponse> {
return this.httpClient
.post<any>(
this.urls.urlInfo,
{},
{
params: encodeUrlInfo(req)
}
)
.pipe(map(res => decodeUrlInfoDaesang(res)));
}
}

View File

@ -32,9 +32,7 @@ import {
import { MatTabChangeEvent } from '@angular/material';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { MessageApiService, MessageType } from '@ucap-webmessenger/api-message';
import { DeviceType } from '@ucap-webmessenger/core';
import { UnreadCountRequest } from 'projects/ucap-webmessenger-api-message/src/lib/apis/unread-count';
@ -45,7 +43,12 @@ import {
MessageWriteDialogResult,
MessageWriteDialogData
} from '../dialogs/message/message-write.dialog.component';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import {
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO,
KEY_VER_INFO,
KEY_LOGIN_RES_INFO
} from '@app/types';
import { MessageBoxComponent } from './left-sidenav/message.component';
export enum MainMenu {

View File

@ -25,7 +25,7 @@ import {
} from '@ucap-webmessenger/protocol-sync';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_VER_INFO } from '@app/types';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { MatMenuTrigger } from '@angular/material';
import { FormGroup, FormBuilder } from '@angular/forms';

View File

@ -26,9 +26,9 @@ import {
KEY_LOGIN_INFO,
UserSelectDialogType,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
KEY_ENVIRONMENTS_INFO,
KEY_VER_INFO
} from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';

View File

@ -18,7 +18,6 @@ import * as AppStore from '@app/store';
import { UserInfo } from '@ucap-webmessenger/protocol-room';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { DialogService } from '@ucap-webmessenger/ui';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
@ -48,7 +47,11 @@ import {
MessageDetailDialogResult,
MessageDetailDialogData
} from '../../dialogs/message/message-detail.dialog.component';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import {
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO,
KEY_VER_INFO
} from '@app/types';
@Component({
selector: 'app-layout-chat-left-sidenav-message',

View File

@ -32,10 +32,9 @@ import * as SyncStore from '@app/store/messenger/sync';
import * as ChatStore from '@app/store/messenger/chat';
import * as StatusStore from '@app/store/messenger/status';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { LoginInfo, KEY_LOGIN_INFO, KEY_VER_INFO } from '@app/types';
import { take, map, tap, delay, catchError } from 'rxjs/operators';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import {
SelectGroupDialogComponent,
SelectGroupDialogData,

View File

@ -61,7 +61,7 @@ import {
FileInfo,
FormComponent as UCapUiChatFormComponent
} from '@ucap-webmessenger/ui-chat';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_VER_INFO } from '@app/types';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import {
MatMenuTrigger,

View File

@ -15,9 +15,12 @@ import { CommonApiService } from '@ucap-webmessenger/api-common';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import {
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO,
KEY_VER_INFO
} from '@app/types';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
import { NGXLogger } from 'ngx-logger';
import { SnackBarService } from '@ucap-webmessenger/ui';

View File

@ -17,7 +17,6 @@ import * as RoomStore from '@app/store/messenger/room';
import { UserInfo, RoomInfo } from '@ucap-webmessenger/protocol-room';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import {
DialogService,
ConfirmDialogComponent,
@ -35,9 +34,12 @@ import {
CreateChatDialogResult,
CreateChatDialogData
} from '../../dialogs/chat/create-chat.dialog.component';
import { UserSelectDialogType } from '@app/types';
import {
UserSelectDialogType,
KEY_LOGIN_RES_INFO,
KEY_VER_INFO
} from '@app/types';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { MatMenuTrigger, MatDialog } from '@angular/material';
@Component({

View File

@ -25,8 +25,7 @@ import * as StatusStore from '@app/store/messenger/status';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Company } from '@ucap-webmessenger/api-external';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { LoginInfo, KEY_LOGIN_INFO, KEY_VER_INFO } from '@app/types';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import {
UserInfo,

View File

@ -1,7 +1,6 @@
import { Component, OnInit, Inject, ViewChild, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store';

View File

@ -1,7 +1,6 @@
import { Component, OnInit, Inject, Renderer2 } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store';

View File

@ -4,7 +4,7 @@ import {
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
import { Observable, throwError, forkJoin } from 'rxjs';
import { Observable, throwError, forkJoin, of } from 'rxjs';
import {
map,
tap,
@ -27,7 +27,8 @@ import {
LoginInfo,
KEY_LOGIN_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
KEY_ENVIRONMENTS_INFO,
KEY_URL_INFO
} from '@app/types';
import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner';
import {
@ -47,12 +48,18 @@ import * as VersionInfoStore from '@app/store/setting/version-info';
import * as OptionStore from '@app/store/messenger/option';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import { environment } from '../../environments/environment';
import { SnackBarService } from '@ucap-webmessenger/ui';
import { AppNativeService } from '@app/services/native.service';
import {
ExternalApiService,
UrlInfoResponse,
DaesangUrlInfoResponse
} from '@ucap-webmessenger/api-external';
import { DeviceType } from '@ucap-webmessenger/core';
import { StatusCode } from '@ucap-webmessenger/api';
@Injectable()
export class AppMessengerResolver implements Resolve<void> {
@ -60,6 +67,7 @@ export class AppMessengerResolver implements Resolve<void> {
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private publicApiService: PublicApiService,
private externalApiService: ExternalApiService,
private protocolService: ProtocolService,
private queryProtocolService: QueryProtocolService,
private optionProtocolService: OptionProtocolService,
@ -103,6 +111,25 @@ export class AppMessengerResolver implements Resolve<void> {
switchMap(res => {
return this.protocolService.connect(res.serverIp);
}),
switchMap(res => {
return this.externalApiService
.urlInfoDaesang({
deviceType: environmentsInfo.deviceType,
loginId: loginInfo.loginId
})
.pipe(
map(response => {
console.log(response);
if (response.statusCode === StatusCode.Success) {
this.sessionStorageService.set<
UrlInfoResponse | DaesangUrlInfoResponse
>(KEY_URL_INFO, response);
} else {
}
}),
catchError(error => of(this.logger.error({ error })))
);
}),
switchMap(() => this.innerProtocolService.conn({})),
switchMap(res => {
return this.authenticationProtocolService

View File

@ -5,9 +5,12 @@ import {
LocalStorageService
} from '@ucap-webmessenger/web-storage';
import { LocaleCode } from '@ucap-webmessenger/core';
import { LoginInfo, KEY_LOGIN_INFO } from '../types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import {
LoginInfo,
KEY_LOGIN_INFO,
KEY_LOGIN_RES_INFO,
KEY_VER_INFO
} from '../types';
import { PasswordUtil } from '@ucap-webmessenger/pi';
@Injectable({

View File

@ -3,3 +3,6 @@ export * from './login-info.type';
export * from './userselect.dialog.type';
export * from './right-drawer.type';
export * from './sticker-info.type';
export * from './url-info.type';
export * from './ver-info.type';
export * from './login-res-info.type';

View File

@ -0,0 +1 @@
export const KEY_URL_INFO = 'ucap::URL_INFO';