From b0b5ed220903c4577dc1688cf865516b5778f8eb Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 10 Feb 2020 09:33:41 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=201.=20=EB=B9=88=ED=99=95=EC=9E=A5?= =?UTF-8?q?=EC=9E=90=20=ED=8C=8C=EC=9D=BC=EC=97=85=EB=A1=9C=EB=93=9C?= =?UTF-8?q?=EC=8B=9C=20=EC=98=A4=EB=A5=98=EC=B2=98=EB=A6=AC.=202.=20?= =?UTF-8?q?=EC=A7=80=EC=9B=90=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9E=85=EB=8B=88=EB=8B=A4.=20
=20(ext..?= =?UTF-8?q?)=20=EC=9D=98=20=EC=A4=84=EB=B0=94=EA=BF=88=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/services/common-api.service.ts | 9 +++--- .../components/messages.component.ts | 31 ++++++++++++------- .../src/lib/components/write.component.ts | 31 ++++++++++++------- .../directives/file-upload-for.directive.ts | 31 ++++++++++++------- .../snackbars/alert.snackbar.component.html | 6 +++- 5 files changed, 68 insertions(+), 40 deletions(-) diff --git a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts index ba116ebd..2490f24c 100644 --- a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts +++ b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts @@ -207,12 +207,13 @@ export class CommonApiService { const reject: string[] = []; for (const extension of extensions) { if ( + !extension || -1 === - this.moduleConfig.acceptableFileExtensions.indexOf( - extension.toLowerCase() - ) + this.moduleConfig.acceptableFileExtensions.indexOf( + extension.toLowerCase() + ) ) { - reject.push(extension); + reject.push(!!extension ? extension : 'empty-ext'); accept = false; } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index f716e39d..9c633d8a 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -22,7 +22,9 @@ import { AlertDialogData, AlertDialogResult, FileUploadQueueComponent, - StringUtil + StringUtil, + AlertSnackbarComponent, + AlertSnackbarData } from '@ucap-webmessenger/ui'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; @@ -1107,18 +1109,23 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { this.fileUploadQueue.onUploadComplete(); } - this.snackBarService.open( - this.translateService.instant('common.file.errors.notSupporedType', { - supporedType: - checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' - }), - '', - { - duration: 1000, - verticalPosition: 'bottom', - horizontalPosition: 'center' + this.snackBarService.openFromComponent< + AlertSnackbarComponent, + AlertSnackbarData + >(AlertSnackbarComponent, { + duration: 1000, + verticalPosition: 'bottom', + horizontalPosition: 'center', + data: { + html: this.translateService.instant( + 'common.file.errors.notSupporedType', + { + supporedType: + checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' + } + ) } - ); + }); return; } diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts index 113898e6..11e38afa 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts @@ -18,7 +18,9 @@ import { AlertDialogResult, AlertDialogComponent, AlertDialogData, - SnackBarService + SnackBarService, + AlertSnackbarComponent, + AlertSnackbarData } from '@ucap-webmessenger/ui'; import { NGXLogger } from 'ngx-logger'; @@ -250,18 +252,23 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { ); if (!checkExt.accept) { this.ngZone.run(() => { - this.snackBarService.open( - this.translateService.instant('common.file.errors.notSupporedType', { - supporedType: - checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' - }), - '', - { - duration: 1000, - verticalPosition: 'bottom', - horizontalPosition: 'center' + this.snackBarService.openFromComponent< + AlertSnackbarComponent, + AlertSnackbarData + >(AlertSnackbarComponent, { + duration: 1000, + verticalPosition: 'bottom', + horizontalPosition: 'center', + data: { + html: this.translateService.instant( + 'common.file.errors.notSupporedType', + { + supporedType: + checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' + } + ) } - ); + }); }); return valid; } diff --git a/projects/ucap-webmessenger-ui/src/lib/directives/file-upload-for.directive.ts b/projects/ucap-webmessenger-ui/src/lib/directives/file-upload-for.directive.ts index 2a9732ba..3486f148 100644 --- a/projects/ucap-webmessenger-ui/src/lib/directives/file-upload-for.directive.ts +++ b/projects/ucap-webmessenger-ui/src/lib/directives/file-upload-for.directive.ts @@ -20,6 +20,10 @@ import { } from '../dialogs/alert.dialog.component'; import { TranslateService } from '@ngx-translate/core'; import { SnackBarService } from '../services/snack-bar.service'; +import { + AlertSnackbarComponent, + AlertSnackbarData +} from '../snackbars/alert.snackbar.component'; @Directive({ selector: 'input[ucapFileUploadFor], div[ucapFileUploadFor]' @@ -121,18 +125,23 @@ export class FileUploadForDirective implements AfterViewInit { this.elementRef.nativeElement.value = ''; this.dragOver = false; - this.snackBarService.open( - this.translateService.instant('common.file.errors.notSupporedType', { - supporedType: - checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' - }), - '', - { - duration: 1000, - verticalPosition: 'bottom', - horizontalPosition: 'center' + this.snackBarService.openFromComponent< + AlertSnackbarComponent, + AlertSnackbarData + >(AlertSnackbarComponent, { + duration: 1000, + verticalPosition: 'bottom', + horizontalPosition: 'center', + data: { + html: this.translateService.instant( + 'common.file.errors.notSupporedType', + { + supporedType: + checkExt.reject.length > 0 ? checkExt.reject.join(',') : '' + } + ) } - ); + }); return; } diff --git a/projects/ucap-webmessenger-ui/src/lib/snackbars/alert.snackbar.component.html b/projects/ucap-webmessenger-ui/src/lib/snackbars/alert.snackbar.component.html index c4e1833b..10994613 100644 --- a/projects/ucap-webmessenger-ui/src/lib/snackbars/alert.snackbar.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/snackbars/alert.snackbar.component.html @@ -5,7 +5,11 @@ fxFlexAlign="center" class="mat-simple-snackbar-action ng-star-inserted" > -