diff --git a/CHANGELOG.md b/CHANGELOG.md index c5368585..80471d03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.3.1 +### iOS +- Fix [1367](https://github.com/miguelpruivo/flutter_file_picker/issues/1367) + ## 8.3.0 ### Desktop (macOS) && iOS - Adds support for Swift Package Manager for compatibility with new projects [#1582](https://github.com/miguelpruivo/flutter_file_picker/issues/1582) diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs index e8895216..9d2efc8e 100644 --- a/example/android/.settings/org.eclipse.buildship.core.prefs +++ b/example/android/.settings/org.eclipse.buildship.core.prefs @@ -1,2 +1,2 @@ connection.project.dir= -eclipse.preferences.version=1 +eclipse.preferences.version=1 \ No newline at end of file diff --git a/ios/file_picker/Sources/file_picker/FilePickerPlugin.m b/ios/file_picker/Sources/file_picker/FilePickerPlugin.m index 09592017..f015c20a 100644 --- a/ios/file_picker/Sources/file_picker/FilePickerPlugin.m +++ b/ios/file_picker/Sources/file_picker/FilePickerPlugin.m @@ -24,6 +24,7 @@ @interface FilePickerPlugin() @property (nonatomic) BOOL loadDataToMemory; @property (nonatomic) BOOL allowCompression; @property (nonatomic) dispatch_group_t group; +@property (nonatomic) MediaType type; @property (nonatomic) BOOL isSaveFile; @end @@ -230,6 +231,8 @@ - (void)resolvePickDocumentWithMultiPick:(BOOL)allowsMultipleSelection pickDirec #ifdef PICKER_MEDIA - (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withCompressionAllowed:(BOOL)allowCompression { + + self.type = type; #ifdef PHPicker if (@available(iOS 14, *)) { @@ -528,19 +531,37 @@ -(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray_group); + return; + } + } else if (isImageSelection) { if (![result.itemProvider hasItemConformingToTypeIdentifier:@"public.image"]) { [errors addObject:[NSString stringWithFormat:@"Item at index %ld is not an image", (long)index]]; dispatch_group_leave(self->_group); return; } + } - [result.itemProvider loadFileRepresentationForTypeIdentifier:@"public.image" completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) { + NSString *typeIdentifier; + if ([result.itemProvider hasItemConformingToTypeIdentifier:@"public.image"]) { + typeIdentifier = @"public.image"; + } else { + typeIdentifier = @"public.movie"; + } + + [result.itemProvider loadFileRepresentationForTypeIdentifier:typeIdentifier completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) { @autoreleasepool { if (error != nil || url == nil) { [errors addObject:[NSString stringWithFormat:@"Failed to load image at index %ld: %@", diff --git a/pubspec.yaml b/pubspec.yaml index b2b0bdc4..62237d54 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker repository: https://github.com/miguelpruivo/flutter_file_picker issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues -version: 8.3.0 +version: 8.3.1 dependencies: flutter: