파일 다운로드시 SSVC_TYPE_FILE_DOWN_CHECK_REQ 수행하도록 추가.

This commit is contained in:
leejinho 2020-01-17 10:50:06 +09:00
parent 660fce9dc6
commit af80f08b9d
5 changed files with 45 additions and 12 deletions

View File

@ -1,10 +1,4 @@
import {
Component,
OnInit,
OnDestroy,
Inject,
EventEmitter
} from '@angular/core';
import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { NGXLogger } from 'ngx-logger';
@ -20,6 +14,7 @@ import {
import { FileDownloadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common';
import { TranslateService } from '@ngx-translate/core';
import { FileProtocolService } from '@ucap-webmessenger/protocol-file';
export interface FileViewerDialogData {
fileInfo: FileEventJson;
@ -55,6 +50,7 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
private translateService: TranslateService,
private snackBarService: SnackBarService,
private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService,
private logger: NGXLogger
) {
this.fileInfo = data.fileInfo;
@ -98,6 +94,14 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
FileUtil.fromBlobToBuffer(blob)
.then(buffer => {
/** download check */
this.fileProtocolService
.downCheck({
seq: this.fileInfo.attachmentSeq
})
.pipe(take(1))
.subscribe();
this.nativeService
.saveFile(buffer, this.fileInfo.fileName, mimeType)
.then(result => {

View File

@ -117,6 +117,7 @@ import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { TranslateService } from '@ngx-translate/core';
import { TranslatePipe } from 'projects/ucap-webmessenger-ui/src/lib/pipes/translate.pipe';
import { TranslateService as uiTranslateService } from '@ucap-webmessenger/ui';
import { FileProtocolService } from '@ucap-webmessenger/protocol-file';
@Component({
selector: 'app-layout-messenger-messages',
@ -216,6 +217,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
private sessionStorageService: SessionStorageService,
private localStorageService: LocalStorageService,
private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService,
private clipboardService: ClipboardService,
private uiTranslateService: uiTranslateService,
private translateService: TranslateService,
@ -1021,6 +1023,13 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
FileUtil.fromBlobToBuffer(blob)
.then(buffer => {
/** download check */
this.fileProtocolService.downCheck({
seq: value.fileInfo.attachmentSeq
})
.pipe(take(1))
.subscribe();
this.nativeService
.saveFile(buffer, value.fileInfo.fileName, mimeType, savePath)
.then(result => {

View File

@ -2,14 +2,15 @@ import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import {
FileInfo,
FileDownloadInfo,
FileType
FileType,
FileProtocolService
} from '@ucap-webmessenger/protocol-file';
import { Subscription, combineLatest } from 'rxjs';
import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
import { tap, map, take, finalize } from 'rxjs/operators';
import { FileUtil, MimeUtil, DeviceType } from '@ucap-webmessenger/core';
import { FileUtil, MimeUtil } from '@ucap-webmessenger/core';
import { CommonApiService } from '@ucap-webmessenger/api-common';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
@ -65,6 +66,7 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService,
private translateService: TranslateService,
private snackBarService: SnackBarService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
@ -232,6 +234,14 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
FileUtil.fromBlobToBuffer(blob)
.then(buffer => {
/** download check */
this.fileProtocolService
.downCheck({
seq: fileInfo.info.seq
})
.pipe(take(1))
.subscribe();
this.nativeService
.saveFile(buffer, fileInfo.info.name, mimeType)
.then(result => {

View File

@ -3,7 +3,8 @@ import { MatPaginator, MatTableDataSource, MatSort } from '@angular/material';
import {
FileInfo,
FileDownloadInfo,
FileType
FileType,
FileProtocolService
} from '@ucap-webmessenger/protocol-file';
import { Subscription, combineLatest } from 'rxjs';
import { Store, select } from '@ngrx/store';
@ -11,7 +12,7 @@ import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
import * as EventStore from '@app/store/messenger/event';
import { tap, map, take, finalize } from 'rxjs/operators';
import { FileUtil, MimeUtil, DeviceType } from '@ucap-webmessenger/core';
import { FileUtil, MimeUtil } from '@ucap-webmessenger/core';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
@ -78,6 +79,7 @@ export class FileBoxComponent implements OnInit, OnDestroy {
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService,
private translateService: TranslateService,
private snackBarService: SnackBarService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
@ -275,6 +277,14 @@ export class FileBoxComponent implements OnInit, OnDestroy {
FileUtil.fromBlobToBuffer(blob)
.then(buffer => {
/** download check */
this.fileProtocolService
.downCheck({
seq: fileInfo.info.seq
})
.pipe(take(1))
.subscribe();
this.nativeService
.saveFile(buffer, fileInfo.info.name, mimeType)
.then(result => {

View File

@ -25,7 +25,7 @@ export const encodeDownCheck: ProtocolEncoder<DownCheckRequest> = (
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.Integer, value: req.seq });
bodyList.push({ type: PacketBodyValue.String, value: req.seq });
return bodyList;
};