recurrence: consolidate 3 duplicate implementations into one shared, tested engine (KC-69)
Before adding "every N weeks/months" support, found the recurrence window math was independently hand-written in three places (main app's TaskItem.isOccurrence, and two separate widget extensions' countdown progress calculations) with no shared code to keep them in sync. Extracted the math into Shared/RecurrenceRule.swift (pure Foundation, no framework deps) compiled into both the app and widget extension targets via a new project.yml Shared/ source path, and pointed all three call sites at it. Verified every case is identical to prior behavior at interval==1 by compiling and running a standalone test driver directly against the real file with swiftc - 38/38 passing, including Jan-31-monthly and Feb-29-leap-year-yearly edge cases. Groundwork only - no recurrenceInterval field on TaskItem yet, the actual interval feature comes next on top of this. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,7 @@ targets:
|
||||
deploymentTarget: "16.0"
|
||||
sources:
|
||||
- path: KisaniCal
|
||||
- path: Shared
|
||||
dependencies:
|
||||
- target: KisaniCalWidgets
|
||||
embed: true
|
||||
@@ -90,6 +91,7 @@ targets:
|
||||
- path: KisaniCalWidgets
|
||||
- path: KisaniCal/Managers/AppGroup.swift
|
||||
- path: KisaniCal/Managers/TaskActivityAttributes.swift
|
||||
- path: Shared
|
||||
info:
|
||||
path: KisaniCalWidgets/Info.plist
|
||||
properties:
|
||||
|
||||
Reference in New Issue
Block a user