Call 기능 구현.

>> call api 호출 후 응답값에 대한 처리가 필요함. 현재 응답이 느려서 500 에러 떨어짐.
This commit is contained in:
leejinho 2019-12-16 17:42:49 +09:00
parent 0a3e8a9df0
commit abc1215d6c
38 changed files with 714 additions and 23 deletions

View File

@ -1753,6 +1753,39 @@
} }
} }
} }
},
"ucap-webmessenger-api-prompt": {
"projectType": "library",
"root": "projects/ucap-webmessenger-api-prompt",
"sourceRoot": "projects/ucap-webmessenger-api-prompt/src",
"prefix": "ucap-api-prompt",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ucap-webmessenger-api-prompt/tsconfig.lib.json",
"project": "projects/ucap-webmessenger-api-prompt/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ucap-webmessenger-api-prompt/src/test.ts",
"tsConfig": "projects/ucap-webmessenger-api-prompt/tsconfig.spec.json",
"karmaConfig": "projects/ucap-webmessenger-api-prompt/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/ucap-webmessenger-api-prompt/tsconfig.lib.json",
"projects/ucap-webmessenger-api-prompt/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
}
}
}
} }
}, },
"defaultProject": "ucap-webmessenger-app" "defaultProject": "ucap-webmessenger-app"

View File

