Merge branch 'krille/custom-image-resizer' into 'main'
chore: Allow custom image resizer to be an async method See merge request famedly/company/frontend/famedlysdk!1001
This commit is contained in:
		
						commit
						38728ed153
					
				|  | @ -1,3 +1,6 @@ | ||||||
|  | ## [0.8.17] - 4th Apr 2022 | ||||||
|  | - chore: Allow custom image resizer to be an async method | ||||||
|  | 
 | ||||||
| ## [0.8.16] - 3th Apr 2022 | ## [0.8.16] - 3th Apr 2022 | ||||||
| - fix: Missing type check in power level calculation | - fix: Missing type check in power level calculation | ||||||
| - fix: Post load all users on room opening | - fix: Post load all users on room opening | ||||||
|  |  | ||||||
|  | @ -104,8 +104,8 @@ class Client extends MatrixApi { | ||||||
| 
 | 
 | ||||||
|   final Duration sendTimelineEventTimeout; |   final Duration sendTimelineEventTimeout; | ||||||
| 
 | 
 | ||||||
|   MatrixImageFileResizedResponse? Function(MatrixImageFileResizeArguments)? |   Future<MatrixImageFileResizedResponse?> Function( | ||||||
|       customImageResizer; |       MatrixImageFileResizeArguments)? customImageResizer; | ||||||
| 
 | 
 | ||||||
|   /// Create a client |   /// Create a client | ||||||
|   /// [clientName] = unique identifier of this client |   /// [clientName] = unique identifier of this client | ||||||
|  |  | ||||||
|  | @ -105,7 +105,8 @@ class MatrixImageFile extends MatrixFile { | ||||||
|       required String name, |       required String name, | ||||||
|       int maxDimension = 1600, |       int maxDimension = 1600, | ||||||
|       String? mimeType, |       String? mimeType, | ||||||
|       MatrixImageFileResizedResponse? Function(MatrixImageFileResizeArguments)? |       Future<MatrixImageFileResizedResponse?> Function( | ||||||
|  |               MatrixImageFileResizeArguments)? | ||||||
|           customImageResizer, |           customImageResizer, | ||||||
|       Future<T> Function<T, U>(FutureOr<T> Function(U arg) function, U arg)? |       Future<T> Function<T, U>(FutureOr<T> Function(U arg) function, U arg)? | ||||||
|           compute}) async { |           compute}) async { | ||||||
|  | @ -115,10 +116,11 @@ class MatrixImageFile extends MatrixFile { | ||||||
|       fileName: name, |       fileName: name, | ||||||
|       calcBlurhash: true, |       calcBlurhash: true, | ||||||
|     ); |     ); | ||||||
|     customImageResizer ??= _resize; |     final resizedData = customImageResizer != null | ||||||
|     final resizedData = compute != null |         ? await customImageResizer(arguments) | ||||||
|         ? await compute(_resize, arguments) |         : compute != null | ||||||
|         : _resize(arguments); |             ? await compute(_resize, arguments) | ||||||
|  |             : _resize(arguments); | ||||||
| 
 | 
 | ||||||
|     if (resizedData == null) { |     if (resizedData == null) { | ||||||
|       return MatrixImageFile(bytes: bytes, name: name, mimeType: mimeType); |       return MatrixImageFile(bytes: bytes, name: name, mimeType: mimeType); | ||||||
|  | @ -157,7 +159,8 @@ class MatrixImageFile extends MatrixFile { | ||||||
|   /// computes a thumbnail for the image |   /// computes a thumbnail for the image | ||||||
|   Future<MatrixImageFile?> generateThumbnail( |   Future<MatrixImageFile?> generateThumbnail( | ||||||
|       {int dimension = Client.defaultThumbnailSize, |       {int dimension = Client.defaultThumbnailSize, | ||||||
|       MatrixImageFileResizedResponse? Function(MatrixImageFileResizeArguments)? |       Future<MatrixImageFileResizedResponse?> Function( | ||||||
|  |               MatrixImageFileResizeArguments)? | ||||||
|           customImageResizer, |           customImageResizer, | ||||||
|       Future<T> Function<T, U>(FutureOr<T> Function(U arg) function, U arg)? |       Future<T> Function<T, U>(FutureOr<T> Function(U arg) function, U arg)? | ||||||
|           compute}) async { |           compute}) async { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| name: matrix | name: matrix | ||||||
| description: Matrix Dart SDK | description: Matrix Dart SDK | ||||||
| version: 0.8.16 | version: 0.8.17 | ||||||
| homepage: https://famedly.com | homepage: https://famedly.com | ||||||
| repository: https://gitlab.com/famedly/company/frontend/famedlysdk.git | repository: https://gitlab.com/famedly/company/frontend/famedlysdk.git | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue