diff --git a/CHANGELOG.md b/CHANGELOG.md index 89b68c5..e19eff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.0.12 +Android: + +- Fixes an issue that could result in some files not being properly retrieved due to special characters on their names. ([#472](https://github.com/miguelpruivo/flutter_file_picker/issues/472)). +- Fixes a NPE that could happen with some devices. ([#482](https://github.com/miguelpruivo/flutter_file_picker/issues/482)). + + ## 2.0.11 iOS: Fixes `FileType.audio` exports to support ipod-library content (non DRM protected). From now on, a cached asset (m4a) will be exported from the selected music file in the Music app, so it can later be used. Fixes ([#441](https://github.com/miguelpruivo/flutter_file_picker/issues/441)). diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java index e969996..6a79aba 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java @@ -283,13 +283,15 @@ public class FilePickerPlugin implements MethodChannel.MethodCallHandler, Flutte this.activityBinding.removeActivityResultListener(this.delegate); this.activityBinding.removeRequestPermissionsResultListener(this.delegate); this.activityBinding = null; - this.lifecycle.removeObserver(this.observer); + if(this.observer != null) { + this.lifecycle.removeObserver(this.observer); + this.application.unregisterActivityLifecycleCallbacks(this.observer); + } this.lifecycle = null; this.delegate.setEventHandler(null); this.delegate = null; this.channel.setMethodCallHandler(null); this.channel = null; - this.application.unregisterActivityLifecycleCallbacks(this.observer); this.application = null; } diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java index c01b107..3d93cce 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java @@ -84,15 +84,7 @@ public class FileUtils { } } - if (uri.getPath() != null) { - result = uri.getPath(); - final int cut = result.lastIndexOf('/'); - if (cut != -1) { - result = result.substring(cut + 1); - } - } - - return result; + return uri.toString(); } public static boolean clearCache(final Context context) { diff --git a/pubspec.yaml b/pubspec.yaml index 2129dba..7033c0e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: file_picker description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support. homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker -version: 2.0.11 +version: 2.0.12 dependencies: flutter: