-
Notifications
You must be signed in to change notification settings - Fork 22
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
Limit number of files that can be selected #60
Conversation
…d add notes there
Please take a look at https://github.com/onseok/peekaboo |
# Conflicts: # filekit-core/src/iosMain/kotlin/io/github/vinceglb/filekit/core/FileKit.ios.kt
It must be contained between 2 and 50 to prevent crash on Android
I updated your PR with these changes:
On Android, the value must not exceed I tested on Android and iOS, with and without @santiwanti, what do you think of the changes? |
@vinceglb They look good. The PR was more a prototype to see on which platforms could handle
|
Just to add most apps keep a limit of 10 to 30 for a single selection. Perhaps to ensure memory management. 50 is a very good number to have though. Might be a issue for HEIC image files. |
@santiwanti
@LaatonWalaBhoot |
Finally, I'm going to merge this PR today to create version 0.7.0 and we'll create another PR to manage max items limit nicely later. |
…max_files # Conflicts: # filekit-core/src/jvmMain/kotlin/io/github/vinceglb/filekit/core/platform/mac/MacOSFilePicker.kt
Mentioned in this issue: #50.
I tried to tackle this, but there are multiple issues:
Doesn't work:
Partially works:
These results are not great. I think we can implement the limit ourselves by keeping track of the amount of selected files and then either not letting the user select more or deselecting the oldest selection, FIFO style.
A possible implementation for this on JVM (Windows) for example is to have a coroutine running the whole time the picker is open and querying
fc.selectedFiles
and when it goes over the limit apply the limit strategy to keep the selected files at or below the max.I haven't looked into whether this manual handling is possible for all platforms. I could take a look, but I'm not sure if maintaining this for all platforms is something that you want to do @vinceglb.
There might also be better options, if anyone knows any add a comment to this PR and I will check it out.