Fixes #425 and updates iOS to use NSDocumentDirectory on iOS 12 or lower
This commit is contained in:
parent
1479f8a8cd
commit
b2668dbbd0
|
@ -1,3 +1,6 @@
|
|||
## 2.0.7
|
||||
Fixes [#425](https://github.com/miguelpruivo/flutter_file_picker/issues/425) and updates iOS to use NSDocumentDirectory on iOS 12 or lower. Thanks @allanwolski.
|
||||
|
||||
## 2.0.6
|
||||
iOS: Fixes iOS 14 media picker (image & video) (#405, #407).
|
||||
|
||||
|
|
|
@ -109,12 +109,10 @@ public class FilePickerDelegate implements PluginRegistry.ActivityResultListener
|
|||
|
||||
if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
|
||||
}
|
||||
|
||||
Log.d(FilePickerDelegate.TAG, "[SingleFilePick] File URI:" + uri.toString());
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && type.equals("dir")) {
|
||||
Log.d(FilePickerDelegate.TAG, "[SingleFilePick] File URI:" + uri.toString());
|
||||
final String dirPath = FileUtils.getFullPathFromTreeUri(uri, activity);
|
||||
|
||||
if(dirPath != null) {
|
||||
finishWithSuccess(dirPath);
|
||||
} else {
|
||||
|
|
|
@ -71,7 +71,12 @@
|
|||
}
|
||||
|
||||
if([call.method isEqualToString:@"dir"]) {
|
||||
[self resolvePickDocumentWithMultiPick:NO pickDirectory:YES];
|
||||
if (@available(iOS 13, *)) {
|
||||
[self resolvePickDocumentWithMultiPick:NO pickDirectory:YES];
|
||||
} else {
|
||||
_result([self getDocumentDirectory]);
|
||||
_result = nil;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +102,11 @@
|
|||
result(FlutterMethodNotImplemented);
|
||||
_result = nil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (NSString*)getDocumentDirectory {
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
return paths.firstObject;
|
||||
}
|
||||
|
||||
#pragma mark - Resolvers
|
||||
|
|
|
@ -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.6
|
||||
version: 2.0.7
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
|
Loading…
Reference in New Issue