Call 기능 구현.
>> call api 호출 후 응답값에 대한 처리가 필요함. 현재 응답이 느려서 500 에러 떨어짐.
This commit is contained in:
parent
0a3e8a9df0
commit
abc1215d6c
33
angular.json
33
angular.json
|
@ -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"
|
||||
|
|
24
projects/ucap-webmessenger-api-prompt/README.md
Normal file
24
projects/ucap-webmessenger-api-prompt/README.md
Normal 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).
|
32
projects/ucap-webmessenger-api-prompt/karma.conf.js
Normal file
32
projects/ucap-webmessenger-api-prompt/karma.conf.js
Normal 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
|
||||
});
|
||||
};
|
7
projects/ucap-webmessenger-api-prompt/ng-package.json
Normal file
7
projects/ucap-webmessenger-api-prompt/ng-package.json
Normal 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"
|
||||
}
|
||||
}
|
8
projects/ucap-webmessenger-api-prompt/package.json
Normal file
8
projects/ucap-webmessenger-api-prompt/package.json
Normal 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"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { PromptMessageStatusCode } from '../types/prompt-message-status-code.type';
|
||||
|
||||
export interface PromptAPIResponse {
|
||||
_id?: string;
|
||||
responseCode: PromptMessageStatusCode;
|
||||
responseMsg: string;
|
||||
}
|
35
projects/ucap-webmessenger-api-prompt/src/lib/apis/call.ts
Normal file
35
projects/ucap-webmessenger-api-prompt/src/lib/apis/call.ts
Normal 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;
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
import { ModuleConfig as CoreModuleConfig } from '@ucap-webmessenger/core';
|
||||
|
||||
import { Urls } from './urls';
|
||||
|
||||
export interface ModuleConfig extends CoreModuleConfig<Urls> {}
|
|
@ -0,0 +1,5 @@
|
|||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const _MODULE_CONFIG = new InjectionToken(
|
||||
'@ucap-webmessenger/api-prompt config of module'
|
||||
);
|
|
@ -0,0 +1,4 @@
|
|||
export interface Urls {
|
||||
/** Click to Call */
|
||||
sendCall: string;
|
||||
}
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
export enum PromptMessageStatusCode {
|
||||
/** 정상 */
|
||||
Success = '200',
|
||||
/** 사용자 정보 확인 불가 */
|
||||
Fail_Auth = '204',
|
||||
/** Parameter 부족 */
|
||||
Fail_Parameter = '412',
|
||||
/** 서버 에러, Click to Call 실패 */
|
||||
Fail = '500'
|
||||
}
|
|
@ -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]
|
||||
};
|
||||
}
|
||||
}
|
17
projects/ucap-webmessenger-api-prompt/src/public-api.ts
Normal file
17
projects/ucap-webmessenger-api-prompt/src/public-api.ts
Normal 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';
|
21
projects/ucap-webmessenger-api-prompt/src/test.ts
Normal file
21
projects/ucap-webmessenger-api-prompt/src/test.ts
Normal 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);
|
26
projects/ucap-webmessenger-api-prompt/tsconfig.lib.json
Normal file
26
projects/ucap-webmessenger-api-prompt/tsconfig.lib.json
Normal 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"
|
||||
]
|
||||
}
|
17
projects/ucap-webmessenger-api-prompt/tsconfig.spec.json
Normal file
17
projects/ucap-webmessenger-api-prompt/tsconfig.spec.json
Normal 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"
|
||||
]
|
||||
}
|
7
projects/ucap-webmessenger-api-prompt/tslint.json
Normal file
7
projects/ucap-webmessenger-api-prompt/tslint.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [true, "attribute", "ucapApiPrompt", "camelCase"],
|
||||
"component-selector": [true, "element", "ucap-api-prompt", "kebab-case"]
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import { UCapCommonApiModule } from '@ucap-webmessenger/api-common';
|
|||
import { UCapExternalApiModule } from '@ucap-webmessenger/api-external';
|
||||
import { UCapMessageApiModule } from '@ucap-webmessenger/api-message';
|
||||
import { UCapPublicApiModule } from '@ucap-webmessenger/api-public';
|
||||
import { UCapPromptApiModule } from '@ucap-webmessenger/api-prompt';
|
||||
|
||||
import { UCapPiModule } from '@ucap-webmessenger/pi';
|
||||
|
||||
|
@ -66,6 +67,7 @@ import { environment } from '../environments/environment';
|
|||
UCapPublicApiModule.forRoot(environment.publicApiModuleConfig),
|
||||
UCapExternalApiModule.forRoot(environment.externalApiModuleConfig),
|
||||
UCapMessageApiModule.forRoot(environment.messageApiModuleConfig),
|
||||
UCapPromptApiModule.forRoot(environment.promptApiModuleConfig),
|
||||
|
||||
UCapPiModule.forRoot(environment.piModuleConfig),
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@
|
|||
(checkAllUser)="onCheckAllUser($event)"
|
||||
(checkUser)="onCheckUser($event)"
|
||||
(openProfile)="onClickOpenProfile($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
(toggleUser)="onToggleUser($event)"
|
||||
class="organization-side"
|
||||
></app-layout-chat-left-sidenav-organization>
|
||||
|
|
|
@ -71,6 +71,8 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||
openProfile = new EventEmitter<
|
||||
UserInfo | UserInfoSS | UserInfoF | UserInfoDN
|
||||
>();
|
||||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
|
||||
@ViewChildren('tabs') tabs: QueryList<ElementRef<HTMLDivElement>>;
|
||||
currentTabLable: string;
|
||||
|
@ -260,6 +262,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||
onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
|
||||
this.openProfile.emit(userInfo);
|
||||
}
|
||||
onClickSendClickToCall(calleeNumber: string) {
|
||||
this.sendCall.emit(calleeNumber);
|
||||
}
|
||||
|
||||
onSelectedTabChange(event: MatTabChangeEvent) {
|
||||
this.setFabInitial(event.tab.ariaLabel);
|
||||
|
|
|
@ -232,6 +232,7 @@
|
|||
>
|
||||
그룹 쪽지 보내기
|
||||
</button>
|
||||
<mat-divider *ngIf="getShowGroupContextMenu('DIV1', group)"></mat-divider>
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="getShowGroupContextMenu('RENAME', group)"
|
||||
|
@ -239,7 +240,6 @@
|
|||
>
|
||||
그룹 이름 바꾸기
|
||||
</button>
|
||||
<mat-divider *ngIf="getShowGroupContextMenu('DIV1', group)"></mat-divider>
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="getShowGroupContextMenu('EDIT_MEMBER', group)"
|
||||
|
|
|
@ -72,6 +72,7 @@ import {
|
|||
MessageWriteDialogResult,
|
||||
MessageWriteDialogData
|
||||
} from '../../dialogs/message/message-write.dialog.component';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout-chat-left-sidenav-group',
|
||||
|
@ -322,6 +323,21 @@ export class GroupComponent implements OnInit, OnDestroy {
|
|||
if (!group || group === undefined) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 기본 그룹 숨김메뉴
|
||||
|
|
|
@ -154,10 +154,20 @@
|
|||
(ucapClickOutside)="orgUserContextMenuTrigger.closeMenu()"
|
||||
>
|
||||
<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 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
|
||||
|
|
|
@ -101,6 +101,8 @@ export class OrganizationComponent
|
|||
openProfile = new EventEmitter<
|
||||
UserInfo | UserInfoSS | UserInfoF | UserInfoDN
|
||||
>();
|
||||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
|
||||
@ViewChild('cvsvDeptUser', { static: false })
|
||||
cvsvDeptUser: CdkVirtualScrollViewport;
|
||||
|
@ -405,6 +407,9 @@ export class OrganizationComponent
|
|||
onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
|
||||
this.openProfile.emit(userInfo);
|
||||
}
|
||||
onClickSendClickToCall(calleeNumber: string) {
|
||||
this.sendCall.emit(calleeNumber);
|
||||
}
|
||||
|
||||
onClickShowSelectedUserList() {
|
||||
this.logger.debug('onClickShowSelectedUserList', this.selectedUserList);
|
||||
|
@ -475,15 +480,56 @@ export class OrganizationComponent
|
|||
this.orgUserContextMenuTrigger.openMenu();
|
||||
}
|
||||
|
||||
async onClickContextMenu(type: string, userInfo: UserInfo) {
|
||||
console.log(userInfo);
|
||||
getEnableCall(): boolean {
|
||||
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) {
|
||||
case 'CALL_LINE':
|
||||
{
|
||||
if (
|
||||
!!userInfo &&
|
||||
!!userInfo.lineNumber &&
|
||||
userInfo.lineNumber.trim().length > 0
|
||||
) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
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;
|
||||
case 'SEND_MESSAGE':
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
[userInfo]="userInfo"
|
||||
[profileImageRoot]="sessionVerinfo.profileRoot"
|
||||
[isMe]="isMe"
|
||||
[myMadn]="loginRes.madn"
|
||||
[isBuddy]="isBuddy"
|
||||
[isFavorit]="isFavorit"
|
||||
(openChat)="onClickChat($event)"
|
||||
(sendMessage)="onClickSendMessage($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
(toggleFavorit)="onClickToggleFavorit($event)"
|
||||
(toggleBuddy)="onClickToggleBuddy($event)"
|
||||
(uploadProfileImage)="onUploadProfileImage($event)"
|
||||
|
|
|
@ -20,7 +20,10 @@ import {
|
|||
ConfirmDialogComponent,
|
||||
ConfirmDialogData,
|
||||
ConfirmDialogResult,
|
||||
SnackBarService
|
||||
SnackBarService,
|
||||
AlertDialogComponent,
|
||||
AlertDialogResult,
|
||||
AlertDialogData
|
||||
} from '@ucap-webmessenger/ui';
|
||||
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
|
@ -40,6 +43,11 @@ import {
|
|||
MessageWriteDialogResult,
|
||||
MessageWriteDialogData
|
||||
} from '../message/message-write.dialog.component';
|
||||
import {
|
||||
CallService,
|
||||
PromptMessageStatusCode
|
||||
} from '@ucap-webmessenger/api-prompt';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
|
||||
export interface ProfileDialogData {
|
||||
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
|
||||
|
@ -70,8 +78,10 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
|
|||
private dialogService: DialogService,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private commonApiService: CommonApiService,
|
||||
private callService: CallService,
|
||||
private snackBarService: SnackBarService,
|
||||
private store: Store<any>
|
||||
private store: Store<any>,
|
||||
private logger: NGXLogger
|
||||
) {
|
||||
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
|
||||
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 }) {
|
||||
this.store.dispatch(
|
||||
SyncStore.updateBuddy({
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<div class="left-side">
|
||||
<app-layout-messenger-left-side
|
||||
(openProfile)="onClickOpenProfile($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
></app-layout-messenger-left-side>
|
||||
</div>
|
||||
</as-split-area>
|
||||
|
|
|
@ -17,7 +17,15 @@ import {
|
|||
} from '@ucap-webmessenger/protocol-query';
|
||||
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
|
||||
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 {
|
||||
ProfileDialogComponent,
|
||||
ProfileDialogData,
|
||||
|
@ -27,6 +35,9 @@ import { MatDrawer } from '@angular/material';
|
|||
import { NGXLogger } from 'ngx-logger';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
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({
|
||||
selector: 'app-page-messenger-main',
|
||||
|
@ -44,6 +55,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
|
||||
loginRes: LoginResponse;
|
||||
loginResSubscription: Subscription;
|
||||
environmentsInfo: EnvironmentsInfo;
|
||||
|
||||
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
|
||||
|
||||
|
@ -52,9 +64,15 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
private store: Store<any>,
|
||||
private statusProtocolService: StatusProtocolService,
|
||||
private daesangProtocolService: DaesangProtocolService,
|
||||
private callService: CallService,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private dialogService: DialogService,
|
||||
private logger: NGXLogger
|
||||
) {}
|
||||
) {
|
||||
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
|
||||
KEY_ENVIRONMENTS_INFO
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.selectedChat$ = this.store.pipe(
|
||||
|
@ -185,7 +203,6 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
.pipe(
|
||||
take(1),
|
||||
map(res => {
|
||||
console.log(res);
|
||||
if (!!res && !!res.userInfo) {
|
||||
this.dialogService.open<
|
||||
ProfileDialogComponent,
|
||||
|
@ -202,6 +219,67 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
.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() {
|
||||
this.rightDrawer.close();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
externalApiUrls,
|
||||
piUrls,
|
||||
protocolUrls,
|
||||
messageApiUrls
|
||||
messageApiUrls,
|
||||
promptUrls
|
||||
} from './environment.type';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -56,7 +57,10 @@ export const environment: Environment = {
|
|||
userKey: 'DaesangSSOProject',
|
||||
isBase64: 'N'
|
||||
},
|
||||
appKey: '!@#$DAESANG%^&*'
|
||||
appKey: '!@#$DAESANG%^&*',
|
||||
|
||||
/** 삭제,수정 불가 그룹 Seqs:number[] */
|
||||
fixedGroupSeqs: [-5]
|
||||
},
|
||||
|
||||
commonApiModuleConfig: {
|
||||
|
@ -96,6 +100,15 @@ export const environment: Environment = {
|
|||
urls: messageApiUrls
|
||||
},
|
||||
|
||||
promptApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
domain: '15.164.139.105',
|
||||
port: 9097
|
||||
},
|
||||
urls: promptUrls
|
||||
},
|
||||
|
||||
piModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
externalApiUrls,
|
||||
piUrls,
|
||||
protocolUrls,
|
||||
messageApiUrls
|
||||
messageApiUrls,
|
||||
promptUrls
|
||||
} from './environment.type';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -56,14 +57,17 @@ export const environment: Environment = {
|
|||
userKey: 'DaesangSSOProject',
|
||||
isBase64: 'N'
|
||||
},
|
||||
appKey: '!@#$DAESANG%^&*'
|
||||
appKey: '!@#$DAESANG%^&*',
|
||||
|
||||
/** 삭제,수정 불가 그룹 Seqs:number[] */
|
||||
fixedGroupSeqs: [-5]
|
||||
},
|
||||
|
||||
commonApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
protocol: 'https',
|
||||
domain: 'messenger.daesang.com',
|
||||
port: 8011
|
||||
port: 443
|
||||
},
|
||||
urls: commonApiUrls,
|
||||
acceptableFileExtensions: commonApiacceptableFileExtensions
|
||||
|
@ -71,18 +75,18 @@ export const environment: Environment = {
|
|||
|
||||
publicApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
protocol: 'https',
|
||||
domain: 'messenger.daesang.com',
|
||||
port: 8011
|
||||
port: 443
|
||||
},
|
||||
urls: publicApiUrls
|
||||
},
|
||||
|
||||
externalApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
protocol: 'https',
|
||||
domain: 'messenger.daesang.com',
|
||||
port: 8011
|
||||
port: 443
|
||||
},
|
||||
urls: externalApiUrls
|
||||
},
|
||||
|
@ -96,6 +100,15 @@ export const environment: Environment = {
|
|||
urls: messageApiUrls
|
||||
},
|
||||
|
||||
promptApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
domain: 'messenger.daesang.com',
|
||||
port: 9097
|
||||
},
|
||||
urls: promptUrls
|
||||
},
|
||||
|
||||
piModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
externalApiUrls,
|
||||
piUrls,
|
||||
protocolUrls,
|
||||
messageApiUrls
|
||||
messageApiUrls,
|
||||
promptUrls
|
||||
} from './environment.type';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -88,6 +89,15 @@ export const environment: Environment = {
|
|||
urls: messageApiUrls
|
||||
},
|
||||
|
||||
promptApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
domain: '15.164.139.105',
|
||||
port: 9097
|
||||
},
|
||||
urls: promptUrls
|
||||
},
|
||||
|
||||
piModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
externalApiUrls,
|
||||
piUrls,
|
||||
protocolUrls,
|
||||
messageApiUrls
|
||||
messageApiUrls,
|
||||
promptUrls
|
||||
} from './environment.type';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -88,6 +89,15 @@ export const environment: Environment = {
|
|||
urls: messageApiUrls
|
||||
},
|
||||
|
||||
promptApiModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
domain: '15.164.139.105',
|
||||
port: 9097
|
||||
},
|
||||
urls: promptUrls
|
||||
},
|
||||
|
||||
piModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'http',
|
||||
|
|
|
@ -14,6 +14,10 @@ import {
|
|||
ModuleConfig as MessageApiModuleConfig,
|
||||
Urls as MessageApiUrls
|
||||
} from '@ucap-webmessenger/api-message';
|
||||
import {
|
||||
ModuleConfig as PromptApiModuleConfig,
|
||||
Urls as PromptUrls
|
||||
} from '@ucap-webmessenger/api-prompt';
|
||||
import {
|
||||
ModuleConfig as PiModuleConfig,
|
||||
Urls as PiUrls
|
||||
|
@ -66,6 +70,7 @@ export interface Environment {
|
|||
publicApiModuleConfig: PublicApiModuleConfig;
|
||||
externalApiModuleConfig: ExternalApiModuleConfig;
|
||||
messageApiModuleConfig: MessageApiModuleConfig;
|
||||
promptApiModuleConfig: PromptApiModuleConfig;
|
||||
piModuleConfig: PiModuleConfig;
|
||||
protocolModuleConfig: ProtocolModuleConfig;
|
||||
nativeModuleConfig: NativeModuleConfig;
|
||||
|
@ -125,6 +130,9 @@ export const messageApiUrls: MessageApiUrls = {
|
|||
|
||||
retrieveNoticeList: '/uCapMsg/notice/retrieveNoticeList.do'
|
||||
};
|
||||
export const promptUrls: PromptUrls = {
|
||||
sendCall: '/uCapPrompt/api/call/clicktocall'
|
||||
};
|
||||
export const piUrls: PiUrls = {
|
||||
login2: '/uCapPi/login2',
|
||||
userTermsAction: '/uCapPi/user/terms.action',
|
||||
|
|
|
@ -293,6 +293,7 @@
|
|||
*ngIf="!isMe"
|
||||
matTooltip="전화"
|
||||
matTooltipPosition="above"
|
||||
[disabled]="getDisabledBtn('LINE')"
|
||||
(click)="onClickCall('LINE')"
|
||||
>
|
||||
<svg
|
||||
|
@ -318,6 +319,7 @@
|
|||
*ngIf="!isMe"
|
||||
matTooltip="모바일"
|
||||
matTooltipPosition="above"
|
||||
[disabled]="getDisabledBtn('MOBILE')"
|
||||
(click)="onClickCall('MOBILE')"
|
||||
>
|
||||
<span class="mdi mdi-cellphone-android mdi-24px"></span>
|
||||
|
@ -329,6 +331,7 @@
|
|||
*ngIf="!isMe"
|
||||
matTooltip="SMS"
|
||||
matTooltipPosition="above"
|
||||
[disabled]="getDisabledBtn('SMS')"
|
||||
(click)="onClickSMS()"
|
||||
>
|
||||
<span class="mdi mdi-email-outline mdi-24px"></span>
|
||||
|
|
|
@ -29,12 +29,16 @@ export class ProfileComponent implements OnInit {
|
|||
isFavorit: boolean;
|
||||
@Input()
|
||||
userInfo: UserInfoSS;
|
||||
@Input()
|
||||
myMadn?: string;
|
||||
|
||||
@Output()
|
||||
openChat = new EventEmitter<UserInfoSS>();
|
||||
@Output()
|
||||
sendMessage = new EventEmitter<UserInfoSS>();
|
||||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
@Output()
|
||||
toggleFavorit = new EventEmitter<{
|
||||
userInfo: UserInfoSS;
|
||||
isFavorit: boolean;
|
||||
|
@ -63,7 +67,16 @@ export class ProfileComponent implements OnInit {
|
|||
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() {}
|
||||
|
||||
|
@ -127,4 +140,46 @@ export class ProfileComponent implements OnInit {
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
"@ucap-webmessenger/api-message": [
|
||||
"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/ui": ["projects/ucap-webmessenger-ui/src/public-api"],
|
||||
"@ucap-webmessenger/ui-account": [
|
||||
|
|
Loading…
Reference in New Issue
Block a user