This commit is contained in:
Park Byung Eun 2020-02-16 22:16:39 +09:00
parent 4403cada93
commit 6c279e5754
5 changed files with 163 additions and 44 deletions

View File

@ -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

View File

@ -68,6 +68,9 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
playable = true;
urlList: string[];
currentIndex = 0;
constructor(
private store: Store<any>,
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<BundleImageEventJson>, 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++;
}
}

View File

@ -10,7 +10,6 @@ export interface BundleImageEventJson {
fileCount?: number;
baseUrl?: string;
thumbUrls?: string[];
fileType?: FileType;
}
export const decodeBundleImageEventJson: EventJsonDecoder<BundleImageEventJson> = (

View File

@ -177,45 +177,6 @@ export class CommonApiService {
);
}
public fileTalkSaveMulti(
req: FileTalkSaveMultiRequest,
fileTalkSaveMultiUrl?: string
): Observable<FileTalkSaveMultiResponse> {
const httpReq = new HttpRequest(
'POST',
!!fileTalkSaveMultiUrl
? fileTalkSaveMultiUrl
: this.urls.fileTalkSaveMulti,
encodeFileTalkSaveMulti(req),
{ reportProgress: true, responseType: 'text' as 'json' }
);
const progressList: Subject<number>[] = [];
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<any>) => {
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<FileTalkSaveMultiResponse> {
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<any) => {
req.fileUploadItem.uploadComplete();
return decodeFileTalkSaveMulti(event.body);
})
);
}
public acceptableExtensionForFileTalk(
extensions: string[]
): { accept: boolean; reject: string[] } {

View File

@ -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'
};