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

View File

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

View File

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

View File

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

View File

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