Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for event permissions returning false in iOS17+ #578

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ios/Classes/SwiftDeviceCalendarPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import Flutter
import Foundation
import UIKit

class EventStoreManager: ObservableObject {
static let shared = EventStoreManager()
let eventStore: EKEventStore
private init() {
eventStore = EKEventStore()
}
}

extension Date {
var millisecondsSinceEpoch: Double { return self.timeIntervalSince1970 * 1000.0 }
}
Expand Down Expand Up @@ -102,7 +110,7 @@ public class SwiftDeviceCalendarPlugin: NSObject, FlutterPlugin, EKEventViewDele
let calendarNotFoundErrorMessageFormat = "The calendar with the ID %@ could not be found"
let calendarReadOnlyErrorMessageFormat = "Calendar with ID %@ is read-only"
let eventNotFoundErrorMessageFormat = "The event with the ID %@ could not be found"
let eventStore = EKEventStore()
let eventStore = EventStoreManager.shared.eventStore
let requestPermissionsMethod = "requestPermissions"
let hasPermissionsMethod = "hasPermissions"
let retrieveCalendarsMethod = "retrieveCalendars"
Expand Down Expand Up @@ -1169,3 +1177,4 @@ extension UIColor {
}

}

Loading