diff --git a/CHANGELOG.md b/CHANGELOG.md index 949fd642..4bc189de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ that can be found in the LICENSE file. --> # CHANGELOG +## 2.5.2 + +### Improvements + +- Reply errors when thumbnails are failed to load on Android. (#883) + ## 2.5.1+1 ### Fixes diff --git a/android/src/main/kotlin/com/fluttercandies/photo_manager/thumb/ThumbnailUtil.kt b/android/src/main/kotlin/com/fluttercandies/photo_manager/thumb/ThumbnailUtil.kt index 5b8e3eb5..bed45105 100644 --- a/android/src/main/kotlin/com/fluttercandies/photo_manager/thumb/ThumbnailUtil.kt +++ b/android/src/main/kotlin/com/fluttercandies/photo_manager/thumb/ThumbnailUtil.kt @@ -16,32 +16,6 @@ import java.io.ByteArrayOutputStream import java.io.File object ThumbnailUtil { - fun getThumbnail( - ctx: Context, - path: String, - width: Int, - height: Int, - format: Bitmap.CompressFormat, - quality: Int, - frame: Long, - result: MethodChannel.Result? - ) { - val resultHandler = ResultHandler(result) - - try { - val resource = Glide.with(ctx) - .asBitmap() - .apply(RequestOptions().frame(frame).priority(Priority.IMMEDIATE)) - .load(File(path)) - .submit(width, height).get() - val bos = ByteArrayOutputStream() - resource.compress(format, quality, bos) - resultHandler.reply(bos.toByteArray()) - } catch (e: Exception) { - resultHandler.reply(null) - } - } - fun getThumbnail( context: Context, entity: AssetEntity, @@ -65,7 +39,7 @@ object ThumbnailUtil { resource.compress(format, quality, bos) resultHandler.reply(bos.toByteArray()) } catch (e: Exception) { - resultHandler.reply(null) + resultHandler.replyError("Thumbnail request error", e.toString()) } } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 3b928ffc..c40a7d7e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: photo_manager_example description: Demonstrates how to use the photo_manager plugin. -version: 2.5.1+24 +version: 2.5.2+25 publish_to: none environment: diff --git a/pubspec.yaml b/pubspec.yaml index 3f4436dd..a9b03402 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: photo_manager description: A Flutter plugin that provides assets abstraction management APIs on Android, iOS, and macOS. repository: https://github.com/fluttercandies/flutter_photo_manager -version: 2.5.1+1 +version: 2.5.2 environment: sdk: ">=2.13.0 <3.0.0"