From b72483dc660168af7d9cbcfc6330fec077d0e75b Mon Sep 17 00:00:00 2001 From: Miguel Ruivo Date: Wed, 29 May 2019 14:02:26 +0100 Subject: [PATCH] Adds the document picker delegate for versions below iOS 11 (#87) * If file not choosen getFile() should return null * minor fix * fixes an issue where sometimes getFilePath could return a List instead of a String * minor fixes * Update README.md * Fix for background activities trying to register the plugin (#66) * Beta (#55) * If picker is canceled in `getFile()`, it should return `null` * Beta (#60) * Added a check to registerWith to prevent background flutter view from trying to register the plugin, as there won't be any activity. * 1.3.3 > 1.3.4 * removes a build.gradle depdency that should't have been added in the last commit * Adds the document picker delegate for versions below iOS 11 --- CHANGELOG.md | 6 +++++- README.md | 2 +- ios/Classes/FilePickerPlugin.m | 8 ++++++++ pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31e2353..7fa83b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.5 + +**Bug fix:** Fixes an issue that could prevent users to pick files from the iCloud Drive app, on versions below iOS 11. + ## 1.3.4+1 **Rollback:** Removes a local dependency that shouldn't have been committed with `1.3.4` which would cause Android build to fail. @@ -106,6 +110,6 @@ ## 0.1.0 -* Initial realise. +* Initial release. * Supports picking paths from files on local storage, cloud. * Supports picking paths from both gallery & camera due to [image_picker](https://pub.dartlang.org/packages/image_picker) dependency. diff --git a/README.md b/README.md index e779255..70604c2 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A package that allows you to use a native file explorer to pick single or multip First, add *file_picker* as a dependency in [your pubspec.yaml file](https://flutter.io/platform-plugins/). ``` -file_picker: ^1.3.4+1 +file_picker: ^1.3.5 ``` ### Android Add diff --git a/ios/Classes/FilePickerPlugin.m b/ios/Classes/FilePickerPlugin.m index d230260..a706260 100644 --- a/ios/Classes/FilePickerPlugin.m +++ b/ios/Classes/FilePickerPlugin.m @@ -131,6 +131,14 @@ #pragma mark - Delegates +// DocumentPicker delegate - iOS 10 only +- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url{ + [self.documentPickerController dismissViewControllerAnimated:YES completion:nil]; + NSString * path = (NSString *)[url path]; + _result(path); + _result = nil; +} + // DocumentPicker delegate - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray *)urls{ diff --git a/pubspec.yaml b/pubspec.yaml index ddbe616..4ed3081 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker -version: 1.3.4+1 +version: 1.3.5 dependencies: flutter: