Upload: preserve duplicate images in custom selector and add warning#6765
Upload: preserve duplicate images in custom selector and add warning#6765Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Conversation
Updated CustomSelectorActivity to prevent silent dropping of duplicate images. Added a warning dialog with a 'Review selection' option to improve UX and maintain parity with the normal selector.
|
✅ Generated APK variants! |
|
We should rather block duplicates from the normal selector as well. I don't think duplicate uploads are helpful. Just a warning that duplicate images would be dropped should suffice. |
|
Alright... @RitikaPahwa4444 that makes complete sense! Just to make sure we are fully aligned: you would like the custom selector to continue intentionally dropping the duplicates, but we should add a warning notifying the user that the duplicates were automatically removed, rather than it happening silently. I will update this PR to restore the dropping behavior and implement that warning! Regarding the normal selector: would you prefer I add the blocking/warning logic for the normal selector into this PR, or should we keep this PR scoped to the Custom Selector and track the normal selector update in a separate issue/PR? |
Fixes #6764
The Problem
In the custom selector flow, selecting duplicate content images (matching SHA1 hashes) silently reduced the number of images passed forward to the upload screen. This caused UX confusion because users would select N images but see fewer in the upload details. Additionally, if users realize they made a mistake, they needed an in place way to correct their selection without entirely leaving the selector flow.
The Solution & Justification
I updated the custom selector's completion flow to:
This approach is minimal and tightly scoped to the custom selector's done flow. It improves clarity, keeps the behavior explicit, and brings the custom selector's duplicate handling closer to parity with the normal selector.
Alternative Solutions Considered
I considered completely blocking the upload of duplicates directly from the selector. However, I discarded this because the normal selector currently permits duplicate selections, and blocking it here would create an inconsistent experience across the app. A non blocking warning dialog provides the safest, most informative UX.
Testing Performed
Compiled and ran the betaDebug variant successfully.
Passed targeted unit tests: :app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.customselector.ui.selector.CustomSelectorActivityTest"
Passed broader adapter tests: :app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.customselector.ui.selector." --tests "fr.free.nrw.commons.customselector.ui.adapter."
Manually verified that the duplicate warning is shown when identical images are selected.
Manually verified that tapping "Review selection" dismisses the dialog and retains the current selection state.
Manually verified that tapping "OK" proceeds to the upload details screen successfully.
Videos
Before :
Screen_Recording_20260318_082650_Commons.mp4
After :
Screen_Recording_20260319_135832_Commons.mp4