From 389db64acc8b0507bcfdba878d66093c5b46f7bf Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 24 Feb 2020 12:35:56 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=94=EC=83=81=ED=9A=8C=EC=9D=98=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/apis/conference-create.ts | 42 +++++++++++++++++++ .../src/lib/services/conference.service.ts | 11 +++++ .../src/public-api.ts | 1 + .../components/left-side.component.html | 1 + .../components/left-side.component.ts | 7 ++++ .../left-sidenav/organization.component.ts | 10 ++--- .../components/messages.component.ts | 32 -------------- .../profile/profile.dialog.component.html | 1 + .../profile/profile.dialog.component.ts | 16 ++++++- .../components/main.page.component.html | 1 + .../components/main.page.component.ts | 15 ++++++- .../src/lib/components/profile.component.ts | 6 ++- 12 files changed, 100 insertions(+), 43 deletions(-) create mode 100644 projects/ucap-webmessenger-api-prompt/src/lib/apis/conference-create.ts diff --git a/projects/ucap-webmessenger-api-prompt/src/lib/apis/conference-create.ts b/projects/ucap-webmessenger-api-prompt/src/lib/apis/conference-create.ts new file mode 100644 index 00000000..9697cf09 --- /dev/null +++ b/projects/ucap-webmessenger-api-prompt/src/lib/apis/conference-create.ts @@ -0,0 +1,42 @@ +import { + APIRequest, + APIDecoder, + APIEncoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { PromptAPIResponse } from './api-prompt'; + +export interface ConferenceCreateRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + targetUserSeqs: number[]; +} + +export interface ConferenceCreateResponse extends PromptAPIResponse {} + +const conferenceCreateEncodeMap = { + userSeq: 'userSeq', + deviceType: 'deviceType', + tokenKey: 'tokenKey', + targetUserSeqs: 'targetUserSeqs' +}; + +export const encodeConferenceCreate: APIEncoder = ( + req: ConferenceCreateRequest +) => { + const extraParams: any = {}; + extraParams.targetUserSeqs = req.targetUserSeqs.join(','); + + return ParameterUtil.encode(conferenceCreateEncodeMap, req, extraParams); +}; + +export const decodeConferenceCreate: APIDecoder = ( + res: any +) => { + return { + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as ConferenceCreateResponse; +}; diff --git a/projects/ucap-webmessenger-api-prompt/src/lib/services/conference.service.ts b/projects/ucap-webmessenger-api-prompt/src/lib/services/conference.service.ts index 453889bd..30d7cc04 100644 --- a/projects/ucap-webmessenger-api-prompt/src/lib/services/conference.service.ts +++ b/projects/ucap-webmessenger-api-prompt/src/lib/services/conference.service.ts @@ -11,6 +11,10 @@ import { encodeConferenceJoin } from '../apis/conference-join'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; +import { + encodeConferenceCreate, + ConferenceCreateRequest +} from '../apis/conference-create'; @Injectable({ providedIn: 'root' @@ -30,6 +34,13 @@ export class ConferenceService { ); } + public conferenceCreate(req: ConferenceCreateRequest): void { + let url = this.urls.conferenceCreate; + url = url + `?${encodeConferenceCreate(req).toString()}`; + // WindowUtil.popupOpen(url, 'DaesangConfJoin', 685, 640); + this.nativeService.openDefaultBrowser(url); + } + public conferencejoin(req: ConferenceJoinRequest): void { let url = this.urls.conferenceJoin; url = url + `?${encodeConferenceJoin(req).toString()}`; diff --git a/projects/ucap-webmessenger-api-prompt/src/public-api.ts b/projects/ucap-webmessenger-api-prompt/src/public-api.ts index b1f273bc..7c0ee27e 100644 --- a/projects/ucap-webmessenger-api-prompt/src/public-api.ts +++ b/projects/ucap-webmessenger-api-prompt/src/public-api.ts @@ -4,6 +4,7 @@ export * from './lib/apis/api-prompt'; export * from './lib/apis/call'; +export * from './lib/apis/conference-create'; export * from './lib/apis/conference-join'; export * from './lib/services/call.service'; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index 291f6aa0..8b6f3d27 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -35,6 +35,7 @@ (openProfile)="onClickOpenProfile($event)" (sendCall)="onClickSendClickToCall($event)" (sendSms)="onClickSendSms($event)" + (createConference)="onClickConferenceCreate()" (toggleUser)="onToggleUser($event)" (resetSelectedUserList)="onResetSelectedUserList($event)" class="organization-side" diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts index ccf313be..296d0525 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts @@ -67,6 +67,8 @@ export class LeftSideComponent implements OnInit, OnDestroy { sendCall = new EventEmitter(); @Output() sendSms = new EventEmitter(); + @Output() + createConference = new EventEmitter(); @ViewChildren('tabs') tabs: QueryList>; currentTabLable: string; @@ -263,6 +265,11 @@ export class LeftSideComponent implements OnInit, OnDestroy { onClickSendSms(employeeNum: string) { this.sendSms.emit(employeeNum); } + /** [Event] Conference Create */ + onClickConferenceCreate() { + const targetUserSeqs = this.selectedUserList.map(userInfo => userInfo.seq); + this.createConference.emit(targetUserSeqs); + } setFabInitial(type: string) { switch (type) { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index 61c59073..9f1f870e 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -125,6 +125,8 @@ export class OrganizationComponent sendCall = new EventEmitter(); @Output() sendSms = new EventEmitter(); + @Output() + createConference = new EventEmitter(); @ViewChild('vsDeptUser', { static: false }) private vsDeptUser: VirtualScrollerComponent; @@ -633,13 +635,7 @@ export class OrganizationComponent } } onClickConference() { - this.logger.debug('onClickConference', this.selectedUserList); - - // 상위 컴포넌트의 selectedUserList clear. - this.checkAllUser.emit({ - isChecked: false, - userInfos: this.selectedUserList - }); + this.createConference.emit(); } onContextMenuOrgUser( diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index 34f89ab2..e040acc7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -1228,38 +1228,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { tokenKey: this.loginResSubject.value.tokenString, conferenceSeq: param.conferenceSeq }); - // this.conferenceJoin.emit(param); - // console.log('aaa', param); - // const mapForm = document.createElement('form'); - // const milliseconds = new Date().getTime(); - // const windowName = 'Conference_' + milliseconds; - // mapForm.target = windowName; - // mapForm.method = 'POST'; - // mapForm.action = - // 'https://dstalk.daesang.com:9097/uCapPrompt/conference/join'; - // const keyParams = ['userSeq', 'deviceType', 'tokenKey', 'roomSeq']; - // const valueParams = [ - // this.loginResSubject.value.userSeq.toString(), - // this.environmentsInfo.deviceType, - // this.loginResSubject.value.tokenString, - // param.conferenceSeq.toString() - // ]; - // if (keyParams && valueParams && keyParams.length === valueParams.length) { - // for (let i = 0; i < keyParams.length; i++) { - // const mapInput = document.createElement('input'); - // mapInput.type = 'hidden'; - // mapInput.name = keyParams[i]; - // mapInput.value = valueParams[i]; - // mapForm.appendChild(mapInput); - // } - // document.body.appendChild(mapForm); - // } - // const winpop = window.open('', windowName, ''); - // if (winpop) { - // mapForm.submit(); - // } else { - // this.logger.error('Error Open Popup'); - // } } onContextMenuMessage(params: { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html index 8ed336db..0f1299ff 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html @@ -13,6 +13,7 @@ (sendMessage)="onClickSendMessage($event)" (sendCall)="onClickSendClickToCall($event)" (sendSms)="onClickSendSms($event)" + (createConference)="onClickConferenceCreate($event)" (toggleFavorit)="onClickToggleFavorit($event)" (toggleBuddy)="onClickToggleBuddy($event)" (uploadProfileImage)="onUploadProfileImage($event)" diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts index 0c41f50a..5807d352 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Inject, ViewChild, OnDestroy } from '@angular/core'; +import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { KEY_LOGIN_RES_INFO, KEY_VER_INFO, KEY_AUTH_INFO } from '@app/types'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; @@ -47,7 +47,8 @@ import { } from '../message/message-write.dialog.component'; import { CallService, - PromptMessageStatusCode + PromptMessageStatusCode, + ConferenceService } from '@ucap-webmessenger/api-prompt'; import { NGXLogger } from 'ngx-logger'; import { SmsUtils } from '@ucap-webmessenger/daesang'; @@ -94,6 +95,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { private dialogService: DialogService, private sessionStorageService: SessionStorageService, private commonApiService: CommonApiService, + private conferenceService: ConferenceService, private callService: CallService, private snackBarService: SnackBarService, private translateService: TranslateService, @@ -195,6 +197,16 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { this.dialogRef.close({ closeEvent: 'CHAT' }); } + /** [Event] Conference Create */ + onClickConferenceCreate(userSeq: number) { + this.conferenceService.conferenceCreate({ + userSeq: this.loginRes.userSeq, + deviceType: this.environmentsInfo.deviceType, + tokenKey: this.loginRes.tokenString, + targetUserSeqs: [userSeq] + }); + } + onClickSendMessage(userInfo: UserInfoSS) { if (userInfo.seq !== this.loginRes.userSeq) { this.dialogRef.close(); diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html index 4c104dae..7a85bfed 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html @@ -10,6 +10,7 @@ (openProfile)="onClickOpenProfile($event)" (sendCall)="sendClickToCall($event)" (sendSms)="openSms($event)" + (createConference)="conferenceCreate($event)" (mouseenter)="onMouseEnterLeftSideContainer($event)" (mouseleave)="onMouseLeaveLeftSideContainer($event)" > diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts index 4f332b04..15a69485 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts @@ -39,7 +39,7 @@ import { NGXLogger } from 'ngx-logger'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { OpenProfileOptions } from '@ucap-webmessenger/protocol-buddy'; import { DaesangProtocolService, SmsUtils } from '@ucap-webmessenger/daesang'; -import { CallService } from '@ucap-webmessenger/api-prompt'; +import { CallService, ConferenceService } from '@ucap-webmessenger/api-prompt'; import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; import { SessionStorageService, @@ -94,6 +94,7 @@ export class MainPageComponent implements OnInit, OnDestroy { private ngZone: NgZone, private statusProtocolService: StatusProtocolService, private daesangProtocolService: DaesangProtocolService, + private conferenceService: ConferenceService, private callService: CallService, private localStorageService: LocalStorageService, private sessionStorageService: SessionStorageService, @@ -445,6 +446,18 @@ export class MainPageComponent implements OnInit, OnDestroy { smsUtil.openSendSms(this.loginRes.tokenString, employeeNum); } + /** [Event] Conference Create */ + conferenceCreate(targetUserSeqs: number[]) { + if (!!targetUserSeqs && targetUserSeqs.length > 0) { + this.conferenceService.conferenceCreate({ + userSeq: this.loginRes.userSeq, + deviceType: this.environmentsInfo.deviceType, + tokenKey: this.loginRes.tokenString, + targetUserSeqs + }); + } + } + onCloseRightDrawer() { this.rightDrawer.close(); } diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts index 603a8e05..b19ee8a5 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts @@ -54,6 +54,8 @@ export class ProfileComponent implements OnInit { @Output() sendSms = new EventEmitter(); @Output() + createConference = new EventEmitter(); + @Output() toggleFavorit = new EventEmitter<{ userInfo: UserInfoSS; isFavorit: boolean; @@ -103,7 +105,9 @@ export class ProfileComponent implements OnInit { this.sendSms.emit(this.userInfo.employeeNum); } - onClickVideoConference() {} + onClickVideoConference() { + this.createConference.emit(this.userInfo.seq); + } onClickMessage() { this.sendMessage.emit(this.userInfo);