@ -0,0 +1,24 @@
# UcapWebmessengerApiPrompt
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.11.
## Code scaffolding
Run `ng generate component component-name --project ucap-webmessenger-api-prompt` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ucap-webmessenger-api-prompt`.
> Note: Don't forget to add `--project ucap-webmessenger-api-prompt` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build ucap-webmessenger-api-prompt` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build ucap-webmessenger-api-prompt`, go to the dist folder `cd dist/ucap-webmessenger-api-prompt` and run `npm publish`.
## Running unit tests
Run `ng test ucap-webmessenger-api-prompt` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/ucap-webmessenger-api-prompt'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ucap-webmessenger-api-prompt",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@ -0,0 +1,8 @@
{
"name": "@ucap-webmessenger-api-prompt",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^8.2.11",
"@angular/core": "^8.2.11"
}
}

View File

@ -0,0 +1,7 @@
import { PromptMessageStatusCode } from '../types/prompt-message-status-code.type';
export interface PromptAPIResponse {
_id?: string;
responseCode: PromptMessageStatusCode;
responseMsg: string;
}

View File

@ -0,0 +1,35 @@
import {
APIRequest,
APIDecoder,
APIEncoder,
ParameterUtil
} from '@ucap-webmessenger/api';
import { DeviceType } from '@ucap-webmessenger/core';
import { PromptAPIResponse } from './api-prompt';
export interface CallRequest extends APIRequest {
userSeq: number;
deviceType: DeviceType;
tokenKey: string;
calleeNumber: string;
}
export interface CallResponse extends PromptAPIResponse {}
const callEncodeMap = {
userSeq: 'userSeq',
deviceType: 'deviceType',
tokenKey: 'tokenKey',
calleeNumber: 'calleeNumber'
};
export const encodeCall: APIEncoder<CallRequest> = (req: CallRequest) => {
return ParameterUtil.encode(callEncodeMap, req);
};
export const decodeCall: APIDecoder<CallResponse> = (res: any) => {
return {
responseCode: res.responseCode,
responseMsg: res.responseMsg
} as CallResponse;
};

View File

@ -0,0 +1,5 @@
import { ModuleConfig as CoreModuleConfig } from '@ucap-webmessenger/core';
import { Urls } from './urls';
export interface ModuleConfig extends CoreModuleConfig<Urls> {}

View File

@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const _MODULE_CONFIG = new InjectionToken(
'@ucap-webmessenger/api-prompt config of module'
);

View File

@ -0,0 +1,4 @@
export interface Urls {
/** Click to Call */
sendCall: string;
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { CallService } from './call.service';
describe('CallService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: CallService = TestBed.get(CallService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,45 @@
import { Injectable, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { _MODULE_CONFIG } from '../config/token';
import { ModuleConfig } from '../config/module-config';
import { Urls } from '../config/urls';
import { UrlConfig } from '@ucap-webmessenger/core';
import {
CallRequest,
CallResponse,
encodeCall,
decodeCall
} from '../apis/call';
@Injectable({
providedIn: 'root'
})
export class CallService {
readonly urls: Urls;
constructor(
@Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig,
private httpClient: HttpClient
) {
this.urls = UrlConfig.getUrls(
this.moduleConfig.hostConfig,
this.moduleConfig.urls
);
}
public sendCall(req: CallRequest): Observable<CallResponse> {
return this.httpClient
.post<any>(
this.urls.sendCall,
{},
{
params: encodeCall(req)
}
)
.pipe(map(res => decodeCall(res)));
}
}

View File

@ -0,0 +1,10 @@
export enum PromptMessageStatusCode {
/** 정상 */
Success = '200',
/** 사용자 정보 확인 불가 */
Fail_Auth = '204',
/** Parameter 부족 */
Fail_Parameter = '412',
/** 서버 에러, Click to Call 실패 */
Fail = '500'
}

View File

@ -0,0 +1,24 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { _MODULE_CONFIG } from './config/token';
import { ModuleConfig } from './config/module-config';
import { CallService } from './services/call.service';
const SERVICES = [CallService];
@NgModule({
declarations: [],
imports: [],
exports: []
})
export class UCapPromptApiModule {
public static forRoot(
config: ModuleConfig
): ModuleWithProviders<UCapPromptApiModule> {
return {
ngModule: UCapPromptApiModule,
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
};
}
}

View File

@ -0,0 +1,17 @@
/*
* Public API Surface of ucap-webmessenger-api-prompt
*/
export * from './lib/apis/api-prompt';
export * from './lib/apis/call';
export * from './lib/services/call.service';
export * from './lib/types/prompt-message-status-code.type';
export * from './lib/types/prompt-message-status-code.type';
export * from './lib/ucap-prompt-api.module';
export * from './lib/config/urls';
export * from './lib/config/module-config';

View File

@ -0,0 +1,21 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -0,0 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -0,0 +1,7 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [true, "attribute", "ucapApiPrompt", "camelCase"],
"component-selector": [true, "element", "ucap-api-prompt", "kebab-case"]
}
}

View File

@ -18,6 +18,7 @@ import { UCapCommonApiModule } from '@ucap-webmessenger/api-common';
import { UCapExternalApiModule } from '@ucap-webmessenger/api-external'; import { UCapExternalApiModule } from '@ucap-webmessenger/api-external';
import { UCapMessageApiModule } from '@ucap-webmessenger/api-message'; import { UCapMessageApiModule } from '@ucap-webmessenger/api-message';
import { UCapPublicApiModule } from '@ucap-webmessenger/api-public'; import { UCapPublicApiModule } from '@ucap-webmessenger/api-public';
import { UCapPromptApiModule } from '@ucap-webmessenger/api-prompt';
import { UCapPiModule } from '@ucap-webmessenger/pi'; import { UCapPiModule } from '@ucap-webmessenger/pi';
@ -66,6 +67,7 @@ import { environment } from '../environments/environment';
UCapPublicApiModule.forRoot(environment.publicApiModuleConfig), UCapPublicApiModule.forRoot(environment.publicApiModuleConfig),
UCapExternalApiModule.forRoot(environment.externalApiModuleConfig), UCapExternalApiModule.forRoot(environment.externalApiModuleConfig),
UCapMessageApiModule.forRoot(environment.messageApiModuleConfig), UCapMessageApiModule.forRoot(environment.messageApiModuleConfig),
UCapPromptApiModule.forRoot(environment.promptApiModuleConfig),
UCapPiModule.forRoot(environment.piModuleConfig), UCapPiModule.forRoot(environment.piModuleConfig),

View File

@ -188,6 +188,7 @@
(checkAllUser)="onCheckAllUser($event)" (checkAllUser)="onCheckAllUser($event)"
(checkUser)="onCheckUser($event)" (checkUser)="onCheckUser($event)"
(openProfile)="onClickOpenProfile($event)" (openProfile)="onClickOpenProfile($event)"
(sendCall)="onClickSendClickToCall($event)"
(toggleUser)="onToggleUser($event)" (toggleUser)="onToggleUser($event)"
class="organization-side" class="organization-side"
></app-layout-chat-left-sidenav-organization> ></app-layout-chat-left-sidenav-organization>

View File

@ -71,6 +71,8 @@ export class LeftSideComponent implements OnInit, OnDestroy {
openProfile = new EventEmitter< openProfile = new EventEmitter<
UserInfo | UserInfoSS | UserInfoF | UserInfoDN UserInfo | UserInfoSS | UserInfoF | UserInfoDN
>(); >();
@Output()
sendCall = new EventEmitter<string>();
@ViewChildren('tabs') tabs: QueryList<ElementRef<HTMLDivElement>>; @ViewChildren('tabs') tabs: QueryList<ElementRef<HTMLDivElement>>;
currentTabLable: string; currentTabLable: string;
@ -260,6 +262,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
this.openProfile.emit(userInfo); this.openProfile.emit(userInfo);
} }
onClickSendClickToCall(calleeNumber: string) {
this.sendCall.emit(calleeNumber);
}
onSelectedTabChange(event: MatTabChangeEvent) { onSelectedTabChange(event: MatTabChangeEvent) {
this.setFabInitial(event.tab.ariaLabel); this.setFabInitial(event.tab.ariaLabel);

View File

@ -232,6 +232,7 @@
> >
그룹 쪽지 보내기 그룹 쪽지 보내기
</button> </button>
<mat-divider *ngIf="getShowGroupContextMenu('DIV1', group)"></mat-divider>
<button <button
mat-menu-item mat-menu-item
*ngIf="getShowGroupContextMenu('RENAME', group)" *ngIf="getShowGroupContextMenu('RENAME', group)"
@ -239,7 +240,6 @@
> >
그룹 이름 바꾸기 그룹 이름 바꾸기
</button> </button>
<mat-divider *ngIf="getShowGroupContextMenu('DIV1', group)"></mat-divider>
<button <button
mat-menu-item mat-menu-item
*ngIf="getShowGroupContextMenu('EDIT_MEMBER', group)" *ngIf="getShowGroupContextMenu('EDIT_MEMBER', group)"

View File

@ -72,6 +72,7 @@ import {
MessageWriteDialogResult, MessageWriteDialogResult,
MessageWriteDialogData MessageWriteDialogData
} from '../../dialogs/message/message-write.dialog.component'; } from '../../dialogs/message/message-write.dialog.component';
import { environment } from '../../../../../environments/environment';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -322,6 +323,21 @@ export class GroupComponent implements OnInit, OnDestroy {
if (!group || group === undefined) { if (!group || group === undefined) {
return false; return false;
} }
/** 수정불가 그룹 핸들링. */
if (
!!group &&
!!environment.customConfig &&
!!environment.customConfig.fixedGroupSeqs
) {
const fixedGroupSeqs: number[] =
environment.customConfig.fixedGroupSeqs;
if (!!fixedGroupSeqs && fixedGroupSeqs.length > 0) {
if (fixedGroupSeqs.indexOf(group.seq) > -1) {
return false;
}
}
}
} }
// 기본 그룹 숨김메뉴 // 기본 그룹 숨김메뉴

View File

@ -154,10 +154,20 @@
(ucapClickOutside)="orgUserContextMenuTrigger.closeMenu()" (ucapClickOutside)="orgUserContextMenuTrigger.closeMenu()"
> >
<ng-template matMenuContent let-userInfo="userInfo"> <ng-template matMenuContent let-userInfo="userInfo">
<button mat-menu-item (click)="onClickContextMenu('CALL_LINE', userInfo)"> <button
mat-menu-item
*ngIf="getShowCall('CALL_LINE', userInfo)"
[disabled]="getEnableCall()"
(click)="onClickContextMenu('CALL_LINE', userInfo)"
>
내선번호 전화걸기 내선번호 전화걸기
</button> </button>
<button mat-menu-item (click)="onClickContextMenu('CALL_MOBILE', userInfo)"> <button
mat-menu-item
*ngIf="getShowCall('CALL_MOBILE', userInfo)"
[disabled]="getEnableCall()"
(click)="onClickContextMenu('CALL_MOBILE', userInfo)"
>
모바일 전화걸기 모바일 전화걸기
</button> </button>
<button <button

View File

@ -101,6 +101,8 @@ export class OrganizationComponent
openProfile = new EventEmitter< openProfile = new EventEmitter<
UserInfo | UserInfoSS | UserInfoF | UserInfoDN UserInfo | UserInfoSS | UserInfoF | UserInfoDN
>(); >();
@Output()
sendCall = new EventEmitter<string>();
@ViewChild('cvsvDeptUser', { static: false }) @ViewChild('cvsvDeptUser', { static: false })
cvsvDeptUser: CdkVirtualScrollViewport; cvsvDeptUser: CdkVirtualScrollViewport;
@ -405,6 +407,9 @@ export class OrganizationComponent
onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
this.openProfile.emit(userInfo); this.openProfile.emit(userInfo);
} }
onClickSendClickToCall(calleeNumber: string) {
this.sendCall.emit(calleeNumber);
}
onClickShowSelectedUserList() { onClickShowSelectedUserList() {
this.logger.debug('onClickShowSelectedUserList', this.selectedUserList); this.logger.debug('onClickShowSelectedUserList', this.selectedUserList);
@ -475,15 +480,56 @@ export class OrganizationComponent
this.orgUserContextMenuTrigger.openMenu(); this.orgUserContextMenuTrigger.openMenu();
} }
async onClickContextMenu(type: string, userInfo: UserInfo) { getEnableCall(): boolean {
console.log(userInfo); if (
!!this.loginRes &&
!!this.loginRes.madn &&
this.loginRes.madn.trim().length > 0
) {
return false;
} else {
return true;
}
}
getShowCall(type: string, userInfo: UserInfo) {
let valid = false;
switch (type) { switch (type) {
case 'CALL_LINE': case 'CALL_LINE':
{ {
if (
!!userInfo &&
!!userInfo.lineNumber &&
userInfo.lineNumber.trim().length > 0
) {
valid = true;
}
} }
break; break;
case 'CALL_MOBILE': case 'CALL_MOBILE':
{ {
if (
!!userInfo &&
!!userInfo.hpNumber &&
userInfo.hpNumber.trim().length > 0
) {
valid = true;
}
}
break;
}
return valid;
}
async onClickContextMenu(type: string, userInfo: UserInfo) {
switch (type) {
case 'CALL_LINE':
{
this.onClickSendClickToCall(userInfo.lineNumber);
}
break;
case 'CALL_MOBILE':
{
this.onClickSendClickToCall(userInfo.hpNumber);
} }
break; break;
case 'SEND_MESSAGE': case 'SEND_MESSAGE':

View File

@ -2,10 +2,12 @@
[userInfo]="userInfo" [userInfo]="userInfo"
[profileImageRoot]="sessionVerinfo.profileRoot" [profileImageRoot]="sessionVerinfo.profileRoot"
[isMe]="isMe" [isMe]="isMe"
[myMadn]="loginRes.madn"
[isBuddy]="isBuddy" [isBuddy]="isBuddy"
[isFavorit]="isFavorit" [isFavorit]="isFavorit"
(openChat)="onClickChat($event)" (openChat)="onClickChat($event)"
(sendMessage)="onClickSendMessage($event)" (sendMessage)="onClickSendMessage($event)"
(sendCall)="onClickSendClickToCall($event)"
(toggleFavorit)="onClickToggleFavorit($event)" (toggleFavorit)="onClickToggleFavorit($event)"
(toggleBuddy)="onClickToggleBuddy($event)" (toggleBuddy)="onClickToggleBuddy($event)"
(uploadProfileImage)="onUploadProfileImage($event)" (uploadProfileImage)="onUploadProfileImage($event)"

View File

@ -20,7 +20,10 @@ import {
ConfirmDialogComponent, ConfirmDialogComponent,
ConfirmDialogData, ConfirmDialogData,
ConfirmDialogResult, ConfirmDialogResult,
SnackBarService SnackBarService,
AlertDialogComponent,
AlertDialogResult,
AlertDialogData
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
@ -40,6 +43,11 @@ import {
MessageWriteDialogResult, MessageWriteDialogResult,
MessageWriteDialogData MessageWriteDialogData
} from '../message/message-write.dialog.component'; } from '../message/message-write.dialog.component';
import {
CallService,
PromptMessageStatusCode
} from '@ucap-webmessenger/api-prompt';
import { NGXLogger } from 'ngx-logger';
export interface ProfileDialogData { export interface ProfileDialogData {
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -70,8 +78,10 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
private dialogService: DialogService, private dialogService: DialogService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private commonApiService: CommonApiService, private commonApiService: CommonApiService,
private callService: CallService,
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
private store: Store<any> private store: Store<any>,
private logger: NGXLogger
) { ) {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO KEY_VER_INFO
@ -145,6 +155,72 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
} }
} }
async onClickSendClickToCall(calleeNumber: string) {
const madn = this.loginRes.madn;
if (!madn || madn.trim().length === 0) {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
data: {
title: '',
html: `전화를 걸 수 없는 사용자 입니다.`
}
});
return false;
}
calleeNumber = calleeNumber.replace(/\D/g, '');
if (!!calleeNumber && calleeNumber.length > 0) {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '360px',
data: {
title: '전화 걸기',
html: `${calleeNumber}로 전화를 거시겠습니까?`
}
});
if (!!result && !!result.choice && result.choice) {
this.callService
.sendCall({
userSeq: this.loginRes.userSeq,
deviceType: this.environmentsInfo.deviceType,
tokenKey: this.loginRes.tokenString,
calleeNumber
})
.pipe(
take(1),
map(res => {
if (res.responseCode === PromptMessageStatusCode.Success) {
this.logger.debug('SUCCESS');
this.logger.debug(res);
} else {
this.logger.error(res);
}
})
)
.subscribe();
}
} else {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
data: {
title: '',
html: `상대방 번호가 없어 전화를 걸 수 없습니다.`
}
});
}
}
onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) { onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) {
this.store.dispatch( this.store.dispatch(
SyncStore.updateBuddy({ SyncStore.updateBuddy({

View File

@ -17,6 +17,7 @@
<div class="left-side"> <div class="left-side">
<app-layout-messenger-left-side <app-layout-messenger-left-side
(openProfile)="onClickOpenProfile($event)" (openProfile)="onClickOpenProfile($event)"
(sendCall)="onClickSendClickToCall($event)"
></app-layout-messenger-left-side> ></app-layout-messenger-left-side>
</div> </div>
</as-split-area> </as-split-area>

View File

@ -17,7 +17,15 @@ import {
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status'; import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { StatusType, StatusCode } from '@ucap-webmessenger/core'; import { StatusType, StatusCode } from '@ucap-webmessenger/core';
import { DialogService } from '@ucap-webmessenger/ui'; import {
DialogService,
ConfirmDialogComponent,
ConfirmDialogResult,
AlertDialogComponent,
AlertDialogResult,
AlertDialogData,
ConfirmDialogData
} from '@ucap-webmessenger/ui';
import { import {
ProfileDialogComponent, ProfileDialogComponent,
ProfileDialogData, ProfileDialogData,
@ -27,6 +35,9 @@ import { MatDrawer } from '@angular/material';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang'; import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
import { CallService } from '@ucap-webmessenger/api-prompt';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
@Component({ @Component({
selector: 'app-page-messenger-main', selector: 'app-page-messenger-main',
@ -44,6 +55,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription; loginResSubscription: Subscription;
environmentsInfo: EnvironmentsInfo;
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer; @ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
@ -52,9 +64,15 @@ export class MainPageComponent implements OnInit, OnDestroy {
private store: Store<any>, private store: Store<any>,
private statusProtocolService: StatusProtocolService, private statusProtocolService: StatusProtocolService,
private daesangProtocolService: DaesangProtocolService, private daesangProtocolService: DaesangProtocolService,
private callService: CallService,
private sessionStorageService: SessionStorageService,
private dialogService: DialogService, private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
}
ngOnInit(): void { ngOnInit(): void {
this.selectedChat$ = this.store.pipe( this.selectedChat$ = this.store.pipe(
@ -185,7 +203,6 @@ export class MainPageComponent implements OnInit, OnDestroy {
.pipe( .pipe(
take(1), take(1),
map(res => { map(res => {
console.log(res);
if (!!res && !!res.userInfo) { if (!!res && !!res.userInfo) {
this.dialogService.open< this.dialogService.open<
ProfileDialogComponent, ProfileDialogComponent,
@ -202,6 +219,67 @@ export class MainPageComponent implements OnInit, OnDestroy {
.subscribe(); .subscribe();
} }
async onClickSendClickToCall(calleeNumber: string) {
const madn = this.loginRes.madn;
if (!madn || madn.trim().length === 0) {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
data: {
title: '',
html: `전화를 걸 수 없는 사용자 입니다.`
}
});
return false;
}
calleeNumber = calleeNumber.replace(/\D/g, '');
if (!!calleeNumber && calleeNumber.length > 0) {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '360px',
data: {
title: '전화 걸기',
html: `${calleeNumber}로 전화를 거시겠습니까?`
}
});
if (!!result && !!result.choice && result.choice) {
this.callService
.sendCall({
userSeq: this.loginRes.userSeq,
deviceType: this.environmentsInfo.deviceType,
tokenKey: this.loginRes.tokenString,
calleeNumber
})
.pipe(
take(1),
map(res => {
console.log(res);
})
)
.subscribe();
}
} else {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
data: {
title: '',
html: `상대방 번호가 없어 전화를 걸 수 없습니다.`
}
});
}
}
onCloseRightDrawer() { onCloseRightDrawer() {
this.rightDrawer.close(); this.rightDrawer.close();
} }

View File

@ -6,7 +6,8 @@ import {
externalApiUrls, externalApiUrls,
piUrls, piUrls,
protocolUrls, protocolUrls,
messageApiUrls messageApiUrls,
promptUrls
} from './environment.type'; } from './environment.type';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
@ -56,7 +57,10 @@ export const environment: Environment = {
userKey: 'DaesangSSOProject', userKey: 'DaesangSSOProject',
isBase64: 'N' isBase64: 'N'
}, },
appKey: '!@#$DAESANG%^&*' appKey: '!@#$DAESANG%^&*',
/** 삭제,수정 불가 그룹 Seqs:number[] */
fixedGroupSeqs: [-5]
}, },
commonApiModuleConfig: { commonApiModuleConfig: {
@ -96,6 +100,15 @@ export const environment: Environment = {
urls: messageApiUrls urls: messageApiUrls
}, },
promptApiModuleConfig: {
hostConfig: {
protocol: 'http',
domain: '15.164.139.105',
port: 9097
},
urls: promptUrls
},
piModuleConfig: { piModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'http',

View File

@ -6,7 +6,8 @@ import {
externalApiUrls, externalApiUrls,
piUrls, piUrls,
protocolUrls, protocolUrls,
messageApiUrls messageApiUrls,
promptUrls
} from './environment.type'; } from './environment.type';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
@ -56,14 +57,17 @@ export const environment: Environment = {
userKey: 'DaesangSSOProject', userKey: 'DaesangSSOProject',
isBase64: 'N' isBase64: 'N'
}, },
appKey: '!@#$DAESANG%^&*' appKey: '!@#$DAESANG%^&*',
/** 삭제,수정 불가 그룹 Seqs:number[] */
fixedGroupSeqs: [-5]
}, },
commonApiModuleConfig: { commonApiModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'https',
domain: 'messenger.daesang.com', domain: 'messenger.daesang.com',
port: 8011 port: 443
}, },
urls: commonApiUrls, urls: commonApiUrls,
acceptableFileExtensions: commonApiacceptableFileExtensions acceptableFileExtensions: commonApiacceptableFileExtensions
@ -71,18 +75,18 @@ export const environment: Environment = {
publicApiModuleConfig: { publicApiModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'https',
domain: 'messenger.daesang.com', domain: 'messenger.daesang.com',
port: 8011 port: 443
}, },
urls: publicApiUrls urls: publicApiUrls
}, },
externalApiModuleConfig: { externalApiModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'https',
domain: 'messenger.daesang.com', domain: 'messenger.daesang.com',
port: 8011 port: 443
}, },
urls: externalApiUrls urls: externalApiUrls
}, },
@ -96,6 +100,15 @@ export const environment: Environment = {
urls: messageApiUrls urls: messageApiUrls
}, },
promptApiModuleConfig: {
hostConfig: {
protocol: 'http',
domain: 'messenger.daesang.com',
port: 9097
},
urls: promptUrls
},
piModuleConfig: { piModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'http',

View File

@ -6,7 +6,8 @@ import {
externalApiUrls, externalApiUrls,
piUrls, piUrls,
protocolUrls, protocolUrls,
messageApiUrls messageApiUrls,
promptUrls
} from './environment.type'; } from './environment.type';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
@ -88,6 +89,15 @@ export const environment: Environment = {
urls: messageApiUrls urls: messageApiUrls
}, },
promptApiModuleConfig: {
hostConfig: {
protocol: 'http',
domain: '15.164.139.105',
port: 9097
},
urls: promptUrls
},
piModuleConfig: { piModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'http',

View File

@ -6,7 +6,8 @@ import {
externalApiUrls, externalApiUrls,
piUrls, piUrls,
protocolUrls, protocolUrls,
messageApiUrls messageApiUrls,
promptUrls
} from './environment.type'; } from './environment.type';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
@ -88,6 +89,15 @@ export const environment: Environment = {
urls: messageApiUrls urls: messageApiUrls
}, },
promptApiModuleConfig: {
hostConfig: {
protocol: 'http',
domain: '15.164.139.105',
port: 9097
},
urls: promptUrls
},
piModuleConfig: { piModuleConfig: {
hostConfig: { hostConfig: {
protocol: 'http', protocol: 'http',

View File

@ -14,6 +14,10 @@ import {
ModuleConfig as MessageApiModuleConfig, ModuleConfig as MessageApiModuleConfig,
Urls as MessageApiUrls Urls as MessageApiUrls
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import {
ModuleConfig as PromptApiModuleConfig,
Urls as PromptUrls
} from '@ucap-webmessenger/api-prompt';
import { import {
ModuleConfig as PiModuleConfig, ModuleConfig as PiModuleConfig,
Urls as PiUrls Urls as PiUrls
@ -66,6 +70,7 @@ export interface Environment {
publicApiModuleConfig: PublicApiModuleConfig; publicApiModuleConfig: PublicApiModuleConfig;
externalApiModuleConfig: ExternalApiModuleConfig; externalApiModuleConfig: ExternalApiModuleConfig;
messageApiModuleConfig: MessageApiModuleConfig; messageApiModuleConfig: MessageApiModuleConfig;
promptApiModuleConfig: PromptApiModuleConfig;
piModuleConfig: PiModuleConfig; piModuleConfig: PiModuleConfig;
protocolModuleConfig: ProtocolModuleConfig; protocolModuleConfig: ProtocolModuleConfig;
nativeModuleConfig: NativeModuleConfig; nativeModuleConfig: NativeModuleConfig;
@ -125,6 +130,9 @@ export const messageApiUrls: MessageApiUrls = {
retrieveNoticeList: '/uCapMsg/notice/retrieveNoticeList.do' retrieveNoticeList: '/uCapMsg/notice/retrieveNoticeList.do'
}; };
export const promptUrls: PromptUrls = {
sendCall: '/uCapPrompt/api/call/clicktocall'
};
export const piUrls: PiUrls = { export const piUrls: PiUrls = {
login2: '/uCapPi/login2', login2: '/uCapPi/login2',
userTermsAction: '/uCapPi/user/terms.action', userTermsAction: '/uCapPi/user/terms.action',

View File

@ -293,6 +293,7 @@
*ngIf="!isMe" *ngIf="!isMe"
matTooltip="전화" matTooltip="전화"
matTooltipPosition="above" matTooltipPosition="above"
[disabled]="getDisabledBtn('LINE')"
(click)="onClickCall('LINE')" (click)="onClickCall('LINE')"
> >
<svg <svg
@ -318,6 +319,7 @@
*ngIf="!isMe" *ngIf="!isMe"
matTooltip="모바일" matTooltip="모바일"
matTooltipPosition="above" matTooltipPosition="above"
[disabled]="getDisabledBtn('MOBILE')"
(click)="onClickCall('MOBILE')" (click)="onClickCall('MOBILE')"
> >
<span class="mdi mdi-cellphone-android mdi-24px"></span> <span class="mdi mdi-cellphone-android mdi-24px"></span>
@ -329,6 +331,7 @@
*ngIf="!isMe" *ngIf="!isMe"
matTooltip="SMS" matTooltip="SMS"
matTooltipPosition="above" matTooltipPosition="above"
[disabled]="getDisabledBtn('SMS')"
(click)="onClickSMS()" (click)="onClickSMS()"
> >
<span class="mdi mdi-email-outline mdi-24px"></span> <span class="mdi mdi-email-outline mdi-24px"></span>

View File

@ -29,12 +29,16 @@ export class ProfileComponent implements OnInit {
isFavorit: boolean; isFavorit: boolean;
@Input() @Input()
userInfo: UserInfoSS; userInfo: UserInfoSS;
@Input()
myMadn?: string;
@Output() @Output()
openChat = new EventEmitter<UserInfoSS>(); openChat = new EventEmitter<UserInfoSS>();
@Output() @Output()
sendMessage = new EventEmitter<UserInfoSS>(); sendMessage = new EventEmitter<UserInfoSS>();
@Output() @Output()
sendCall = new EventEmitter<string>();
@Output()
toggleFavorit = new EventEmitter<{ toggleFavorit = new EventEmitter<{
userInfo: UserInfoSS; userInfo: UserInfoSS;
isFavorit: boolean; isFavorit: boolean;
@ -63,7 +67,16 @@ export class ProfileComponent implements OnInit {
this.openChat.emit(this.userInfo); this.openChat.emit(this.userInfo);
} }
onClickCall(type: string) {} onClickCall(type: string) {
let calleeNumber = '';
if (type === 'LINE') {
calleeNumber = this.userInfo.lineNumber;
} else {
calleeNumber = this.userInfo.hpNumber;
}
this.sendCall.emit(calleeNumber);
}
onClickSMS() {} onClickSMS() {}
@ -127,4 +140,46 @@ export class ProfileComponent implements OnInit {
return workstatus; return workstatus;
} }
getDisabledBtn(type: string): boolean {
if (!this.myMadn || this.myMadn.trim().length === 0) {
if (type === 'LINE' || type === 'MOBILE') {
return true;
}
}
if (type === 'LINE') {
if (
!!this.userInfo &&
!!this.userInfo.lineNumber &&
this.userInfo.lineNumber.trim().length > 0
) {
return false;
} else {
return true;
}
} else if (type === 'MOBILE') {
if (
!!this.userInfo &&
!!this.userInfo.hpNumber &&
this.userInfo.hpNumber.trim().length > 0
) {
return false;
} else {
return true;
}
} else if (type === 'SMS') {
if (
!!this.userInfo &&
!!this.userInfo.hpNumber &&
this.userInfo.hpNumber.trim().length > 0
) {
return false;
} else {
return true;
}
}
return true;
}
} }

View File

@ -33,6 +33,9 @@
"@ucap-webmessenger/api-message": [ "@ucap-webmessenger/api-message": [
"projects/ucap-webmessenger-api-message/src/public-api" "projects/ucap-webmessenger-api-message/src/public-api"
], ],
"@ucap-webmessenger/api-prompt": [
"projects/ucap-webmessenger-api-prompt/src/public-api"
],
"@ucap-webmessenger/pi": ["projects/ucap-webmessenger-pi/src/public-api"], "@ucap-webmessenger/pi": ["projects/ucap-webmessenger-pi/src/public-api"],
"@ucap-webmessenger/ui": ["projects/ucap-webmessenger-ui/src/public-api"], "@ucap-webmessenger/ui": ["projects/ucap-webmessenger-ui/src/public-api"],
"@ucap-webmessenger/ui-account": [ "@ucap-webmessenger/ui-account": [