From ec2c82240596cc152c0747c0f4bf3a123f1b60d1 Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 24 Dec 2019 14:56:15 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=8B=9C=20?= =?UTF-8?q?=EB=A1=9C=EC=BB=AC=20IP,=20MAC=20=EC=A0=95=EB=B3=B4=20=EC=86=A1?= =?UTF-8?q?=EC=8B=A0=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20::?= =?UTF-8?q?=20=EC=84=B8=EC=85=98=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83?= =?UTF-8?q?=EC=8B=9C=20=ED=95=B4=EB=8B=B9=20=EC=A0=95=EB=B3=B4=20=EB=82=B4?= =?UTF-8?q?=EB=A0=A4=EC=A3=BC=EA=B8=B0=EB=A1=9C=20=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ucap-webmessenger-electron/src/index.ts | 22 +++++++++++++ .../src/app/resolvers/messenger.resolver.ts | 33 +++++++++++++++---- .../lib/services/browser-native.service.ts | 6 ++++ .../lib/services/electron-native.service.ts | 10 ++++++ .../src/lib/types/channel.type.ts | 3 +- .../src/lib/services/native.service.ts | 2 ++ .../src/lib/protocols/login.ts | 31 +++++++---------- 7 files changed, 79 insertions(+), 28 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index d57f7af8..11102d48 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -2,6 +2,7 @@ import { app, ipcMain, IpcMainEvent, Tray, Menu, shell } from 'electron'; import path from 'path'; import fse from 'fs-extra'; import semver from 'semver'; +import os from 'os'; import AutoLaunch from 'auto-launch'; @@ -350,6 +351,27 @@ ipcMain.on(UpdaterChannel.Check, (event: IpcMainEvent, ...args: any[]) => { } }); +ipcMain.on( + MessengerChannel.GetNetworkInfo, + (event: IpcMainEvent, ...args: any[]) => { + const interfaces = os.networkInterfaces(); + const addresses: { ip: string; mac: string }[] = []; + + // tslint:disable-next-line: forin + for (const k in interfaces) { + // tslint:disable-next-line: forin + for (const k2 in interfaces[k]) { + const address = interfaces[k][k2]; + if (address.family === 'IPv4' && !address.internal) { + addresses.push({ ip: address.address, mac: address.mac }); + } + } + } + + event.returnValue = addresses; + } +); + ipcMain.on( MessengerChannel.ChangeAutoLaunch, (event: IpcMainEvent, ...args: any[]) => { diff --git a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts index 16cf8472..2dc691a2 100644 --- a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts +++ b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { Resolve, ActivatedRouteSnapshot, @@ -62,10 +62,12 @@ import { } from '@ucap-webmessenger/api-external'; import { DeviceType } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/api'; +import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; @Injectable() export class AppMessengerResolver implements Resolve { constructor( + @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private store: Store, private sessionStorageService: SessionStorageService, private publicApiService: PublicApiService, @@ -84,7 +86,7 @@ export class AppMessengerResolver implements Resolve { activatedRouteSnapshot: ActivatedRouteSnapshot, routerStateSnapshot: RouterStateSnapshot ): void | Observable | Promise { - return new Promise((resolve, reject) => { + return new Promise(async (resolve, reject) => { let loginRes: LoginResponse; const loginInfo = this.sessionStorageService.get( @@ -94,6 +96,24 @@ export class AppMessengerResolver implements Resolve { KEY_ENVIRONMENTS_INFO ); + let localIp = ''; + let localMac = ''; + + // get network info + await this.nativeService + .getNetworkInfo() + .then(result => { + if (!!result && result.length > 0) { + if (!!result[0].ip) { + localIp = result[0].ip; + } + if (!!result[0].mac) { + localMac = result[0].mac; + } + } + }) + .catch(reason => {}); + this.publicApiService .versionInfo2({ deviceType: environmentsInfo.deviceType, @@ -146,19 +166,18 @@ export class AppMessengerResolver implements Resolve { passwordEncodingType: 1, clientVersion: '', reconnect: false, - ip: 'localhost', - hostName: '', + ip: localIp, + hostName: localMac, ssoMode: SSOMode.AUTH, userSpecificInformation: 'PRO_000482', - productId: environment.productConfig.productId, - productName: environment.productConfig.productName + andId: '', + andPushRefreshYn: '' }) .pipe( catchError(err => { switch (err as ServerErrorCode) { case ServerErrorCode.ERRCD_IDPW: break; - default: break; } diff --git a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts index 7db1b585..c9f25195 100644 --- a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts +++ b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts @@ -66,6 +66,12 @@ export class BrowserNativeService extends NativeService { }); } + getNetworkInfo(): Promise { + return new Promise((resolve, reject) => { + resolve(null); + }); + } + changeAutoLaunch(autoLaunch: boolean): Promise { return new Promise((resolve, reject) => { resolve(true); diff --git a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts index 44e5b733..e39f1b51 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts @@ -72,6 +72,16 @@ export class ElectronNativeService implements NativeService { return this.logout$; } + getNetworkInfo(): Promise { + return new Promise((resolve, reject) => { + try { + resolve(this.ipcRenderer.sendSync(MessengerChannel.GetNetworkInfo)); + } catch (error) { + reject(error); + } + }); + } + changeStatus(): Observable { if (!this.changeStatusSubject) { this.changeStatusSubject = new Subject(); diff --git a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts index 6c4101f4..c2443dc5 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts @@ -3,7 +3,8 @@ export enum MessengerChannel { ChangeStatus = 'UCAP::messenger::changeStatus', ShowSetting = 'UCAP::messenger::showSetting', ChangeAutoLaunch = 'UCAP::messenger::changeAutoLaunch', - ChangeStartupHideWindow = 'UCAP::messenger::changeStartupHideWindow' + ChangeStartupHideWindow = 'UCAP::messenger::changeStartupHideWindow', + GetNetworkInfo = 'UCAP::messenger::getNetworkInfo' } export enum ChatChannel { diff --git a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts index bb87b94b..2f9b8bf0 100644 --- a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts +++ b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts @@ -14,6 +14,8 @@ export abstract class NativeService { abstract changeStatus(): Observable; abstract showSetting(): Observable; + abstract getNetworkInfo(): Promise; + abstract changeAutoLaunch(autoLaunch: boolean): Promise; abstract changeStartupHideWindow( startupHideWindow: boolean diff --git a/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/login.ts b/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/login.ts index 5a678a3b..87587b1c 100644 --- a/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/login.ts +++ b/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/login.ts @@ -46,14 +46,10 @@ export interface LoginRequest extends ProtocolRequest { ssoMode: SSOMode; // 14. 사용자고유정보(s) userSpecificInformation: string; - // 15. 제품 ID(s) - productId: string; - // 16. 제품명(s) - productName: string; - // 17. EncData(s) - encriptionData?: string; - // 18. AccessToken(s) - accessToken?: string; + // 15. 안드로이드 ID(s) + andId: string; + // 16. push_ID 갱신여부(s) + andPushRefreshYn: string; } export interface LoginResponse extends ProtocolResponse { @@ -135,25 +131,20 @@ export const encodeLogin: ProtocolEncoder = ( { type: PacketBodyValue.String, value: req.deviceId }, { type: PacketBodyValue.String, value: req.token }, { type: PacketBodyValue.String, value: req.localeCode }, - { type: PacketBodyValue.String, value: req.pushId }, + { type: PacketBodyValue.String, value: req.pushId }, // 6 + { type: PacketBodyValue.String, value: req.companyCode }, { type: PacketBodyValue.Integer, value: req.passwordEncodingType }, { type: PacketBodyValue.String, value: req.clientVersion }, { type: PacketBodyValue.String, value: req.reconnect ? 'Y' : 'N' }, { type: PacketBodyValue.String, value: req.ip }, { type: PacketBodyValue.String, value: req.hostName }, - { type: PacketBodyValue.Integer, value: req.encriptionData ? 2 : 1 }, - { type: PacketBodyValue.String, value: req.userSpecificInformation }, - { type: PacketBodyValue.String, value: req.productId }, - { type: PacketBodyValue.String, value: req.productName } - ); + { type: PacketBodyValue.String, value: '' }, // 13 - if (req.encriptionData) { - bodyList.push( - { type: PacketBodyValue.String, value: req.encriptionData }, - { type: PacketBodyValue.String, value: req.accessToken } - ); - } + { type: PacketBodyValue.String, value: req.userSpecificInformation }, + { type: PacketBodyValue.String, value: req.andId }, + { type: PacketBodyValue.String, value: req.andPushRefreshYn } + ); return bodyList; }; From 1d28f842a02c3beffc13bcbb1a393d74f9408fde Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 24 Dec 2019 14:57:55 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[=EB=8C=80=EC=83=81=ED=96=A5]=20=EC=9A=B4?= =?UTF-8?q?=EC=98=81=20PI,=20Prompt,=20Msg=20SSL=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=84=A4=EC=A0=95=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/environments/environment.daesang.prod.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts index 50812057..77bc5df9 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts @@ -113,16 +113,16 @@ export const environment: Environment = { messageApiModuleConfig: { hostConfig: { - protocol: 'http', + protocol: 'https', domain: 'messenger.daesang.com', - port: 9098 + port: 9097 }, urls: messageApiUrls }, promptApiModuleConfig: { hostConfig: { - protocol: 'http', + protocol: 'https', domain: 'messenger.daesang.com', port: 9097 }, @@ -131,7 +131,7 @@ export const environment: Environment = { piModuleConfig: { hostConfig: { - protocol: 'http', + protocol: 'https', domain: 'messenger.daesang.com', port: 9097 }, From b68bb1d83ae8706e3747b773280a043be90bbc0c Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 24 Dec 2019 14:58:43 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=201=EC=B0=A8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EB=B3=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/protocols/data-user.ts | 3 +- .../src/lib/models/user-info-ss.ts | 4 +- .../message-box/mass.component.html | 2 +- .../src/lib/components/profile.component.html | 294 +++++++++++++----- .../src/lib/pipes/ucapString.pipe.ts | 44 +++ .../src/lib/ucap-ui.module.ts | 8 +- 6 files changed, 280 insertions(+), 75 deletions(-) create mode 100644 projects/ucap-webmessenger-ui/src/lib/pipes/ucapString.pipe.ts diff --git a/projects/ucap-webmessenger-daesang/src/lib/protocols/data-user.ts b/projects/ucap-webmessenger-daesang/src/lib/protocols/data-user.ts index 3773a261..f25dbe7c 100644 --- a/projects/ucap-webmessenger-daesang/src/lib/protocols/data-user.ts +++ b/projects/ucap-webmessenger-daesang/src/lib/protocols/data-user.ts @@ -67,7 +67,8 @@ export const decodeDataUser: ProtocolDecoder = ( employeeType: info[28] as EmployeeType, workplace: info[29], responsibilities: info[30], - workstatus: info[31] + workstatus: info[31], + customerInfo: info[32] }; } return decodeProtocolMessage(message, { diff --git a/projects/ucap-webmessenger-protocol-query/src/lib/models/user-info-ss.ts b/projects/ucap-webmessenger-protocol-query/src/lib/models/user-info-ss.ts index c5131223..996f98f1 100644 --- a/projects/ucap-webmessenger-protocol-query/src/lib/models/user-info-ss.ts +++ b/projects/ucap-webmessenger-protocol-query/src/lib/models/user-info-ss.ts @@ -64,8 +64,10 @@ export interface UserInfoSS { /** 사업장 */ workplace?: string; - /** 담당업무 */ + /** 담당업무(SC직무) */ responsibilities?: string; /** 업무 상태 */ workstatus?: string; + /** 거래처 정보 */ + customerInfo?: string; } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass.component.html index 967b4eaf..bebf2830 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass.component.html @@ -1,7 +1,7 @@
- {{ moment(message.sendDate).toDate() | date: 'short' }} + {{ message.sendDate | ucapDate: 'YYYY.MM.DD a hh:mm' }}
diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html index 3396717c..f5d7c5ff 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html @@ -2,56 +2,107 @@
- +
- - - {{ getWorkstatus(userInfo) }} 휴가중 + + {{ getWorkstatus(userInfo) }} - - - + +
{{ userInfo | ucapTranslate: 'name' }} - (A123456) + {{ userInfo.employeeNum }} - {{userInfo | ucapTranslate: 'deptName'}} + {{ userInfo | ucapTranslate: 'deptName' }} {{ userInfo | ucapTranslate: 'grade' }} -
{{ userInfo.intro }}가나다라라라마마마바사아자차카타파하가나다라마사아자차카타파하가나다라마사아자차카타파하가나다라마사아자차카타파하가나다라마사아자차카타파하
+
+ {{ userInfo.intro }} +
- - - - + + + - + @@ -59,9 +110,21 @@ - + @@ -70,21 +133,23 @@
-
- - -
+
    -
  • -
    사업장
    -
    {{ userInfo.workplace }}
    -
  • 담당업무/근무지
    -
    {{ userInfo.responsibilities }}
    +
    + {{ userInfo.responsibilities | ucapStringEmptycheck }} / + {{ userInfo.workplace | ucapStringEmptycheck }} +
  • 사원직무/거래처
    @@ -92,35 +157,67 @@
  • 이메일
    -
    {{ userInfo.email }}
    +
    {{ userInfo.email | ucapStringEmptycheck }}
    +
  • +
  • 사무실
    -
    {{ userInfo.lineNumber }}1234567890123456789012345678901234567890
    -
  • 핸드폰
    -
    {{ userInfo.hpNumber }}
    -
@@ -128,44 +225,99 @@
-
- SMS
- 화상
- 쪽지
diff --git a/projects/ucap-webmessenger-ui/src/lib/pipes/ucapString.pipe.ts b/projects/ucap-webmessenger-ui/src/lib/pipes/ucapString.pipe.ts new file mode 100644 index 00000000..5891bf55 --- /dev/null +++ b/projects/ucap-webmessenger-ui/src/lib/pipes/ucapString.pipe.ts @@ -0,0 +1,44 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'ucapStringEmptycheck' }) +export class StringEmptyCheckPipe implements PipeTransform { + transform(value: string): string { + return value.trim().length > 0 ? value.trim() : '-'; + } +} + +@Pipe({ name: 'ucapStringFormatterPhone' }) +export class StringFormatterPhonePipe implements PipeTransform { + transform(value: string, hidden?: boolean): string { + const num = value.trim().replace(/[-, ]/g, ''); + let formatNum = ''; + if (num.length === 0) { + return num; + } + + if (num.length === 11) { + if (!!hidden && hidden) { + formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-****-$3'); + } else { + formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); + } + } else if (num.length === 8) { + formatNum = num.replace(/(\d{4})(\d{4})/, '$1-$2'); + } else { + if (num.indexOf('02') === 0) { + if (!!hidden && hidden) { + formatNum = num.replace(/(\d{2})(\d{4})(\d{4})/, '$1-****-$3'); + } else { + formatNum = num.replace(/(\d{2})(\d{4})(\d{4})/, '$1-$2-$3'); + } + } else { + if (!!hidden && hidden) { + formatNum = num.replace(/(\d{3})(\d{3})(\d{4})/, '$1-***-$3'); + } else { + formatNum = num.replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3'); + } + } + } + return formatNum; + } +} diff --git a/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts b/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts index fb84ce3c..5ae1a53a 100644 --- a/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts +++ b/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts @@ -67,6 +67,10 @@ import { TranslatePipe } from './pipes/translate.pipe'; import { DatePipe } from './pipes/date.pipe'; import { MatTabsModule } from '@angular/material'; +import { + StringEmptyCheckPipe, + StringFormatterPhonePipe +} from './pipes/ucapString.pipe'; const COMPONENTS = [ FileUploadQueueComponent, @@ -102,7 +106,9 @@ const PIPES = [ SecondsToMinutesPipe, LinkyPipe, TranslatePipe, - DatePipe + DatePipe, + StringEmptyCheckPipe, + StringFormatterPhonePipe ]; const SERVICES = [ BottomSheetService,