mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +00:00
BugFix: Reminder Memory Leak
This commit is contained in:
parent
4e0659d4cc
commit
39673e9130
8 changed files with 401 additions and 456 deletions
|
|
@ -15,6 +15,7 @@ protocol CalendarServiceProviding {
|
|||
func requestAccess(to type: EKEntityType) async -> Bool
|
||||
func calendars() async -> [CalendarModel]
|
||||
func events(from start: Date, to end: Date, calendars: [String]) async -> [EventModel]
|
||||
func setReminderCompleted(reminderID: String, completed: Bool) async
|
||||
}
|
||||
|
||||
class CalendarService: CalendarServiceProviding {
|
||||
|
|
@ -122,6 +123,17 @@ class CalendarService: CalendarServiceProviding {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func setReminderCompleted(reminderID: String, completed: Bool) async {
|
||||
guard let reminder = store.calendarItem(withIdentifier: reminderID) as? EKReminder else { return }
|
||||
reminder.isCompleted = completed
|
||||
do {
|
||||
try store.save(reminder, commit: true)
|
||||
} catch {
|
||||
print("Failed to update reminder completion: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Model Extensions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue