[file_selector] Add file group to save return value#4222
[file_selector] Add file group to save return value#4222auto-submit[bot] merged 21 commits intoflutter:mainfrom
Conversation
| confirmButtonText: confirmButtonText, | ||
| ), | ||
| )) | ||
| ?.path; |
There was a problem hiding this comment.
Was this intentional (or produced with dartfmt)?
There was a problem hiding this comment.
dartfmt :( But @ditman's suggestion fixed it.
|
|
||
| class OldFileSelectorPlatformImplementation extends FileSelectorPlatform { | ||
| static const String savePath = '/a/path'; | ||
| // Only implement the deprecated getSavePath. |
There was a problem hiding this comment.
Fixed. I've never figured out when dart format doesn't fix comment indentation.
| if (!path.split(Platform.pathSeparator).last.contains('.')) { | ||
| final XTypeGroup? activeGroup = result.activeFilter; | ||
| if (activeGroup != null) { | ||
| path = '$path.${activeGroup.extensions!.first}'; |
There was a problem hiding this comment.
Is the extensions list always guaranteed to contain at least one so long as there's an activeFilter? (That makes logical sense but it's a bummer we need to know it here)
There was a problem hiding this comment.
This is dependent on the code 15-20 lines up where we define the groups. I'll add a comment explaining that so it's clear to a reader why it's safe.
| FileDialogResult result(files, nullptr); | ||
| UINT file_type_index; | ||
| if (SUCCEEDED(dialog_controller_->GetFileTypeIndex(&file_type_index)) && | ||
| file_type_index > 0) { |
| ASSERT_FALSE(result.has_error()); | ||
| const EncodableList& paths = result.value(); | ||
| const EncodableList& paths = result.value().paths(); | ||
| EXPECT_EQ(paths.size(), 1); |
There was a problem hiding this comment.
Given the next line, arguably ASSERT_EQ.
There was a problem hiding this comment.
Fixed everywhere.
ditman
left a comment
There was a problem hiding this comment.
Wow, what a big PR for a relatively small fix/feature!
The PR LGTM (I skipped .g.dart and .mock.dart files). Web bits look good (since they're pretty much a Noop). cpp stuff looks... almost intelligible :P
Thanks for fixing this!
packages/file_selector/file_selector/test/file_selector_test.dart
Outdated
Show resolved
Hide resolved
.../file_selector/file_selector_platform_interface/lib/src/types/file_save_location_result.dart
Outdated
Show resolved
Hide resolved
|
I'll split out the first sub-PR shortly. |
…ace (#4254) Platform interface portion of #4222 Part of flutter/flutter#107093
693c7b3 to
2ea2d71
Compare
…#4273) Implementation package portion of #4222 Part of flutter/flutter#107093
flutter/packages@d041934...6b70804 2023-06-23 47866232+chunhtai@users.noreply.github.com [go_router] Reduces excessive rebuilds due to inherited look up. (flutter/packages#4227) 2023-06-23 stuartmorgan@google.com [image_picker] Update to 1.0 (flutter/packages#4285) 2023-06-23 stuartmorgan@google.com [tool] Consider comment-only changes to be dev-only (flutter/packages#4279) 2023-06-23 stuartmorgan@google.com [ci] Switch to LUCI for Android build-all (flutter/packages#4274) 2023-06-23 stuartmorgan@google.com [file_selector] Add file group to save return value (flutter/packages#4222) 2023-06-23 47866232+chunhtai@users.noreply.github.com [go_router] Adds onException to GoRouter constructor. (flutter/packages#4216) 2023-06-23 stuartmorgan@google.com [file_selector] Add file group to save return value - implementations (flutter/packages#4273) 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

This deprecates
getSavePath, which returned a target path string, in favor of a newgetSaveLocation, which returns an object containing both a path and, optionally, a selected file group. This allows clients to use the selected group when deciding what path to use when saving (see discussion in linked issue).This includes an implementation for Windows. It will also apply to Linux, and I've verified that the structure works, but it's not included here because it requires some non-trivial refactoring in the Linux implementation (we can't get the current index, only the current filter object pointer, which means we need to pass more data around between the various functions to map back to an index... and it's GObject so making internal data utility classes is fiddly.) For now Linux just always returns a null group, and we can add it later.
Most of flutter/flutter#107093
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.