Uh oh!
There was an error while loading. Please reload this page.
[image_picker] Add limit parameter to pickMultiImage and pickMultipleMedia to ios and Android - #6201
Conversation
2470dcd to
3b38ad7CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ditman
left a comment
There was a problem hiding this comment.
I think that this PR could be much simplified if it were: "add a new parameter to MultiImagePickerOptions, and then use it in iOS and Android". For example, the web package wouldn't need any changes, because it doesn't care about the new parameter of that object at all.
There's a lot of extra code because this is updating a bunch of deprecated methods (as @tarrinneal mentioned in his review above!), which... we might be even able to delete...
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pdenert
commented
Feb 29, 2024
I've cleaned up packages which remain unchanged. |
ditman
commented
Feb 29, 2024
Thanks for reverting the I checked the web APIs again and there's nothing new to We could count how many they've selected and throw an exception, or discard extras if they've picked too many, but that's probably confusing, and can be implemented on the application layer too. |
pdenert
commented
Feb 29, 2024
Yeah, I feel the same way. If we can't limit choice on the UI side, then it's better to do nothing. |
pdenert
commented
Mar 4, 2024
@tarrinneal do you mind look at this again? |
There was a problem hiding this comment.
The iOS side looks good, however, the usage of pickMultiImageWithMaxSize and makeWithMaxSize within image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.m will need to be updated to use new parameter.
Also, additional tests should be added to test the new limit parameter correctly sets the maxImageCount. I've included an example you can use below. You should also add ones where the limit is nil.
Test example
- (void)testPickMultiImageWithLimit {
FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc] init];
[plugin pickMultiImageWithMaxSize:[[FLTMaxSize alloc] init]
quality:nilfullMetadata:NOlimit:@(2)
completion:^(NSArray<NSString *> *_Nullable result,
FlutterError *_Nullable error){
}];
XCTAssertEqual(plugin.callContext.maxImageCount, 2);
}
- (void)testPickMediaWithLimitAllowsMultiple {
FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc] init];
FLTMediaSelectionOptions *mediaSelectionOptions =
[FLTMediaSelectionOptions makeWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
imageQuality:nilrequestFullMetadata:NOallowMultiple:YESlimit:@(2)];
[plugin pickMediaWithMediaSelectionOptions:mediaSelectionOptions
completion:^(NSArray<NSString *> *_Nullable result,
FlutterError *_Nullable error){
}];
XCTAssertEqual(plugin.callContext.maxImageCount, 2);
}
- (void)testPickMediaWithLimitMultipleNotAllowed {
FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc] init];
FLTMediaSelectionOptions *mediaSelectionOptions =
[FLTMediaSelectionOptions makeWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
imageQuality:nilrequestFullMetadata:NOallowMultiple:NOlimit:@(2)];
[plugin pickMediaWithMediaSelectionOptions:mediaSelectionOptions
completion:^(NSArray<NSString *> *_Nullable result,
FlutterError *_Nullable error){
}];
XCTAssertEqual(plugin.callContext.maxImageCount, 1);
}
Uh oh!
There was an error while loading. Please reload this page.
pdenert
commented
Mar 4, 2024
@vashworth thanks for the test examples. I've also added tests for variants where the limit is nil |
vashworth
left a comment
There was a problem hiding this comment.
The test Linux repo_checks is failing on formatting issues:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8754354673776286193/+/u/Run_package_tests/format/stdout
Looks like a number of files need to be formatted: https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code
2a4b62b to
3f7062eComparepdenert
commented
Apr 16, 2024
@tarrinneal may you look at this soon? |
tarrinneal
left a comment
There was a problem hiding this comment.
Thanks for putting in the time and effort on this pr.
(and sorry for the delays in approval)
…MultipleMedia to ios and Android (flutter/packages#6201)
flutter/packages@90c876d...d39830e 2024-04-16 engine-flutter-autoroll@skia.org Manual roll Flutter from 2e748e8 to 3882afb (16 revisions) (flutter/packages#6549) 2024-04-16 pdenert09@gmail.com [image_picker] Add limit parameter to pickMultiImage and pickMultipleMedia to ios and Android (flutter/packages#6201) 2024-04-16 stuartmorgan@google.com [camera] Remove iOS thread-safe result class (flutter/packages#6498) 2024-04-16 rrpadilla@gmail.com [google_maps_flutter] update ios privacy manifest (flutter/packages#6511) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@90c876d...d39830e 2024-04-16 engine-flutter-autoroll@skia.org Manual roll Flutter from 2e748e8 to 3882afb (16 revisions) (flutter/packages#6549) 2024-04-16 pdenert09@gmail.com [image_picker] Add limit parameter to pickMultiImage and pickMultipleMedia to ios and Android (flutter/packages#6201) 2024-04-16 stuartmorgan@google.com [camera] Remove iOS thread-safe result class (flutter/packages#6498) 2024-04-16 rrpadilla@gmail.com [google_maps_flutter] update ios privacy manifest (flutter/packages#6511) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions`. The `limit` argument defines how many images or media files can be select. Only platform interface package changes taken from: flutter#6201 Fixes: [flutter/flutter#85772](flutter/flutter#85772)
…Media to ios and Android (flutter#6201) Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions` and supports its use on iOS and Android. The `limit` argument defines how many images or media files can be select. Fixes: [flutter/flutter#85772](flutter/flutter#85772)
Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions`. The `limit` argument defines how many images or media files can be select. Only platform interface package changes taken from: flutter#6201 Fixes: [flutter/flutter#85772](flutter/flutter#85772)
…Media to ios and Android (flutter#6201) Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions` and supports its use on iOS and Android. The `limit` argument defines how many images or media files can be select. Fixes: [flutter/flutter#85772](flutter/flutter#85772)
Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions`. The `limit` argument defines how many images or media files can be select. Only platform interface package changes taken from: flutter#6201 Fixes: [flutter/flutter#85772](flutter/flutter#85772)
…Media to ios and Android (flutter#6201) Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions` and supports its use on iOS and Android. The `limit` argument defines how many images or media files can be select. Fixes: [flutter/flutter#85772](flutter/flutter#85772)
Adds limit parameter to
MediaOptionsandMultiImagePickerOptionsand supports its use on iOS and Android. Thelimitargument defines how many images or media files can be select.Fixes: flutter/flutter#85772
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.