Skip to content

Drop AndroidCompatTimeZoneRegistry#233

Merged
rfc2822 merged 9 commits intoical4j-3to4from
198-ical4j-4x-update-drop-androidcompattimezoneregistry
Mar 17, 2026
Merged

Drop AndroidCompatTimeZoneRegistry#233
rfc2822 merged 9 commits intoical4j-3to4from
198-ical4j-4x-update-drop-androidcompattimezoneregistry

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Mar 16, 2026

  • Remove AndroidCompatTimeZoneRegistry and related test files
  • Move VTIMEZONE minification into separate class + some tests
  • ICalenderGenerator now preserves original Android timezone IDs when adding VTIMEZONEs (this was previously the reason why AndroidCompatTimeZoneRegistry existed)

PR looks bigger than it is because it moves VTIMEZONE minification around (with little changes).

rfc2822 added 7 commits March 16, 2026 12:37
- Rename `usedTimeZones` to `usedTimezoneIds` and change type from `Set<ZoneId>` to `Set<String>`
- Update `timeZonesOf()` to extract TZID parameters instead of ZoneId from ZonedDateTime
- Add recursive processing of subcomponents in `timeZonesOf()`
- Add TODO comments for future improvements
- Remove unused `toZonedDateTime()` helper function
- Update imports and add `@VisibleForTesting` annotation
- Add TODO comment in test file for missing tests
- Delete AndroidCompatTimeZoneRegistry implementation and factory
- Remove AndroidCompatTimeZoneRegistryTest and Ical4jConfigurationTest
- Update ical4j.properties to remove custom timezone registry
- Remove ProGuard rules for AndroidCompatTimeZoneRegistry
- Add test case for Europe/Kiev timezone handling
- Ensure VTIMEZONE TZID matches original Android timezone ID
- Add logging for timezone ID mismatches between Android and ical4j
- Update imports and add logger to ICalendarGenerator
- Add `copyVTimeZone` method to safely modify VTIMEZONE without affecting registry cache
- Replace direct timezone modification with copy-based approach
- Add test for `copyVTimeZone` to verify property list and observances isolation
- Update timezone ID replacement test to use regex pattern matching
- Add imports for new functionality
- Implement tests for extracting TZIDs from date properties
- Add test for empty result when no TZIDs present
- Include test for TZID extraction from subcomponents
- Add test for empty component case
- Remove unused helper function `toZonedDateTime`
- Introduce new `VTimeZoneMinifier` class with dedicated minification logic
- Move `minifyVTimeZone` method from `ICalendar` to new class
- Add comprehensive tests for `VTimeZoneMinifier` functionality
- Remove now redundant test cases from `ICalendarTest`
- Clean up imports and unused helper functions
- Rename `minifyVTimeZone` to `minify` and change parameter type from `ZonedDateTime?` to `Temporal?`
- Add `asZonedDateTime` helper function to convert various Temporal types to ZonedDateTime
- Update all test cases to use new method name and handle nullable start time
- Fix typo in test comment
- Integrate minifier into ICalendarGenerator
@rfc2822 rfc2822 linked an issue Mar 16, 2026 that may be closed by this pull request
@rfc2822 rfc2822 self-assigned this Mar 16, 2026
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Mar 16, 2026
@rfc2822 rfc2822 changed the base branch from main to ical4j-3to4 March 16, 2026 14:12
@rfc2822 rfc2822 requested a review from Copilot March 16, 2026 14:16
Copy link
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

This PR removes the AndroidCompatTimeZoneRegistry integration and moves timezone minification logic into a dedicated VTimeZoneMinifier, wiring it into ICalendarGenerator while adding/adjusting tests to validate timezone handling (including TZID alias preservation like Europe/Kiev).

Changes:

  • Removed AndroidCompatTimeZoneRegistry (and configuration/tests/proguard rules referencing it).
  • Added VTimeZoneMinifier and migrated minification behavior out of ICalendar.
  • Updated ICalendarGenerator to collect TZIDs from properties, preserve original Android TZIDs when ical4j resolves an alias, and added tests for copyVTimeZone and timeZonesOf.

Reviewed changes

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

Show a summary per file
File Description
lib/src/test/kotlin/at/bitfire/synctools/icalendar/VTimeZoneMinifierTest.kt New unit tests covering VTIMEZONE minification behavior across several zones.
lib/src/test/kotlin/at/bitfire/synctools/icalendar/ICalendarGeneratorTest.kt Adds tests for TZID alias preservation, VTIMEZONE copying safety, and timeZonesOf.
lib/src/test/kotlin/at/bitfire/ical4android/Ical4jConfigurationTest.kt Removes test that asserted the custom registry factory was configured.
lib/src/test/kotlin/at/bitfire/ical4android/ICalendarTest.kt Removes timezone-minification tests that previously exercised ICalendar.minifyVTimeZone.
lib/src/main/resources/ical4j.properties Stops configuring ical4j to use AndroidCompatTimeZoneRegistry.
lib/src/main/kotlin/at/bitfire/synctools/icalendar/VTimeZoneMinifier.kt Introduces standalone VTIMEZONE minification supporting multiple Temporal types.
lib/src/main/kotlin/at/bitfire/synctools/icalendar/ICalendarGenerator.kt Integrates minifier, adds TZID alias preservation via copyVTimeZone, and implements timeZonesOf.
lib/src/main/kotlin/at/bitfire/ical4android/ICalendar.kt Removes minifyVTimeZone from ICalendar.Companion.
lib/src/main/kotlin/at/bitfire/ical4android/AndroidCompatTimeZoneRegistry.kt Deletes the registry wrapper implementation.
lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidCompatTimeZoneRegistryTest.kt Deletes instrumentation tests for the removed registry.
lib/consumer-rules.pro Removes keep rules for the removed registry classes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

rfc2822 added 2 commits March 16, 2026 15:34
- Enhance `minify` method to handle timezone conversion more robustly
- Add fallback to system default timezone when original TZID is invalid
- Remove redundant null checks and simplify logic flow
- Fix test function name formatting
- Update documentation to reflect parameter name changes
- Clean up code comments and remove outdated TODOs
- Add null safety for timezone registry lookups
- Improve error handling in timezone minification validation
-
@rfc2822 rfc2822 marked this pull request as ready for review March 16, 2026 14:48
@rfc2822 rfc2822 requested a review from sunkup March 16, 2026 14:49
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

Looks very good to me!

@rfc2822 rfc2822 merged commit d1b2d72 into ical4j-3to4 Mar 17, 2026
6 of 7 checks passed
@rfc2822 rfc2822 deleted the 198-ical4j-4x-update-drop-androidcompattimezoneregistry branch March 17, 2026 07:28
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.

[ical4j 4.x] Update / drop AndroidCompatTimeZoneRegistry

3 participants