2019-11-06 13:48:06 +09:00
|
|
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
|
|
|
import { ucapAnimations } from '../../animations';
|
2019-11-06 16:24:51 +09:00
|
|
|
import { FileEventJson } from '@ucap-webmessenger/protocol-event';
|
|
|
|
import { DeviceType } from '@ucap-webmessenger/core';
|
|
|
|
import {
|
|
|
|
CommonApiService,
|
|
|
|
FileDownloadItem
|
|
|
|
} from '@ucap-webmessenger/api-common';
|
|
|
|
import { take, map } from 'rxjs/operators';
|
2019-11-06 13:48:06 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-image-viewer',
|
|
|
|
templateUrl: './image-viewer.component.html',
|
|
|
|
styleUrls: ['./image-viewer.component.scss'],
|
|
|
|
animations: ucapAnimations
|
|
|
|
})
|
|
|
|
export class ImageViewerComponent implements OnInit {
|
2019-11-06 16:24:51 +09:00
|
|
|
@Input()
|
|
|
|
fileInfo: FileEventJson;
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
downloadUrl: string;
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
userSeq: number;
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
deviceType: DeviceType;
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
token: string;
|
|
|
|
|
2019-11-06 13:48:06 +09:00
|
|
|
@Output()
|
|
|
|
closed = new EventEmitter<void>();
|
|
|
|
|
2019-11-06 16:24:51 +09:00
|
|
|
imageSrc: string;
|
|
|
|
|
|
|
|
fileDownloadItem: FileDownloadItem;
|
|
|
|
|
|
|
|
constructor(private commonApiService: CommonApiService) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.fileDownloadItem = new FileDownloadItem();
|
|
|
|
|
|
|
|
this.commonApiService
|
|
|
|
.fileTalkDownload(
|
|
|
|
{
|
|
|
|
userSeq: this.userSeq,
|
|
|
|
deviceType: this.deviceType,
|
|
|
|
token: this.token,
|
|
|
|
attachmentsSeq: this.fileInfo.attachmentSeq,
|
|
|
|
fileDownloadItem: this.fileDownloadItem
|
|
|
|
},
|
|
|
|
this.downloadUrl
|
|
|
|
)
|
|
|
|
.pipe(
|
|
|
|
take(1),
|
|
|
|
map(aaa => {
|
|
|
|
console.log('fileTalkDownload', aaa);
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
|
|
|
}
|
|
|
|
|
|
|
|
onClickClose(): void {
|
|
|
|
this.closed.emit();
|
|
|
|
}
|
2019-11-06 13:48:06 +09:00
|
|
|
}
|