Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 1367 #1369

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 5.5.1
### iOS
- fix [1367](https://github.com/miguelpruivo/flutter_file_picker/issues/1367)
## 5.5.0
### iOS
Fix if selecting from gallery multiple files from remote sources (eg GoPro, Drone) imported to the device gallery and uploaded to iCloud they would have the same file name and it shows only one image repeated
Expand Down
2 changes: 1 addition & 1 deletion example/android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1
eclipse.preferences.version=1
8 changes: 7 additions & 1 deletion ios/Classes/FilePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ @interface FilePickerPlugin()
@property (nonatomic) BOOL loadDataToMemory;
@property (nonatomic) BOOL allowCompression;
@property (nonatomic) dispatch_group_t group;
@property (nonatomic) MediaType type;
@end

@implementation FilePickerPlugin
Expand Down Expand Up @@ -188,6 +189,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, *)) {
Expand Down Expand Up @@ -482,6 +485,9 @@ -(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPicke
}

__block NSError * blockError;

bool isImageSelection = self.type == IMAGE;
NSString * utiType = isImageSelection ? @"public.image" : @"public.audiovisual-content";

for (NSInteger index = 0; index < results.count; ++index) {
[urls addObject:[NSNull null]];
Expand All @@ -490,7 +496,7 @@ -(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPicke

PHPickerResult * result = [results objectAtIndex: index];

[result.itemProvider loadFileRepresentationForTypeIdentifier:@"public.item" completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
[result.itemProvider loadFileRepresentationForTypeIdentifier:utiType completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {

if(url == nil) {
blockError = error;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 5.5.0
version: 5.5.1

dependencies:
flutter:
Expand Down