Extract row handler code from AndroidContact.getContact()#426
Merged
Conversation
AndroidContact.getContact()
…dayWithOffset` to `ContactReaderTest`
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Android contacts raw-contact row processing by extracting read/write responsibilities out of AndroidContact.getContact() into dedicated mapping components, and relocates a couple of vCard-related tests into more appropriate unit-test suites.
Changes:
- Introduces
RawContactHandler(read/mapping) andRawContactBuilder(write/row building) to replace the former combinedContactProcessor. - Updates
AndroidContact/AndroidGroupto use a renamed contact cache field (cachedContact) and to delegate raw-contact mapping/building to the new classes. - Moves vCard-specific tests out of
AndroidContactTestintoContactReaderTest/ContactWriterTest, and adds an Android instrumentation test for “contact not found”.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/test/kotlin/at/bitfire/synctools/mapping/contacts/ContactWriterTest.kt | Adds a unit test for caret encoding behavior in ADR label parameter output. |
| lib/src/test/kotlin/at/bitfire/synctools/mapping/contacts/ContactReaderTest.kt | Adds a unit test for parsing vCard3 BDAY with a timezone offset. |
| lib/src/main/kotlin/at/bitfire/synctools/storage/contacts/AndroidGroup.kt | Renames cached contact field usage and adjusts caching logic/toString output. |
| lib/src/main/kotlin/at/bitfire/synctools/storage/contacts/AndroidContact.kt | Delegates raw-contact row handling/building to new classes and renames cache field. |
| lib/src/main/kotlin/at/bitfire/synctools/mapping/contacts/RawContactHandler.kt | New/updated class to centralize raw-contact and data-row parsing into Contact. |
| lib/src/main/kotlin/at/bitfire/synctools/mapping/contacts/RawContactBuilder.kt | New class to centralize building/inserting data rows for a raw contact. |
| lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/AndroidContactTest.kt | Removes vCard unit tests and adds an instrumentation test for missing contacts. |
…ilder` and `RawContactHandler` instances
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.
Preparation for #391. Related to bitfireAT/davx5-ose#2243.
AndroidContact.getContact()now callsRawContactHandlerinstead of mapping itselfAndroidContact/AndroidGroup: rename_contacttocachedContactwithout changing logicContactProcessoris split intoRawContactHandlerandRawContactBuilder(same naming scheme as for events)AndroidContactTestthat actually don't testAndroidContactto where they belong