Migrate to synctools library for iCalendar handling#2348
Open
patrickunterwegs wants to merge 3 commits into
Open
Migrate to synctools library for iCalendar handling#2348patrickunterwegs wants to merge 3 commits into
patrickunterwegs wants to merge 3 commits into
Conversation
The davx5-ose synctools submodule replaced the former fat JtxICalObject / JtxCollection<T> classes with an Entity + builder/handler design and moved the packages from at.bitfire.ical4android to at.bitfire.synctools. Rewrite the ICS import/export helpers accordingly, mirroring DAVx5's own JtxSyncManager usage: - Look up collections via JtxCollectionProvider.getCollection(). - Export: map jtx objects (main + recurrence exceptions) to VJOURNAL/VTODO with JtxObjectHandler + AndroidAttachmentFetcher, then build and output a single VCALENDAR via ical4j. - Import: parse with ICalendarParser, group components by UID with CalendarUidSplitter, build entities with JtxObjectBuilder, mark them dirty and insert via JtxRecurringCollection; keep UID/sequence de-duplication against existing entries. - Drop the obsolete LocalJtxICalObject / LocalJtxCollection subclasses. - Acquire and close the content provider client per call. Also point ICalObject.kt's TimeApiExtensions.toLocalDate import at the new at.bitfire.synctools.util package. The in-file duplicate-UID import test now expects 0 skipped, because CalendarUidSplitter already collapses same-UID/same-RECURRENCE-ID components during parsing (per RFC 5545); DB-level skipping on re-import is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEizQuqZkmoSJf6saEPDH
The jitpack artifact com.github.bitfireat.davx5-ose:synctools:v4.5.17.1-ose does not resolve (jitpack can't build/serve the davx5-ose multi-module project), which fails the build before any source compiles. Consume synctools from source instead: - Add davx5-ose as a Git submodule pinned to tag v4.5.17.1-ose. - Include it as a Gradle composite build in settings.gradle.kts, with an explicit dependencySubstitution mapping the version-catalog coordinate (libs.synctools) to the local :synctools project. The explicit target keeps only :synctools and davx5-ose's build-logic configured, not :app-ose/:core. jtxBoard and davx5-ose v4.5.17.1-ose are version-aligned (Gradle 9.6.1, AGP 9.2.1, Kotlin 2.4.0, KSP 2.3.9, Java toolchain 21), synctools' own dependencies come from Maven Central/Google, and all CI workflows already check out submodules, so no workflow changes are needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEizQuqZkmoSJf6saEPDH
The synctools library requires the desugar_jdk_libs_nio core-library desugaring flavor (java.nio support), so :app:checkOseDebugAarMetadata failed with the base desugar_jdk_libs variant. Switch to the _nio artifact (same version 2.1.5, a superset), matching davx5-ose's own configuration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEizQuqZkmoSJf6saEPDH
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
Refactored
Ical4androidUtilto use the new synctools library for iCalendar parsing, object mapping, and storage operations, replacing the previous ical4android-based implementation.Key Changes
Updated imports: Replaced ical4android imports with synctools equivalents (
ICalendarParser,CalendarUidSplitter,JtxObjectBuilder,JtxObjectHandler, etc.)Refactored
getICSFormatForCollectionFromProvider():JtxCollectionProviderandJtxObjectHandlerfor mapping objects to iCalendar componentsRefactored
writeICSFormatFromProviderToOS():componentsForObject()helper methodJtxObjectHandlerfor consistent component mappingRefactored
insertFromReader():JtxICalObject.fromReader()withICalendarParserandCalendarUidSplitterJtxObjectBuilderto construct jtx objects from parsed componentsJtxRecurringCollectionfor proper insertion of objects with exceptionsAdded helper methods:
jtxObjectHandler(): Creates a configuredJtxObjectHandlerwith attachment fetchingcomponentsForObject(): Maps a main jtx object and its exceptions to iCalendar componentsbuildCalendar(): Constructs a Calendar object from componentswriteComponents(): Overloaded methods to write components to OutputStream or WriterRemoved legacy classes: Deleted
LocalJtxICalObjectandLocalJtxCollectionwrapper classes (now handled by synctools)Updated test expectations: Adjusted
Ical4androidUtilTestto reflect that synctools'CalendarUidSplittermerges duplicate components with the same UID during parsingImplementation Details
JtxObjectHandlerfor consistency across export operationshttps://claude.ai/code/session_011JEizQuqZkmoSJf6saEPDH