SMS 연동
This commit is contained in:
parent
8e40d81f92
commit
0233ef4117
|
@ -189,6 +189,7 @@
|
|||
(checkUser)="onCheckUser($event)"
|
||||
(openProfile)="onClickOpenProfile($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
(sendSms)="onClickSendSms($event)"
|
||||
(toggleUser)="onToggleUser($event)"
|
||||
class="organization-side"
|
||||
></app-layout-chat-left-sidenav-organization>
|
||||
|
|
|
@ -73,6 +73,8 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||
>();
|
||||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
@Output()
|
||||
sendSms = new EventEmitter<string>();
|
||||
|
||||
@ViewChildren('tabs') tabs: QueryList<ElementRef<HTMLDivElement>>;
|
||||
currentTabLable: string;
|
||||
|
@ -265,6 +267,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||
onClickSendClickToCall(calleeNumber: string) {
|
||||
this.sendCall.emit(calleeNumber);
|
||||
}
|
||||
onClickSendSms(calleeNumber: string) {
|
||||
this.sendSms.emit(calleeNumber);
|
||||
}
|
||||
|
||||
onSelectedTabChange(event: MatTabChangeEvent) {
|
||||
this.setFabInitial(event.tab.ariaLabel);
|
||||
|
|
|
@ -103,6 +103,8 @@ export class OrganizationComponent
|
|||
>();
|
||||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
@Output()
|
||||
sendSms = new EventEmitter<string>();
|
||||
|
||||
@ViewChild('cvsvDeptUser', { static: false })
|
||||
cvsvDeptUser: CdkVirtualScrollViewport;
|
||||
|
@ -553,6 +555,7 @@ export class OrganizationComponent
|
|||
break;
|
||||
case 'SEND_SMS':
|
||||
{
|
||||
this.sendSms.emit(userInfo.hpNumber);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(openChat)="onClickChat($event)"
|
||||
(sendMessage)="onClickSendMessage($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
(sendSms)="onClickSendSms($event)"
|
||||
(toggleFavorit)="onClickToggleFavorit($event)"
|
||||
(toggleBuddy)="onClickToggleBuddy($event)"
|
||||
(uploadProfileImage)="onUploadProfileImage($event)"
|
||||
|
|
|
@ -48,6 +48,8 @@ import {
|
|||
PromptMessageStatusCode
|
||||
} from '@ucap-webmessenger/api-prompt';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
import { SmsUtils } from '@ucap-webmessenger/daesang';
|
||||
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||
|
||||
export interface ProfileDialogData {
|
||||
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
|
||||
|
@ -74,6 +76,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
|
|||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ProfileDialogData, ProfileDialogResult>,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: ProfileDialogData,
|
||||
private dialogService: DialogService,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
|
@ -222,6 +225,42 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
onClickSendSms(calleeNumber: string) {
|
||||
const smsUtil = new SmsUtils(
|
||||
this.sessionStorageService,
|
||||
this.nativeService
|
||||
);
|
||||
if (!smsUtil.getAuthSms()) {
|
||||
this.dialogService.open<
|
||||
AlertDialogComponent,
|
||||
AlertDialogData,
|
||||
AlertDialogResult
|
||||
>(AlertDialogComponent, {
|
||||
data: {
|
||||
title: '',
|
||||
html: `SMS 사용 권한이 없습니다.`
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
calleeNumber = calleeNumber.replace(/\D/g, '');
|
||||
if (!!calleeNumber && calleeNumber.length > 0) {
|
||||
smsUtil.openSendSms(this.loginRes.tokenString, [calleeNumber]);
|
||||
} else {
|
||||
// this.dialogService.open<
|
||||
// AlertDialogComponent,
|
||||
// AlertDialogData,
|
||||
// AlertDialogResult
|
||||
// >(AlertDialogComponent, {
|
||||
// data: {
|
||||
// title: '',
|
||||
// html: `상대방 번호가 없어 전화를 걸 수 없습니다.`
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) {
|
||||
this.store.dispatch(
|
||||
SyncStore.updateBuddy({
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<div class="left-side">
|
||||
<app-layout-messenger-left-side
|
||||
(openProfile)="onClickOpenProfile($event)"
|
||||
(sendCall)="onClickSendClickToCall($event)"
|
||||
(sendCall)="sendClickToCall($event)"
|
||||
(sendSms)="openSms($event)"
|
||||
></app-layout-messenger-left-side>
|
||||
</div>
|
||||
</as-split-area>
|
||||
|
|
|
@ -41,9 +41,13 @@ import {
|
|||
import { MatDrawer } from '@angular/material';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
|
||||
import { DaesangProtocolService, SmsUtils } from '@ucap-webmessenger/daesang';
|
||||
import { CallService } from '@ucap-webmessenger/api-prompt';
|
||||
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
|
||||
import {
|
||||
EnvironmentsInfo,
|
||||
KEY_ENVIRONMENTS_INFO,
|
||||
KEY_URL_INFO
|
||||
} from '@app/types';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import {
|
||||
MessageApiService,
|
||||
|
@ -56,6 +60,7 @@ import {
|
|||
MessageDetailDialogResult,
|
||||
MessageDetailDialogData
|
||||
} from '@app/layouts/messenger/dialogs/message/message-detail.dialog.component';
|
||||
import { DaesangUrlInfoResponse } from '@ucap-webmessenger/api-external';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-messenger-main',
|
||||
|
@ -280,7 +285,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
.subscribe();
|
||||
}
|
||||
|
||||
async onClickSendClickToCall(calleeNumber: string) {
|
||||
async sendClickToCall(calleeNumber: string) {
|
||||
const madn = this.loginRes.madn;
|
||||
if (!madn || madn.trim().length === 0) {
|
||||
this.dialogService.open<
|
||||
|
@ -342,6 +347,29 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
openSms(calleeNumber: string) {
|
||||
const smsUtil = new SmsUtils(
|
||||
this.sessionStorageService,
|
||||
this.nativeService
|
||||
);
|
||||
if (!smsUtil.getAuthSms()) {
|
||||
this.dialogService.open<
|
||||
AlertDialogComponent,
|
||||
AlertDialogData,
|
||||
AlertDialogResult
|
||||
>(AlertDialogComponent, {
|
||||
data: {
|
||||
title: '',
|
||||
html: `SMS 사용 권한이 없습니다.`
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
calleeNumber = calleeNumber.replace(/\D/g, '');
|
||||
smsUtil.openSendSms(this.loginRes.tokenString, [calleeNumber]);
|
||||
}
|
||||
|
||||
onCloseRightDrawer() {
|
||||
this.rightDrawer.close();
|
||||
}
|
||||
|
|
41
projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts
Normal file
41
projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { DaesangUrlInfoResponse } from '@ucap-webmessenger/api-external';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import { KEY_URL_INFO } from '@app/types';
|
||||
import { NativeService } from '@ucap-webmessenger/native';
|
||||
|
||||
export class SmsUtils {
|
||||
constructor(
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private nativeService: NativeService
|
||||
) {}
|
||||
|
||||
url: string;
|
||||
|
||||
getAuthSms(): boolean {
|
||||
const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get<
|
||||
DaesangUrlInfoResponse
|
||||
>(KEY_URL_INFO);
|
||||
|
||||
if (
|
||||
!!urlInfo &&
|
||||
!!urlInfo.webLinkAllowedList &&
|
||||
urlInfo.webLinkAllowedList.indexOf('WebLinkSms') > -1 &&
|
||||
!!urlInfo.webLink &&
|
||||
urlInfo.webLink.length > 0 &&
|
||||
urlInfo.webLink.filter(weblink => weblink.key === 'WebLinkSms').length > 0
|
||||
) {
|
||||
this.url = urlInfo.webLink.filter(
|
||||
weblink => weblink.key === 'WebLinkSms'
|
||||
)[0].url;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
openSendSms(token: string, calleeNumber?: string[]) {
|
||||
const url = this.url.replace(/(\(%USER_TOKEN%\))/g, token);
|
||||
|
||||
this.nativeService.openDefaultBrowser(url);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ export * from './lib/services/daesang-api.service';
|
|||
export * from './lib/services/daesang-cipher.service';
|
||||
export * from './lib/services/daesang-protocol.service';
|
||||
|
||||
export * from './lib/utils/SmsUtils';
|
||||
|
||||
export * from './lib/ucap-daesang.module';
|
||||
|
||||
export * from './lib/protocols/data-user';
|
||||
|
|
|
@ -5,13 +5,17 @@ import {
|
|||
EventEmitter,
|
||||
Output,
|
||||
ViewChild,
|
||||
ElementRef
|
||||
ElementRef,
|
||||
Inject
|
||||
} from '@angular/core';
|
||||
|
||||
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
|
||||
import { UserInfoF, UserInfoSS } from '@ucap-webmessenger/protocol-query';
|
||||
import { FileUploadItem } from '@ucap-webmessenger/api';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { SmsUtils } from '@ucap-webmessenger/daesang';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||
|
||||
@Component({
|
||||
selector: 'ucap-profile-profile',
|
||||
|
@ -39,6 +43,8 @@ export class ProfileComponent implements OnInit {
|
|||
@Output()
|
||||
sendCall = new EventEmitter<string>();
|
||||
@Output()
|
||||
sendSms = new EventEmitter<string>();
|
||||
@Output()
|
||||
toggleFavorit = new EventEmitter<{
|
||||
userInfo: UserInfoSS;
|
||||
isFavorit: boolean;
|
||||
|
@ -59,7 +65,10 @@ export class ProfileComponent implements OnInit {
|
|||
|
||||
profileImageFileUploadItem: FileUploadItem;
|
||||
|
||||
constructor() {}
|
||||
constructor(
|
||||
private sessionStorageService: SessionStorageService,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
|
||||
) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
|
@ -78,7 +87,9 @@ export class ProfileComponent implements OnInit {
|
|||
this.sendCall.emit(calleeNumber);
|
||||
}
|
||||
|
||||
onClickSMS() {}
|
||||
onClickSMS() {
|
||||
this.sendSms.emit(this.userInfo.hpNumber);
|
||||
}
|
||||
|
||||
onClickVideoConference() {}
|
||||
|
||||
|
@ -169,15 +180,11 @@ export class ProfileComponent implements OnInit {
|
|||
return true;
|
||||
}
|
||||
} else if (type === 'SMS') {
|
||||
if (
|
||||
!!this.userInfo &&
|
||||
!!this.userInfo.hpNumber &&
|
||||
this.userInfo.hpNumber.trim().length > 0
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
const smsUtils = new SmsUtils(
|
||||
this.sessionStorageService,
|
||||
this.nativeService
|
||||
);
|
||||
return !smsUtils.getAuthSms();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user