Repository navigation
feat(data): add batch deletes for a highlight color and a collection - #386
Merged
Merged
Conversation
QuranDataService gains deleteHighlights(color) and removeAllAyahBookmarksFromCollection(collectionId). Each clears a color or empties a collection, Favorites included, in one transaction and triggers sync once, only when something was removed. The collection itself is kept. The removed rows are the same ones the single deletes would remove, so they sync as the same COLLECTION_BOOKMARK deletes. Store tests and the HL-10, BMK-23 and BMK-24 scenarios check this against N single deletes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two batch deletes to
QuranDataServicefor the iOS "Delete All" actions on a highlight color page and a collection page (quran/quran-ios#1274, quran/quran-ios#1275):deleteHighlights(color: AyahHighlightColor): Intclears every verse's highlight of that color. It leaves other colors and the verses' Favorites and user collection memberships alone, and keeps the color's collection.removeAllAyahBookmarksFromCollection(collectionId: String): Intempties a collection and keeps it.addAyahBookmarkToCollectionrejects it (IllegalArgumentException).How both behave:
CollectionStore, and triggers sync once, only when something was removed.Verses.exists). Those are the same rows single deletes can reach and the app can show. An invalid stored verse is kept and not counted, so Delete All never pushes a DELETE the server would reject with 422.COLLECTION_BOOKMARKDELETEs that N single deletes would send.sync-v2'sVersesbecomes public sopersistencecan use the same verse check push validation uses.sync-v2still isn't exported throughumbrella.Today iOS loops over
deleteHighlight/removeAyahBookmarkFromCollection: N transactions, N sync triggers, N observer emissions, and a partial clear if one fails. That loop also has to read the current highlights first so it doesn't delete a highlight sync has since recolored. A color-scoped delete makes that read unnecessary.Tests
pending(),held()and stored rows, including a never-pushed membership and a heldINVALID_VERSEcreate.QuranDataServiceLifecycleTest: sync is triggered only when the count is above 0../gradlew :persistence:allTests :sync-pipelines:jvmTestand./gradlew :umbrella:assembleSharedXCFrameworkpass locally. The branch was rebased onto main after that run, onto #385, so CI is the check on the current base.The Swift wrappers follow in mobile-sync-spm once this is released.
🤖 Generated with Claude Code