diff --git a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.html index 0092f806..c9536eb9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.html @@ -1,6 +1,8 @@ diff --git a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts index ae30e0b1..26666cbf 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts @@ -7,6 +7,7 @@ import { DeviceType } from '@ucap-webmessenger/core'; import { FileDownloadItem } from '@ucap-webmessenger/api'; import { CommonApiService } from '@ucap-webmessenger/api-common'; import { AppFileService } from '@app/services/file.service'; +import { ImageOnlyDataInfo } from '@ucap-webmessenger/ui'; export interface FileViewerDialogData { fileInfo: FileEventJson; @@ -14,6 +15,8 @@ export interface FileViewerDialogData { userSeq: number; deviceType: DeviceType; token: string; + imageOnly?: boolean; + imageOnlyData?: ImageOnlyDataInfo; } export interface FileViewerDialogResult {} @@ -32,6 +35,9 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy { fileDownloadUrl: string; + imageOnly = false; + imageOnlyData: ImageOnlyDataInfo; + constructor( public dialogRef: MatDialogRef< FileViewerDialogData, @@ -47,19 +53,28 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy { this.userSeq = data.userSeq; this.deviceType = data.deviceType; this.token = data.token; - - this.fileDownloadUrl = this.commonApiService.urlForFileTalkDownload( - { - userSeq: this.userSeq, - deviceType: this.deviceType, - token: this.token, - attachmentsSeq: this.fileInfo.attachmentSeq - }, - this.downloadUrl - ); } - ngOnInit() {} + ngOnInit() { + if (!!this.data.imageOnly) { + this.imageOnly = this.data.imageOnly; + this.imageOnlyData = this.data.imageOnlyData; + } + + if (!!this.imageOnly) { + this.fileDownloadUrl = this.imageOnlyData.imageUrl; + } else { + this.fileDownloadUrl = this.commonApiService.urlForFileTalkDownload( + { + userSeq: this.userSeq, + deviceType: this.deviceType, + token: this.token, + attachmentsSeq: this.fileInfo.attachmentSeq + }, + this.downloadUrl + ); + } + } ngOnDestroy(): void {} 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 0f1299ff..300913c0 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 @@ -9,6 +9,7 @@ [openProfileOptions]="data.openProfileOptions" [useBuddyToggleButton]="useBuddyToggleButton" [authInfo]="authInfo" + (profileImageView)="onClickProfileImageView()" (openChat)="onClickChat($event)" (sendMessage)="onClickSendMessage($event)" (sendCall)="onClickSendClickToCall($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 5807d352..de78661c 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 @@ -24,7 +24,8 @@ import { SnackBarService, AlertDialogComponent, AlertDialogResult, - AlertDialogData + AlertDialogData, + ImageOnlyDataInfo } from '@ucap-webmessenger/ui'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; @@ -56,6 +57,13 @@ import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { environment } from '../../../../../environments/environment'; import { TranslateService } from '@ngx-translate/core'; import { UserInfoUpdateType } from '@ucap-webmessenger/protocol-info'; +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'; export interface ProfileDialogData { userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; @@ -451,6 +459,43 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { ); } + 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 + } + }); + } + onUpdateIntro(intro: string) { this.store.dispatch( AuthenticationStore.infoUser({ diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html index 54adc88a..7561fbce 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html @@ -1,7 +1,11 @@
-
+
(); @Output() openChat = new EventEmitter(); @Output() @@ -86,6 +88,10 @@ export class ProfileComponent implements OnInit { ngOnInit() {} + onClickProfileImageView() { + this.profileImageView.emit(); + } + onClickOpenChat() { this.openChat.emit(this.userInfo); } diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.html b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.html index caced57b..48e45703 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.html @@ -13,6 +13,8 @@ *ngSwitchCase="FileViewerType.Image" [fileInfo]="fileInfo" [fileDownloadUrl]="fileDownloadUrl" + [imageOnly]="imageOnly" + [imageOnlyData]="imageOnlyData" (download)="onDownload($event)" (closed)="onClosedViewer()" > diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.ts b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.ts index adfc1065..2bcab9b6 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.ts +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer.component.ts @@ -4,6 +4,7 @@ import { FileEventJson } from '@ucap-webmessenger/protocol-event'; import { FileViewerType } from '../types/file-viewer.type'; import { FileType } from '@ucap-webmessenger/protocol-file'; import { FileDownloadItem } from '@ucap-webmessenger/api'; +import { ImageOnlyDataInfo } from '../models/image-only-data-info'; @Component({ selector: 'ucap-file-viewer', @@ -18,6 +19,11 @@ export class FileViewerComponent implements OnInit { @Input() fileDownloadUrl: string; + @Input() + imageOnly = false; + @Input() + imageOnlyData?: ImageOnlyDataInfo; + @Output() download = new EventEmitter(); @@ -31,6 +37,10 @@ export class FileViewerComponent implements OnInit { ngOnInit() {} detectFileViewerType(fileInfo: FileEventJson): FileViewerType { + if (!!this.imageOnly) { + return FileViewerType.Image; + } + switch (fileInfo.fileType) { case FileType.Image: return FileViewerType.Image; diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.html b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.html index 2bc39a23..e9124ace 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.html @@ -17,10 +17,21 @@ - {{ fileInfo.fileName }} + + + + {{ imageOnlyData.fileName }} + + + {{ fileInfo.fileName }} + +
diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.ts b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.ts index 4324e3ef..cec8ff40 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.ts +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/image-viewer.component.ts @@ -13,6 +13,7 @@ import { import { ucapAnimations } from '../../animations'; import { FileEventJson } from '@ucap-webmessenger/protocol-event'; import { FileDownloadItem } from '@ucap-webmessenger/api'; +import { ImageOnlyDataInfo } from '../../models/image-only-data-info'; @Component({ selector: 'ucap-image-viewer', @@ -28,6 +29,11 @@ export class ImageViewerComponent implements OnInit { @Input() fileDownloadUrl: string; + @Input() + imageOnly = false; + @Input() + imageOnlyData?: ImageOnlyDataInfo; + @Output() closed = new EventEmitter(); diff --git a/projects/ucap-webmessenger-ui/src/lib/models/image-only-data-info.ts b/projects/ucap-webmessenger-ui/src/lib/models/image-only-data-info.ts new file mode 100644 index 00000000..58e405fa --- /dev/null +++ b/projects/ucap-webmessenger-ui/src/lib/models/image-only-data-info.ts @@ -0,0 +1,6 @@ +export interface ImageOnlyDataInfo { + imageUrl: string; + imageRootUrl: string; + defaultImage: string; + fileName: string; +} diff --git a/projects/ucap-webmessenger-ui/src/public-api.ts b/projects/ucap-webmessenger-ui/src/public-api.ts index 15561e61..76304e98 100644 --- a/projects/ucap-webmessenger-ui/src/public-api.ts +++ b/projects/ucap-webmessenger-ui/src/public-api.ts @@ -30,6 +30,8 @@ export * from './lib/directives/click-outside.directive'; export * from './lib/directives/file-upload-for.directive'; export * from './lib/directives/image.directive'; +export * from './lib/models/image-only-data-info'; + export * from './lib/services/bottom-sheet.service'; export * from './lib/services/clipboard.service'; export * from './lib/services/dialog.service';