Skip to content

Add JtxCollectionProvider and JtxCollection#380

Open
sunkup wants to merge 2 commits into
mainfrom
379-add-jtxcollectionprovider-that-manages-crud-the-collections
Open

Add JtxCollectionProvider and JtxCollection#380
sunkup wants to merge 2 commits into
mainfrom
379-add-jtxcollectionprovider-that-manages-crud-the-collections

Conversation

@sunkup
Copy link
Copy Markdown
Member

@sunkup sunkup commented May 13, 2026

Add JtxCollectionProvider + tests and basic JtxCollection as needed for CRUD operations of JtxCollectionProvider.

@sunkup sunkup self-assigned this May 13, 2026
@sunkup sunkup added the refactoring Quality improvement of existing functions label May 13, 2026
@sunkup sunkup requested a review from Copilot May 13, 2026 13:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated JtxCollectionProvider API (plus a lightweight JtxCollection model) to perform CRUD and sync-state operations against the jtx Board content provider, along with instrumentation tests validating the provider behavior.

Changes:

  • Introduces JtxCollectionProvider with create/query/update/delete and sync-state helpers for jtx collections.
  • Adds JtxCollection wrapper class to represent a single jtx collection and provide convenience update/delete shortcuts.
  • Adds JtxCollectionProviderTest instrumentation tests covering CRUD and sync-state read/write.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lib/src/main/kotlin/at/bitfire/synctools/storage/jtx/JtxCollectionProvider.kt New provider wrapper around jtx Board collection CRUD + sync-state access.
lib/src/main/kotlin/at/bitfire/synctools/storage/jtx/JtxCollection.kt New collection model exposing key fields and update/delete shortcuts.
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/jtx/JtxCollectionProviderTest.kt Instrumentation tests for provider CRUD and sync-state behavior.
Comments suppressed due to low confidence (1)

lib/src/main/kotlin/at/bitfire/synctools/storage/jtx/JtxCollection.kt:68

  • issue (blocking): Boolean fields may be parsed incorrectly when provider stores them as "1"/"0" strings.

Same as above for supportsVJournal and readonly: getAsBoolean() will not treat the string "1" as true. Use a conversion that accepts both numeric (0/1) and textual (true/false) representations to match existing jtx handling in the codebase.

    /** see [JtxContract.JtxCollection.SUPPORTSVJOURNAL] */
    val supportsVJournal: Boolean
        get() = values.getAsBoolean(JtxContract.JtxCollection.SUPPORTSVJOURNAL) ?: false

    /** see [JtxContract.JtxCollection.SYNC_ID] */
    val syncId: Long?
        get() = values.getAsLong(JtxContract.JtxCollection.SYNC_ID)

    /** see [JtxContract.JtxCollection.READONLY] */
    val readonly: Boolean
        get() = values.getAsBoolean(JtxContract.JtxCollection.READONLY) ?: false

Comment thread lib/src/main/kotlin/at/bitfire/synctools/storage/jtx/JtxCollection.kt Outdated
@sunkup sunkup requested a review from ArnyminerZ May 13, 2026 13:21
Copy link
Copy Markdown
Contributor

@cketti cketti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add JtxCollectionProvider that manages (CRUD) the JtxCollection collections

3 participants