-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix/external upload limit #6555
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/external upload limit #6555
Conversation
| // limit exceeded,then show dialog immediately and exit. | ||
| showLimitExceededDialog(fileCount) | ||
| uploadableFiles.clear() // Clear the list just to be safe | ||
| return // exits the function before heavy file processing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to just truncate the list, letting the user upload 20 of the files?
From the user's point of view, selecting the files may have taken time, maybe they selected 21 instead of 20, in which case just removing 1 would be nicer.
What do you think? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fantastic suggestion! acc to me : )
I agree that truncating the list to 20 files is significantly more user-friendly than forcing them to go back and reselect, especially after they've taken the time to choose their media.
I can certainly adjust the logic. The key is to keep the early check to avoid the initial "white screen" delay, but instead of calling the dialog, we'll simply pass a sliced list of the first 20 URIs to the file handling function.
Solution for thes : Truncate and Notify
- In
receiveExternalSharedItems(), we'll still check thefileCountearly. - If
fileCount > MAX_UPLOAD_COUNT(20), we truncate the list of URIs to the first 20 items. - We then proceed with the heavy file processing, but only for the first 20 files.
- After the upload activity fully loads, we'll show a non-blocking toast/snackbar notification to the user, informing them that only the first 20 files were loaded. This provides feedback without stopping their workflow.
I will implement this truncation logic now and update the PR. Thanks for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the required chanegs and updated the branch
|
(first step of review: I just confirmed that currently the non-custom picker lets users upload more than 20 pictures at once) |
RitikaPahwa4444
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how feasible it is but is it possible to batch load instead of truncating the list? Minor comment, otherwise :)
| const val FOLDER_NAME: String = "FolderName" | ||
| const val ITEM_ID: String = "ItemId" | ||
| const val EXTRA_SINGLE_SELECTION: String = "EXTRA_SINGLE_SELECTION" | ||
| const val MAX_UPLOAD_COUNT: Int = 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a part of the custom selector activity if we're extending this logic to other activities as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a part of the custom selector activity if we're extending this logic to other activities as well?
I feel centralizing the the upload limit constant by placing it in the constants.kt would be better
|
✅ Generated APK variants! |
what i feel is that, implementing batch loading for the file URIs would be ideal for very large selections (e.g: 50+ files or smtg) to avoid memory issues during the initial load. For this issue, the truncation approach is the safest, least intrusive, and most immediate fix to address the usability issue, as it keeps the existing API intact. I recommend sticking with truncation : ) |
Which issue? Could you please link it in the PR description? Let's raise another one to explore that possibility. |
|
Batch upload would be really complex to implement and maintain. My opinion is that truncating is good enough for now. I would make sure to show a popup explaining to the user that there it a 20 limit for performance reasons and that their selection is being truncated to 20, though. In the future, rather than a batch of multi-uploads, I would recommend storing all of the multi-upload's data (images and metadata) in database. That would solve the root problem (large multiuploads being unreliable because they take too much memory). |
d88acef to
3a51578
Compare
|
@Kota-Jagadeesh why are we closing the PRs? |
There are some merge conflicts. So, I just reverted the changes, the PR will be opened within an hour. |
What changes did you make and why?
This PR addresses an issue where sharing more files than the allowed limit (currently 20) via an external application (like a gallery) caused an unnecessary delay and poor user experience before blocking the upload.
Changes Made
MAX_UPLOAD_COUNT = 20) inCustomSelectorActivity.ktto a sharedcompanion objectconstant for reuse across the app.UploadActivity.kt): Implemented an immediate file count check withinreceiveExternalSharedItems(). This check accesses the file count directly from the incomingIntent's URI list, allowing the app to:contributionController.handleExternalImagesPicked) for oversized selections, eliminating the previous "white screen" delay.Testing Instructions
Tests performed (required)
Screenshots:
