Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 7 additions & 17 deletions LoopFollow/Extensions/EKEventStore+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,16 @@
import EventKit
import Foundation

#if swift(>=5.9)
extension EKEventStore {
func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) {
if #available(iOS 17, *) {
requestFullAccessToEvents { granted, error in
completion(granted, error)
}
} else {
requestAccess(to: .event) { granted, error in
completion(granted, error)
}
extension EKEventStore {
func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) {
if #available(iOS 17, *) {
requestFullAccessToEvents { granted, error in
completion(granted, error)
}
}
}
#else
extension EKEventStore {
func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) {
} else {
requestAccess(to: .event) { granted, error in
completion(granted, error)
}
}
}
#endif
}
12 changes: 5 additions & 7 deletions LoopFollow/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ struct GeneralSettingsView: View {
Toggle("Snoozer emoji", isOn: $snoozerEmoji.value)
Toggle("Force portrait mode", isOn: $forcePortraitMode.value)
.onChange(of: forcePortraitMode.value) { _ in
if #available(iOS 16.0, *) {
let window = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.flatMap { $0.windows }
.first
let window = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.flatMap { $0.windows }
.first

window?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
}
window?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
}
}

Expand Down