see changelog (v1.4.0+1)

* Better handling on Android of buggy file managers that return no intent when canceling the file selection even though it returns Activity.RESULT_OK (#111)

* removes deprecated Android SDK code and fixes an issue that could prevent some downloaded files from being picked

* adds getMultiFile and prevents UI blocking when picking large remote files

* updates readme file

* fixes an issue that could prevent internal storage files from being properly picked
This commit is contained in:
Miguel Ruivo 2019-09-02 13:20:23 +01:00 committed by GitHub
parent 3ce0044177
commit a9eb2abbb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 12 deletions

View File

@ -1,3 +1,7 @@
## 1.4.0+1
**Bug fix:** Fixes an issue that could prevent internal storage files from being properly picked.
## 1.4.0
**New features**
@ -5,7 +9,7 @@
* Adds Desktop example, to run it just do `hover init` and then `hover run` within the plugin's example folder (you must have go and hover installed, check the previous point).
* Similar to `getFile`, now there is also a `getMultiFile` which behaves the same way, but returning a list of files instead.
**Improvements:**
**Improvements**
* Updates Android SDK deprecated code.
* Sometimes when a big file was being picked from a remote directory (GDrive for example), the UI could be blocked. Now this shouldn't happen anymore.

View File

@ -199,14 +199,14 @@ public class FilePickerPlugin implements MethodCallHandler {
@SuppressWarnings("deprecation")
private static void startFileExplorer(String type) {
Intent intent;
if (checkPermission()) {
intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(FileUtils.getExternalPath(instance.activeContext()) + File.separator);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + File.separator);
intent.setDataAndType(uri, type);
intent.setType(type);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, isMultipleSelection);

View File

@ -38,14 +38,8 @@ public class FileUtils {
return null;
}
public static String getExternalPath(Context context) {
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
return context.getExternalFilesDir(null).getAbsolutePath();
}
return context.getFilesDir().getAbsolutePath();
}
@TargetApi(19)
@SuppressWarnings("deprecation")
private static String getForApi19(Context context, Uri uri) {
Log.e(TAG, "Getting for API 19 or above" + uri);
if (DocumentsContract.isDocumentUri(context, uri)) {
@ -57,7 +51,7 @@ public class FileUtils {
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
Log.e(TAG, "Primary External Document URI");
return getExternalPath(context) + "/" + split[1];
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
} else if (isDownloadsDocument(uri)) {
Log.e(TAG, "Downloads External Document URI");

View File

@ -2,7 +2,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 extensions filtering support.
author: Miguel Ruivo <miguel@miguelruivo.com>
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
version: 1.4.0
version: 1.4.0+1
dependencies:
flutter: