Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jul 8, 2025

Closes #35.

With this the tests of #32 seem to work fine.

@rfc2822 rfc2822 self-assigned this Jul 8, 2025
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Jul 8, 2025
@rfc2822 rfc2822 marked this pull request as ready for review July 8, 2025 14:16
@rfc2822 rfc2822 requested a review from Copilot July 8, 2025 14:26
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 global TimeZoneRegistry usage and deprecated DateUtils.ical4jTimeZone calls by introducing explicit TimeZoneRegistryFactory.getInstance().createRegistry() usage and passing registries into key functions.

  • Replaced global DateUtils.ical4jTimeZone lookups with TimeZoneRegistry.getTimeZone(...) calls.
  • Updated APIs (e.g., toIcal4jDateTime, androidifyTimeZone, androidStringToRecurrenceSet) to accept a TimeZoneRegistry parameter.
  • Removed deprecated registry helpers and updated all affected tests.

Reviewed Changes

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

Show a summary per file
File Description
EventValidatorTest.kt Fixed extension-call syntax and removed unused import
TimeApiExtensions.kt Added tzRegistry parameter to toIcal4jDateTime
DateUtils.kt Removed global registry and ical4jTimeZone helper
AndroidTimeUtils.kt Updated timezone helpers to require TimeZoneRegistry
Multiple *.kt (main & tests) Replaced DateUtils.ical4jTimeZone imports/calls with registry
Comments suppressed due to low confidence (4)

lib/src/main/kotlin/at/bitfire/synctools/icalendar/ICalendarParser.kt:36

  • The KDoc lists a tzRegistry parameter but the parse function signature only accepts reader; please update or remove the outdated @param tzRegistry tag to match the actual signature.
     * @param tzRegistry    time zone registry where VTIMEZONE definitions of the iCalendar will be put

lib/src/main/kotlin/at/bitfire/ical4android/util/AndroidTimeUtils.kt:89

  • [nitpick] Defining a new TimeZoneRegistry inside this function on each call can lead to repetitive instantiation; consider passing a shared tzRegistry into the helper or hoisting it to the object scope to reduce duplication.
        val tzRegistry by lazy { TimeZoneRegistryFactory.getInstance().createRegistry() }

lib/src/main/kotlin/at/bitfire/ical4android/util/DateUtils.kt:110

  • The parseVTimeZone builder no longer receives a TimeZoneRegistry, which may prevent VTIMEZONE definitions from resolving correctly; restore CalendarBuilder(tzRegistry) or inject a registry instance.
        val builder = CalendarBuilder()

lib/src/main/kotlin/at/bitfire/ical4android/DmfsTask.kt:77

  • [nitpick] A per-instance lazy registry works but each task subclass also directly calls createRegistry() elsewhere; consider centralizing registry creation (e.g., in a shared singleton) to avoid scattered instantiation.
    protected val tzRegistry by lazy { TimeZoneRegistryFactory.getInstance().createRegistry() }

@rfc2822 rfc2822 mentioned this pull request Jul 8, 2025
@rfc2822 rfc2822 requested review from sunkup and removed request for sunkup July 8, 2025 14:29
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 ok. I don't understand why we comment on duration = null instead of deleting it though?

@rfc2822 rfc2822 merged commit 50ec0b0 into main Jul 9, 2025
9 checks passed
@rfc2822 rfc2822 deleted the tz-registry branch July 9, 2025 09:56
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.

Various methods share a global ical4j tzRegistry

2 participants