2020-02-24 12:35:56 +09:00
|
|
|
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
|
2020-02-18 10:54:35 +09:00
|
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
2020-01-09 14:24:09 +09:00
|
|
|
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO, KEY_AUTH_INFO } from '@app/types';
|
2019-11-08 13:35:39 +09:00
|
|
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
|
|
|
|
|
|
|
import { Store, select } from '@ngrx/store';
|
|
|
|
import * as AppStore from '@app/store';
|
|
|
|
import * as ChatStore from '@app/store/messenger/chat';
|
2019-11-20 14:57:54 +09:00
|
|
|
import * as SyncStore from '@app/store/messenger/sync';
|
2019-11-29 18:24:51 +09:00
|
|
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
2019-11-08 13:35:39 +09:00
|
|
|
|
2019-11-20 14:57:54 +09:00
|
|
|
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
|
2019-11-08 13:35:39 +09:00
|
|
|
import {
|
|
|
|
UserInfoSS,
|
|
|
|
UserInfoF,
|
2020-01-09 14:24:09 +09:00
|
|
|
UserInfoDN,
|
|
|
|
AuthResponse
|
2019-11-08 13:35:39 +09:00
|
|
|
} from '@ucap-webmessenger/protocol-query';
|
2019-11-29 18:24:51 +09:00
|
|
|
import {
|
|
|
|
DialogService,
|
|
|
|
ConfirmDialogComponent,
|
|
|
|
ConfirmDialogData,
|
|
|
|
ConfirmDialogResult,
|
2019-12-16 17:42:49 +09:00
|
|
|
SnackBarService,
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogResult,
|
2020-03-17 15:19:43 +09:00
|
|
|
AlertDialogData,
|
|
|
|
ImageOnlyDataInfo
|
2019-11-29 18:24:51 +09:00
|
|
|
} from '@ucap-webmessenger/ui';
|
2019-11-08 13:35:39 +09:00
|
|
|
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
|
|
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
2020-01-20 13:25:59 +09:00
|
|
|
import { map, take, finalize, catchError, tap } from 'rxjs/operators';
|
2019-12-17 11:44:59 +09:00
|
|
|
import { Subscription, of } from 'rxjs';
|
2019-11-29 18:24:51 +09:00
|
|
|
import {
|
|
|
|
SelectGroupDialogComponent,
|
|
|
|
SelectGroupDialogData,
|
|
|
|
SelectGroupDialogResult
|
|
|
|
} from '../group/select-group.dialog.component';
|
2019-12-03 18:59:11 +09:00
|
|
|
import { FileUploadItem } from '@ucap-webmessenger/api';
|
|
|
|
import { CommonApiService } from '@ucap-webmessenger/api-common';
|
2019-12-26 17:34:52 +09:00
|
|
|
import { OpenProfileOptions } from '@ucap-webmessenger/protocol-buddy';
|
2019-11-29 18:24:51 +09:00
|
|
|
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
|
|
|
|
import { StatusCode } from '@ucap-webmessenger/api';
|
2019-12-11 08:18:32 +09:00
|
|
|
import {
|
|
|
|
MessageWriteDialogComponent,
|
|
|
|
MessageWriteDialogResult,
|
|
|
|
MessageWriteDialogData
|
|
|
|
} from '../message/message-write.dialog.component';
|
2019-12-16 17:42:49 +09:00
|
|
|
import {
|
|
|
|
CallService,
|
2020-02-24 12:35:56 +09:00
|
|
|
PromptMessageStatusCode,
|
|
|
|
ConferenceService
|
2019-12-16 17:42:49 +09:00
|
|
|
} from '@ucap-webmessenger/api-prompt';
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
2019-12-18 09:56:00 +09:00
|
|
|
import { SmsUtils } from '@ucap-webmessenger/daesang';
|
|
|
|
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
2019-12-18 10:46:42 +09:00
|
|
|
import { environment } from '../../../../../environments/environment';
|
2020-01-08 12:30:39 +09:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2020-01-20 13:25:59 +09:00
|
|
|
import { UserInfoUpdateType } from '@ucap-webmessenger/protocol-info';
|
2020-03-17 15:19:43 +09:00
|
|
|
import {
|
|
|
|
FileViewerDialogComponent,
|
|
|
|
FileViewerDialogData,
|
|
|
|
FileViewerDialogResult
|
|
|
|
} from '@app/layouts/common/dialogs/file-viewer.dialog.component';
|
|
|
|
import { FileEventJson } from '@ucap-webmessenger/protocol-event';
|
|
|
|
import { FileType } from '@ucap-webmessenger/protocol-file';
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
export interface ProfileDialogData {
|
|
|
|
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
|
2019-12-26 17:34:52 +09:00
|
|
|
openProfileOptions?: OpenProfileOptions;
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|
|
|
|
|
2020-01-31 09:08:39 +09:00
|
|
|
export interface ProfileDialogResult {
|
|
|
|
closeEvent?: string;
|
|
|
|
}
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-profile.dialog',
|
|
|
|
templateUrl: './profile.dialog.component.html',
|
|
|
|
styleUrls: ['./profile.dialog.component.scss']
|
|
|
|
})
|
2019-11-20 14:57:54 +09:00
|
|
|
export class ProfileDialogComponent implements OnInit, OnDestroy {
|
2019-11-29 18:24:51 +09:00
|
|
|
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
|
2019-11-08 13:35:39 +09:00
|
|
|
loginRes: LoginResponse;
|
2020-01-20 13:25:59 +09:00
|
|
|
loginResSubscription: Subscription;
|
2019-11-08 13:35:39 +09:00
|
|
|
sessionVerinfo: VersionInfo2Response;
|
2019-11-29 18:24:51 +09:00
|
|
|
environmentsInfo: EnvironmentsInfo;
|
2020-01-09 14:24:09 +09:00
|
|
|
authInfo: AuthResponse;
|
2019-11-29 18:24:51 +09:00
|
|
|
|
2019-11-08 13:35:39 +09:00
|
|
|
isMe: boolean;
|
|
|
|
isBuddy: boolean;
|
|
|
|
isFavorit: boolean;
|
2019-12-18 10:46:42 +09:00
|
|
|
editableProfileImage: boolean;
|
2020-01-15 14:05:36 +09:00
|
|
|
useBuddyToggleButton: boolean;
|
2019-11-08 13:35:39 +09:00
|
|
|
|
2019-11-20 14:57:54 +09:00
|
|
|
selectAllBuddy2Subscription: Subscription;
|
2020-01-15 14:05:36 +09:00
|
|
|
myDeptUserListSubscription: Subscription;
|
2019-11-20 14:57:54 +09:00
|
|
|
|
2019-11-08 13:35:39 +09:00
|
|
|
constructor(
|
|
|
|
public dialogRef: MatDialogRef<ProfileDialogData, ProfileDialogResult>,
|
2019-12-18 09:56:00 +09:00
|
|
|
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
2019-11-08 13:35:39 +09:00
|
|
|
@Inject(MAT_DIALOG_DATA) public data: ProfileDialogData,
|
|
|
|
private dialogService: DialogService,
|
|
|
|
private sessionStorageService: SessionStorageService,
|
2019-11-29 18:24:51 +09:00
|
|
|
private commonApiService: CommonApiService,
|
2020-02-24 12:35:56 +09:00
|
|
|
private conferenceService: ConferenceService,
|
2019-12-16 17:42:49 +09:00
|
|
|
private callService: CallService,
|
2019-11-29 18:24:51 +09:00
|
|
|
private snackBarService: SnackBarService,
|
2020-01-08 12:30:39 +09:00
|
|
|
private translateService: TranslateService,
|
2019-12-16 17:42:49 +09:00
|
|
|
private store: Store<any>,
|
|
|
|
private logger: NGXLogger
|
2019-11-08 13:35:39 +09:00
|
|
|
) {
|
|
|
|
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
|
|
|
|
KEY_VER_INFO
|
|
|
|
);
|
2019-11-29 18:24:51 +09:00
|
|
|
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
|
|
|
|
KEY_ENVIRONMENTS_INFO
|
|
|
|
);
|
2020-01-09 14:24:09 +09:00
|
|
|
this.authInfo = this.sessionStorageService.get<AuthResponse>(KEY_AUTH_INFO);
|
2019-11-29 18:24:51 +09:00
|
|
|
|
|
|
|
this.userInfo = data.userInfo;
|
2019-12-18 10:46:42 +09:00
|
|
|
|
|
|
|
this.editableProfileImage =
|
|
|
|
environment.productConfig.CommonSetting.editableProfileImage;
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-01-20 13:25:59 +09:00
|
|
|
this.loginResSubscription = this.store
|
|
|
|
.pipe(
|
|
|
|
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
|
|
|
|
tap(loginRes => {
|
|
|
|
this.loginRes = loginRes;
|
2020-02-04 11:29:55 +09:00
|
|
|
if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) {
|
2020-01-20 13:25:59 +09:00
|
|
|
this.isMe = true;
|
|
|
|
this.userInfo = {
|
|
|
|
...this.userInfo,
|
|
|
|
intro: loginRes.userInfo.intro
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
this.isMe = false;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
2019-11-08 13:35:39 +09:00
|
|
|
|
2019-11-20 14:57:54 +09:00
|
|
|
this.selectAllBuddy2Subscription = this.store
|
|
|
|
.pipe(
|
|
|
|
select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2),
|
|
|
|
map(buddyList => {
|
|
|
|
const users = buddyList.filter(
|
|
|
|
buddy => buddy.seq === this.data.userInfo.seq
|
|
|
|
);
|
|
|
|
this.isBuddy = users.length > 0;
|
|
|
|
if (this.isBuddy) {
|
|
|
|
this.isFavorit = users[0].isFavorit;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
2020-01-15 14:05:36 +09:00
|
|
|
|
|
|
|
if (!!this.data.openProfileOptions) {
|
|
|
|
this.useBuddyToggleButton = !!this.data.openProfileOptions.useBuddyButton;
|
|
|
|
} else {
|
|
|
|
this.getCheckMyDeptUser();
|
|
|
|
}
|
2019-11-20 14:57:54 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
if (!!this.selectAllBuddy2Subscription) {
|
|
|
|
this.selectAllBuddy2Subscription.unsubscribe();
|
|
|
|
}
|
2020-01-15 14:05:36 +09:00
|
|
|
if (!!this.myDeptUserListSubscription) {
|
|
|
|
this.myDeptUserListSubscription.unsubscribe();
|
|
|
|
}
|
2020-01-20 13:25:59 +09:00
|
|
|
if (!!this.loginResSubscription) {
|
|
|
|
this.loginResSubscription.unsubscribe();
|
|
|
|
}
|
2020-01-15 14:05:36 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
getCheckMyDeptUser() {
|
|
|
|
this.myDeptUserListSubscription = this.store
|
|
|
|
.pipe(
|
|
|
|
select(
|
|
|
|
AppStore.MessengerSelector.QuerySelector.myDepartmentUserInfoList
|
|
|
|
),
|
|
|
|
map(myDeptUserList => {
|
|
|
|
const users = myDeptUserList.filter(
|
|
|
|
buddy => buddy.seq === this.data.userInfo.seq
|
|
|
|
);
|
|
|
|
this.useBuddyToggleButton = users.length === 0;
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|
|
|
|
|
2019-12-15 21:36:12 +09:00
|
|
|
onClickChat(userInfo: UserInfoSS) {
|
2019-11-08 13:35:39 +09:00
|
|
|
if (userInfo.seq === this.loginRes.userSeq) {
|
|
|
|
this.store.dispatch(
|
|
|
|
ChatStore.openRoom({ userSeqList: [this.loginRes.talkWithMeBotSeq] })
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
this.store.dispatch(ChatStore.openRoom({ userSeqList: [userInfo.seq] }));
|
|
|
|
}
|
|
|
|
|
2020-01-31 09:08:39 +09:00
|
|
|
this.dialogRef.close({ closeEvent: 'CHAT' });
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|
2019-11-20 14:57:54 +09:00
|
|
|
|
2020-02-24 12:35:56 +09:00
|
|
|
/** [Event] Conference Create */
|
|
|
|
onClickConferenceCreate(userSeq: number) {
|
|
|
|
this.conferenceService.conferenceCreate({
|
|
|
|
userSeq: this.loginRes.userSeq,
|
|
|
|
deviceType: this.environmentsInfo.deviceType,
|
|
|
|
tokenKey: this.loginRes.tokenString,
|
|
|
|
targetUserSeqs: [userSeq]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-12-15 21:36:12 +09:00
|
|
|
onClickSendMessage(userInfo: UserInfoSS) {
|
2019-12-11 08:18:32 +09:00
|
|
|
if (userInfo.seq !== this.loginRes.userSeq) {
|
|
|
|
this.dialogRef.close();
|
|
|
|
|
|
|
|
this.dialogService.open<
|
|
|
|
MessageWriteDialogComponent,
|
|
|
|
MessageWriteDialogData,
|
|
|
|
MessageWriteDialogResult
|
|
|
|
>(MessageWriteDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
height: '600px',
|
|
|
|
disableClose: true,
|
|
|
|
hasBackdrop: false,
|
|
|
|
data: {
|
|
|
|
loginRes: this.loginRes,
|
|
|
|
environmentsInfo: this.environmentsInfo,
|
|
|
|
receiverList: [userInfo]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-16 17:42:49 +09:00
|
|
|
async onClickSendClickToCall(calleeNumber: string) {
|
|
|
|
const madn = this.loginRes.madn;
|
|
|
|
if (!madn || madn.trim().length === 0) {
|
|
|
|
this.dialogService.open<
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
data: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('call.errors.label'),
|
|
|
|
html: this.translateService.instant('call.errors.cannotCallToUser')
|
2019-12-16 17:42:49 +09:00
|
|
|
}
|
|
|
|
});
|
2020-01-08 12:30:39 +09:00
|
|
|
|
2019-12-16 17:42:49 +09:00
|
|
|
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: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('call.callTo'),
|
|
|
|
html: this.translateService.instant('call.callWithNumber', {
|
|
|
|
phoneNumber: calleeNumber
|
|
|
|
})
|
2019-12-16 17:42:49 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2019-12-17 11:44:59 +09:00
|
|
|
}),
|
|
|
|
catchError(error => of(this.logger.debug(error)))
|
2019-12-16 17:42:49 +09:00
|
|
|
)
|
|
|
|
.subscribe();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.dialogService.open<
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
data: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('call.errors.label'),
|
|
|
|
html: this.translateService.instant(
|
|
|
|
'call.errors.cannotCallToUserWithoutPhomeNumber'
|
|
|
|
)
|
2019-12-16 17:42:49 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-13 13:58:27 +09:00
|
|
|
onClickSendSms(employeeNum: string) {
|
2019-12-18 09:56:00 +09:00
|
|
|
const smsUtil = new SmsUtils(
|
|
|
|
this.sessionStorageService,
|
|
|
|
this.nativeService
|
|
|
|
);
|
|
|
|
if (!smsUtil.getAuthSms()) {
|
|
|
|
this.dialogService.open<
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
data: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('sms.errors.label'),
|
|
|
|
html: this.translateService.instant('sms.errors.haveNoPermission')
|
2019-12-18 09:56:00 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-02-13 13:58:27 +09:00
|
|
|
smsUtil.openSendSms(this.loginRes.tokenString, employeeNum);
|
2019-12-18 09:56:00 +09:00
|
|
|
}
|
|
|
|
|
2019-12-15 21:36:12 +09:00
|
|
|
onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) {
|
2019-11-20 14:57:54 +09:00
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateBuddy({
|
|
|
|
seq: param.userInfo.seq,
|
|
|
|
isFavorit: param.isFavorit
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-12-15 21:36:12 +09:00
|
|
|
async onClickToggleBuddy(param: { userInfo: UserInfoSS; isBuddy: boolean }) {
|
2019-11-20 14:57:54 +09:00
|
|
|
if (param.isBuddy) {
|
|
|
|
// 동료추가.
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
SelectGroupDialogComponent,
|
|
|
|
SelectGroupDialogData,
|
|
|
|
SelectGroupDialogResult
|
|
|
|
>(SelectGroupDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
data: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('group.selectTargetGroup')
|
2019-11-20 14:57:54 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
if (!!result.group) {
|
|
|
|
const oldGroup: GroupDetailData = result.group;
|
|
|
|
const trgtUserSeq: number[] = [];
|
|
|
|
result.group.userSeqs.map(seq => trgtUserSeq.push(seq));
|
|
|
|
trgtUserSeq.push(param.userInfo.seq);
|
|
|
|
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateGroupMember({
|
|
|
|
oldGroup,
|
|
|
|
trgtUserSeq
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 동료삭제.
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
ConfirmDialogComponent,
|
|
|
|
ConfirmDialogData,
|
|
|
|
ConfirmDialogResult
|
|
|
|
>(ConfirmDialogComponent, {
|
|
|
|
width: '360px',
|
|
|
|
data: {
|
2020-01-08 12:30:39 +09:00
|
|
|
title: this.translateService.instant('group.removeBuddyFromGroup'),
|
|
|
|
html: this.translateService.instant(
|
|
|
|
'group.confirmRemoveBuddyFromGroup',
|
|
|
|
{ target: `${param.userInfo.name} ${param.userInfo.grade}` }
|
|
|
|
)
|
2019-11-20 14:57:54 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.delBuddyAndClear({ seq: param.userInfo.seq })
|
|
|
|
);
|
2019-11-29 18:24:51 +09:00
|
|
|
this.isBuddy = false;
|
2020-01-15 14:05:36 +09:00
|
|
|
|
|
|
|
this.getCheckMyDeptUser();
|
2019-11-20 14:57:54 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 18:24:51 +09:00
|
|
|
|
|
|
|
onUploadProfileImage(profileImageFileUploadItem: FileUploadItem) {
|
|
|
|
this.commonApiService
|
|
|
|
.fileProfileSave(
|
|
|
|
{
|
|
|
|
userSeq: this.loginRes.userSeq,
|
|
|
|
deviceType: this.environmentsInfo.deviceType,
|
|
|
|
token: this.loginRes.tokenString,
|
|
|
|
file: profileImageFileUploadItem.file,
|
|
|
|
fileUploadItem: profileImageFileUploadItem
|
|
|
|
},
|
|
|
|
this.sessionVerinfo.profileUploadUrl
|
|
|
|
)
|
|
|
|
.pipe(
|
|
|
|
take(1),
|
|
|
|
map(res => {
|
|
|
|
if (!res) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (StatusCode.Success === res.statusCode) {
|
|
|
|
return res;
|
|
|
|
} else {
|
|
|
|
throw res;
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
finalize(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
profileImageFileUploadItem.uploadingProgress$ = undefined;
|
|
|
|
}, 1000);
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe(
|
|
|
|
res => {
|
|
|
|
const userInfo = {
|
|
|
|
...this.loginRes.userInfo,
|
|
|
|
profileImageFile: res.profileSubDir
|
|
|
|
};
|
|
|
|
|
|
|
|
this.store.dispatch(
|
|
|
|
AuthenticationStore.updateLoginRes({
|
|
|
|
loginRes: {
|
|
|
|
...this.loginRes,
|
|
|
|
userInfo
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
this.userInfo = userInfo as any;
|
|
|
|
},
|
|
|
|
error => {
|
|
|
|
this.snackBarService.open(
|
2020-01-08 12:30:39 +09:00
|
|
|
this.translateService.instant(
|
|
|
|
'profile.errors.failToChangeProfileImage'
|
|
|
|
),
|
2019-11-29 18:24:51 +09:00
|
|
|
'',
|
|
|
|
{
|
|
|
|
duration: 3000,
|
|
|
|
verticalPosition: 'bottom'
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2020-01-20 13:25:59 +09:00
|
|
|
|
2020-03-17 15:19:43 +09:00
|
|
|
onClickProfileImageView() {
|
|
|
|
if (!this.loginRes || !this.loginRes.userInfo.profileImageFile) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const imageOnlyData: ImageOnlyDataInfo = {
|
|
|
|
imageUrl: this.userInfo.profileImageFile,
|
|
|
|
imageRootUrl: this.sessionVerinfo.profileRoot,
|
|
|
|
defaultImage: 'assets/images/img_nophoto_50.png',
|
|
|
|
fileName: this.userInfo.name
|
|
|
|
};
|
|
|
|
|
|
|
|
this.dialogService.open<
|
|
|
|
FileViewerDialogComponent,
|
|
|
|
FileViewerDialogData,
|
|
|
|
FileViewerDialogResult
|
|
|
|
>(FileViewerDialogComponent, {
|
|
|
|
position: {
|
|
|
|
top: '50px'
|
|
|
|
},
|
|
|
|
maxWidth: '100vw',
|
|
|
|
maxHeight: '100vh',
|
|
|
|
height: 'calc(100% - 50px)',
|
|
|
|
width: '100%',
|
|
|
|
panelClass: 'app-dialog-full',
|
|
|
|
data: {
|
|
|
|
imageOnly: true,
|
|
|
|
imageOnlyData,
|
|
|
|
fileInfo: {},
|
|
|
|
downloadUrl: this.sessionVerinfo.downloadUrl,
|
|
|
|
deviceType: this.environmentsInfo.deviceType,
|
|
|
|
token: this.loginRes.tokenString,
|
|
|
|
userSeq: this.loginRes.userSeq
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-01-20 13:25:59 +09:00
|
|
|
onUpdateIntro(intro: string) {
|
|
|
|
this.store.dispatch(
|
|
|
|
AuthenticationStore.infoUser({
|
|
|
|
req: {
|
|
|
|
type: UserInfoUpdateType.Intro,
|
|
|
|
info: intro
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2020-01-29 14:59:56 +09:00
|
|
|
|
|
|
|
onClose() {
|
|
|
|
this.dialogRef.close();
|
|
|
|
}
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|