feat(deckpicker): improve collection file too large dialog - #22164
Ranjan-3105 wants to merge 3 commits into
Conversation
# Conflicts: # AnkiDroid/src/main/java/com/ichi2/anki/dialogs/SyncErrorDialog.kt
|
First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible. |
fa15194 to
f3342ba
Compare
|
Snapshot diff report vs
All 1 changed screenshotsCollectionTooLargeScreenshotTest
|
|
Ahhh! The test was passing "150 MB (uncompressed)" to syncUploadTooLarge(), while the string itself already appends (uncompressed). I'll change the test input to "150 MB" and regenerate the screenshot. |
| ) | ||
| assertEquals( | ||
| getString(R.string.dialog_ok), | ||
| dialog.getButton(DialogInterface.BUTTON_POSITIVE).text, |
There was a problem hiding this comment.
We should have extensions, such asdialog.positiveButton
| dialog.getButton(DialogInterface.BUTTON_POSITIVE).text, | ||
| ) | ||
| assertEquals( | ||
| CollectionManager.TR.sentenceCase.checkDatabase, |
| @Test | ||
| fun `collection too large dialog`() = | ||
| withDeckPicker(deckCount = 0) { deckPicker -> | ||
| val message = CollectionManager.TR.syncUploadTooLarge("150 MB (uncompressed)") |
david-allison
left a comment
There was a problem hiding this comment.
The comparison fails for: [Catalan, Esperanto, French, Japanese, Odia, Uyghur, Yiddish]
{details} is on the first line.
Could you add a regression test for one of these languages and fix the logic.
|
Hey David, I traced the issue to I’m looking at the cleanest way to fix this and add a regression test for one of those locales. Is there any existing translation/helper pattern in AnkiDroid that you’d prefer me to use for matching translations with arguments, or should I handle the placeholder explicitly here? |
|
I think this one will be unique. You already made |



Purpose / Description
When a collection is too large to be uploaded to AnkiWeb, the current sync error doesn't give the user an obvious next step.
This change improves that error dialog by adding a
Check Databaseaction.OKremains the primary action, whileCheck Databaseis available as a secondary option to help users reduce the collection size.Fixes
Approach
The backend already returns a specific error message when the collection is too large to upload, so there was no need to add any new size checking on the Android side.
I added handling for this specific sync error and route it to a dedicated dialog. The error message is kept as-is, while the dialog provides
OKas the primary action andCheck Databaseas the secondary action.I followed the existing handling for the clock-off sync error as the pattern for identifying and displaying the specific sync error.
How Has This Been Tested?
I added a unit test covering the large collection sync error and checking that:
OKis the primary actionCheck Databaseis the secondary actionI also added a Roborazzi screenshot test for the new dialog and generated the corresponding screenshot baseline.
The relevant tests were run using the PlayDebug test configuration with Robolectric.
Learning (optional, can help others)
While working on this, I traced the sync error from the backend through
BackendSyncExceptionto the Android sync error dialog.I used the existing clock-off sync error handling as a reference for handling a specific backend sync error without changing the generic sync error flow.
Checklist