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