fake image 쪽지쪽 처리.
This commit is contained in:
		
							parent
							
								
									f113e66377
								
							
						
					
					
						commit
						d6b518f29b
					
				| @ -178,6 +178,10 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { | |||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       this.validUploadFile(fileList).then(async result => { | ||||||
|  |         if (!result) { | ||||||
|  |           return; | ||||||
|  |         } else { | ||||||
|           for (let i = 0; i < fileList.length; i++) { |           for (let i = 0; i < fileList.length; i++) { | ||||||
|             const file = fileList.item(i); |             const file = fileList.item(i); | ||||||
| 
 | 
 | ||||||
| @ -198,6 +202,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { | |||||||
| 
 | 
 | ||||||
|           self.checkContentLength(); |           self.checkContentLength(); | ||||||
|           self.changeDetectorRef.detectChanges(); |           self.changeDetectorRef.detectChanges(); | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -228,7 +234,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { | |||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   validUploadFile(fileList: FileList): boolean { |   async validUploadFile(fileList: FileList): Promise<boolean> { | ||||||
|     let valid = true; |     let valid = true; | ||||||
|     if (this.fileAllowSize > 0) { |     if (this.fileAllowSize > 0) { | ||||||
|       for (let i = 0; i < fileList.length; i++) { |       for (let i = 0; i < fileList.length; i++) { | ||||||
| @ -284,6 +290,39 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { | |||||||
|       return valid; |       return valid; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     const files: File[] = []; | ||||||
|  |     for (let i = 0; i < fileList.length; i++) { | ||||||
|  |       files.push(fileList.item(i)); | ||||||
|  |     } | ||||||
|  |     const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk( | ||||||
|  |       files | ||||||
|  |     ); | ||||||
|  |     if (!fakeMedia.accept) { | ||||||
|  |       this.ngZone.run(() => { | ||||||
|  |         this.snackBarService.openFromComponent< | ||||||
|  |           AlertSnackbarComponent, | ||||||
|  |           AlertSnackbarData | ||||||
|  |         >(AlertSnackbarComponent, { | ||||||
|  |           duration: 1000, | ||||||
|  |           verticalPosition: 'bottom', | ||||||
|  |           horizontalPosition: 'center', | ||||||
|  |           data: { | ||||||
|  |             html: this.translateService.instant( | ||||||
|  |               'common.file.errors.notAcceptableMime', | ||||||
|  |               { | ||||||
|  |                 supporedType: | ||||||
|  |                   fakeMedia.rejected.length > 0 | ||||||
|  |                     ? fakeMedia.rejected.join(',') | ||||||
|  |                     : '' | ||||||
|  |               } | ||||||
|  |             ) | ||||||
|  |           } | ||||||
|  |         }); | ||||||
|  |       }); | ||||||
|  |       valid = false; | ||||||
|  |       return valid; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     return valid; |     return valid; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user