From 6c279e57543d07f7d25b019b7b9a03402a1a96e2 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Sun, 16 Feb 2020 22:16:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documents/업무/2월/2째주/phone-fomatter.txt | 83 +++++++++++++++++++ .../2째주/묵음파일백업/album-box.component.ts | 48 ++++++++++- .../묵음파일백업/bundle-image.event-json.ts | 1 - .../2째주/묵음파일백업/common-api.service.ts | 70 +++++++--------- .../2째주/묵음파일백업/file-talk-save-multi.ts | 5 +- 5 files changed, 163 insertions(+), 44 deletions(-) create mode 100644 documents/업무/2월/2째주/phone-fomatter.txt diff --git a/documents/업무/2월/2째주/phone-fomatter.txt b/documents/업무/2월/2째주/phone-fomatter.txt new file mode 100644 index 0000000..4d30003 --- /dev/null +++ b/documents/업무/2월/2째주/phone-fomatter.txt @@ -0,0 +1,83 @@ +libphonenumber-js ^0.4.19 +default_country: "KR" +metadata: + KR: Array(6) + 0: "82" + 1: "00(?:3\d{8,9}|7\d{9,11})|[1-7]\d{4,9}|8\d{8}" + 2: + 0: (3) ["(\d{2})(\d{3,4})", "$1-$2", Array(1)] + 1: (4) ["(\d{4})(\d{4})", "$1-$2", Array(2), "$1"] + 2: (3) ["(\d{5})", "$1", Array(3)] + 3: (3) ["(\d)(\d{3,4})(\d{4})", "$1-$2-$3", Array(1)] + 4: (3) ["(\d{2})(\d{3})(\d{4})", "$1-$2-$3", Array(1)] + 5: (3) ["(\d{2})(\d{3,4})(\d{4})", "$1-$2-$3", Array(1)] + 6: (3) ["(\d{2})(\d{4})(\d{4})", "$1-$2-$3", Array(1)] + 3: "0" + 4: "0$1" + 5: "0(8[1-46-8]|85\d{2})?" + length: 6 +parsed_input: "01040" +current_output: "" +national_prefix: "0" +national_number: "1040" +country: "KR" +country_metadata: (6) ["82", "00(?:3\d{8,9}|7\d{9,11})|[1-7]\d{4,9}|8\d{8}", Array(7), "0", "0$1", "0(8[1-46-8]|85\d{2})?"] +country_phone_code: "82" +available_formats: (7) [Array(3), Array(4), Array(3), Array(3), Array(3), Array(3), Array(3)] +matching_formats: [Array(3)] +chosen_format: (3) ["(\d{2})(\d{3,4})(\d{4})", "$1-$2-$3", Array(1)] +template: "xxx-xxxx-xxxx" +partially_populated_template: "010-40xx-xxxx" +last_match_position: 5 + + + +latest +options: {} +metadata: Metadata {metadata: {…}, v1: false, v2: false, v3: false, v4: true, …} +defaultCountry: "KR" +formattedOutput: "01031" +international: undefined +countryCallingCode: undefined +digits: "01031" +nationalNumberDigits: "1031" +nationalPrefix: "0" +carrierCode: "" +country: "KR" +matchingFormats: (2) [Format, Format] +chosenFormat: Format {_format: Array(3), metadata: NumberingPlan} +template: "xxxxx-xxxx" +populatedNationalNumberTemplate: "01031-xxxx" +populatedNationalNumberTemplatePosition: 4 + + + +altKey: false +bubbles: true +cancelBubble: false +cancelable: true +charCode: 0 +code: "Digit1" +composed: true +ctrlKey: false +currentTarget: input#mat-input-4.mat-input-element.mat-form-field-autofill-control.cdk-text-field-autofill-monitored +defaultPrevented: false +detail: 0 +eventPhase: 2 +isComposing: false +isTrusted: true +key: "1" +keyCode: 49 +location: 0 +metaKey: false +path: (11) [input#mat-input-4.mat-input-element.mat-form-field-autofill-control.cdk-text-field-autofill-monitor…, div.expired-text, ucap-call-dial-pad.ng-star-inserted, mat-dialog-container#mat-dialog-0.mat-dialog-container.ng-tns-c48-33.ng-trigger.ng-trigger-dialogCo…, div#cdk-overlay-0.cdk-overlay-pane, div.cdk-global-overlay-wrapper, div.cdk-overlay-container, body.theme-default.ng-tns-0-0, html, document, global] +repeat: false +returnValue: true +shiftKey: false +sourceCapabilities: InputDeviceCapabilities {firesTouchEvents: false} +srcElement: input#mat-input-4.mat-input-element.mat-form-field-autofill-control.cdk-text-field-autofill-monitored +target: input#mat-input-4.mat-input-element.mat-form-field-autofill-control.cdk-text-field-autofill-monitored +timeStamp: 141697.48999999138 +type: "keydown" +view: global {parent: global, postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, …} +which: 49 \ No newline at end of file diff --git a/documents/업무/2월/2째주/묵음파일백업/album-box.component.ts b/documents/업무/2월/2째주/묵음파일백업/album-box.component.ts index 2a579ef..6486498 100644 --- a/documents/업무/2월/2째주/묵음파일백업/album-box.component.ts +++ b/documents/업무/2월/2째주/묵음파일백업/album-box.component.ts @@ -68,6 +68,9 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { playable = true; + urlList: string[]; + currentIndex = 0; + constructor( private store: Store, private sessionStorageService: SessionStorageService, @@ -147,6 +150,9 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { } getImageUrl(fileInfo: FileInfoTotal): string { + if(FileType.Bundle === fileInfo.info.type && !!this.urlList) { + return this.urlList[this.currentIndex]; + } return this.commonApiService.urlForFileTalkDownload( { userSeq: this.loginRes.userSeq, @@ -158,6 +164,10 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { ); } + getThumbnailForBundle(info: Info, index: number) { + return `${info.sentMessageJson.baseUrl}${info.sentMessageJson.thumbUrls[index]}`; + } + onErrorThumbnail(el: HTMLElement, fileInfo: FileInfoTotal): void { const iconEl = document.createElement('div'); iconEl.setAttribute( @@ -174,7 +184,9 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { if (this.currentTabIndex === 0) { // Image this.filteredList = this.fileInfoTotal.filter( - fileInfo => fileInfo.info.type === FileType.Image + fileInfo => + fileInfo.info.type === FileType.Image || + fileInfo.info.type === FileType.Bundle ); } else { // Video @@ -192,6 +204,22 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { this.playable = true; this.selectedFile = fileInfo; + + if (FileType.Bundle === fileInfo.info.type) { + this.urlList = []; + const bundleJson = fileInfo.info.sentMessageJson as BundleImageEventJson; + bundleJson.thumbUrls.forEach((thumb, index) => { + this.urlList.push( + `${bundleJson.baseUrl}${bundleJson.thumbUrls[index]}` + .replace('WebFile', 'AttFile') + .replace('.thumb.jpg','') + ); + }); + this.currentIndex = 0; + } else { + this.urlList = undefined; + this.currentIndex = 0; + } } getCheckItem(fileInfo: FileInfoTotal) { @@ -261,4 +289,22 @@ export class AlbumBoxComponent implements OnInit, OnDestroy { this.playable = false; } } + + onclickBundleImagePrev() { + if (!this.urlList || 0 === this.urlList.length || 0 === this.currentIndex) { + return; + } + this.currentIndex--; + } + + onClickBundleImageNext() { + if ( + !this.urlList || + 0 === this.urlList.length || + this.urlList.length - 1 <= this.currentIndex + ) { + return; + } + this.currentIndex++; + } } diff --git a/documents/업무/2월/2째주/묵음파일백업/bundle-image.event-json.ts b/documents/업무/2월/2째주/묵음파일백업/bundle-image.event-json.ts index 766272a..922f01b 100644 --- a/documents/업무/2월/2째주/묵음파일백업/bundle-image.event-json.ts +++ b/documents/업무/2월/2째주/묵음파일백업/bundle-image.event-json.ts @@ -10,7 +10,6 @@ export interface BundleImageEventJson { fileCount?: number; baseUrl?: string; thumbUrls?: string[]; - fileType?: FileType; } export const decodeBundleImageEventJson: EventJsonDecoder = ( diff --git a/documents/업무/2월/2째주/묵음파일백업/common-api.service.ts b/documents/업무/2월/2째주/묵음파일백업/common-api.service.ts index b955052..311ed45 100644 --- a/documents/업무/2월/2째주/묵음파일백업/common-api.service.ts +++ b/documents/업무/2월/2째주/묵음파일백업/common-api.service.ts @@ -177,45 +177,6 @@ export class CommonApiService { ); } - public fileTalkSaveMulti( - req: FileTalkSaveMultiRequest, - fileTalkSaveMultiUrl?: string - ): Observable { - const httpReq = new HttpRequest( - 'POST', - !!fileTalkSaveMultiUrl - ? fileTalkSaveMultiUrl - : this.urls.fileTalkSaveMulti, - encodeFileTalkSaveMulti(req), - { reportProgress: true, responseType: 'text' as 'json' } - ); - - const progressList: Subject[] = []; - for (const p of req.fileUploadItems) { - progressList.push(p.uploadStart()); - } - - return this.httpClient.request(httpReq).pipe( - filter(event => { - if (event instanceof HttpResponse) { - return true; - } else if (HttpEventType.UploadProgress === event.type) { - // progress.next(Math.round((100 * event.loaded) / event.total)); - for (const progress of progressList) { - progress.next(Math.round((100 * event.loaded) / event.total)); - } - } - return false; - }), - map((event: HttpResponse) => { - for (const p of req.fileUploadItems) { - p.uploadComplete(); - } - return decodeFileTalkSaveMulti(event.body); - }) - ); - } - public fileTalkSave( req: FileTalkSaveRequest, fileTalkSaveUrl?: string @@ -245,6 +206,37 @@ export class CommonApiService { ); } + public fileTalkSaveMulti( + req: FileTalkSaveMultiRequest, + fileTalkSaveMultiUrl?: string + ): Observable { + const httpReq = new HttpRequest( + 'POST', + !!fileTalkSaveMultiUrl + ? fileTalkSaveMultiUrl + : this.urls.fileTalkSaveMulti, + encodeFileTalkSaveMulti(req), + { reportProgress: true, responseType: 'text' as 'json' } + ); + + const progress = req.fileUploadItem.uploadStart(); + + return this.httpClient.request(httpReq).pipe( + filter(event => { + if (event instanceof HttpResponse) { + return true; + } else if (HttpEventType.UploadProgress === event.type) { + progress.next(Math.round((100 * event.loaded) /event.total)); + } + return false; + }), + map((event: HttpResponse { + req.fileUploadItem.uploadComplete(); + return decodeFileTalkSaveMulti(event.body); + }) + ); + } + public acceptableExtensionForFileTalk( extensions: string[] ): { accept: boolean; reject: string[] } { diff --git a/documents/업무/2월/2째주/묵음파일백업/file-talk-save-multi.ts b/documents/업무/2월/2째주/묵음파일백업/file-talk-save-multi.ts index 17a7c71..660467a 100644 --- a/documents/업무/2월/2째주/묵음파일백업/file-talk-save-multi.ts +++ b/documents/업무/2월/2째주/묵음파일백업/file-talk-save-multi.ts @@ -16,9 +16,8 @@ export interface FileTalkSaveMultiRequest extends APIRequest { deviceType: DeviceType; token: string; files: File[]; - fileUploadItems: FileUploadItem[]; + fileUploadItems: FileUploadItem; roomSeq?: string; - type?: string; } export interface FileTalkSaveMultiResponse extends APIResponse { @@ -36,7 +35,7 @@ const fileTalkSaveEncodeMapTemp = { deviceType: 'p_device_type', token: 'p_token', roomSeq: 'p_room_id', - files: 'file[]', + files: 'file', type: 'p_type' };