Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jul 9, 2025

Move the remaining AndroidEvent companion object methods to AndroidCalendar so that the way is free for refactoring the actual event data access.

@rfc2822 rfc2822 self-assigned this Jul 9, 2025
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Jul 9, 2025
@rfc2822 rfc2822 requested a review from Copilot July 9, 2025 12:34
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 relocates AndroidEvent companion object methods into AndroidCalendar, cleans up related imports, and updates tests to use the new API.

  • Moved numDirectInstances, numInstances, and deletion helper from AndroidEvent companion into AndroidCalendar
  • Added updateEvent in AndroidCalendar for row updates
  • Refactored tests and InitCalendarProviderRule to call calendar.numInstances(...) and removed deprecated companion tests

Reviewed Changes

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

Show a summary per file
File Description
lib/src/main/kotlin/at/bitfire/synctools/test/InitCalendarProviderRule.kt Replaced AndroidEvent.numInstances calls with calendar.numInstances, removed unused import
lib/src/main/kotlin/at/bitfire/synctools/storage/calendar/AndroidCalendar.kt Added updateEvent, numDirectInstances, and numInstances methods for event-instance logic
lib/src/main/kotlin/at/bitfire/ical4android/AndroidEvent.kt Removed companion object methods (markAsDeleted, instance counters) and related imports
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/calendar/AndroidCalendarTest.kt Expanded tests for direct/total instance counts, adjusted assertions for Android version differences
lib/src/androidTest/kotlin/at/bitfire/ical4android/impl/TestCalendar.kt Added withColors parameter to findOrCreate to control color provisioning
lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidEventTest.kt Updated to use TestCalendar.findOrCreate(..., withColors = true) and removed companion-based tests
Comments suppressed due to low confidence (1)

lib/src/main/kotlin/at/bitfire/synctools/storage/calendar/AndroidCalendar.kt:192

  • Typo in comment: change "occurence" to "occurrence" for correct spelling.
        // if this event doesn't have a last occurrence, it's endless and always has instances

@rfc2822 rfc2822 force-pushed the androidevent-companion2 branch from bb2a273 to c54fafe Compare July 9, 2025 13:03
@rfc2822 rfc2822 marked this pull request as ready for review July 9, 2025 13:10
@rfc2822 rfc2822 requested a review from sunkup July 9, 2025 13:16
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.

Yes 👍

@rfc2822 rfc2822 merged commit 2bef0ee into main Jul 9, 2025
9 checks passed
@rfc2822 rfc2822 deleted the androidevent-companion2 branch July 9, 2025 13:45
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.

2 participants