|
29 | 29 | switch self.rawValue { |
30 | 30 | case .alert: |
31 | 31 | return "UNAuthorizationOptions.alert" |
32 | | - #if (os(iOS) || os(watchOS)) && (swift(<5.9) || !canImport(CompositorServices)) |
| 32 | + #if os(iOS) || os(watchOS) |
33 | 33 | case .announcement: |
34 | 34 | return "UNAuthorizationOptions.announcement" |
35 | 35 | #endif |
|
56 | 56 | var allCases: [UNAuthorizationOptions] = [ |
57 | 57 | .alert |
58 | 58 | ] |
59 | | - #if (os(iOS) || os(watchOS)) && (swift(<5.9) || !canImport(CompositorServices)) |
| 59 | + #if os(iOS) || os(watchOS) |
60 | 60 | allCases.append(.announcement) |
61 | 61 | #endif |
62 | 62 | allCases.append(contentsOf: [ |
|
132 | 132 | struct Option: CustomDumpStringConvertible { |
133 | 133 | var rawValue: UNNotificationPresentationOptions |
134 | 134 | var customDumpDescription: String { |
135 | | - #if swift(<5.9) || !canImport(CompositorServices) |
136 | | - if self.rawValue == .alert { |
137 | | - return "UNNotificationPresentationOptions.alert" |
138 | | - } |
139 | | - #endif |
| 135 | + if self.rawValue == .alert { |
| 136 | + return "UNNotificationPresentationOptions.alert" |
| 137 | + } |
140 | 138 | if self.rawValue == .badge { |
141 | 139 | return "UNNotificationPresentationOptions.badge" |
142 | 140 | } |
|
155 | 153 |
|
156 | 154 | var options = self |
157 | 155 | var children: [Option] = [] |
158 | | - var allCases: [UNNotificationPresentationOptions] = [] |
159 | | - appendBannerList(&allCases) |
| 156 | + var allCases: [UNNotificationPresentationOptions] = [.alert, .badge] |
| 157 | + if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) { |
| 158 | + allCases.append(contentsOf: [.banner, .list]) |
| 159 | + } |
160 | 160 | allCases.append(.sound) |
161 | 161 | for option in allCases { |
162 | 162 | if options.contains(option) { |
|
174 | 174 | displayStyle: .set |
175 | 175 | ) |
176 | 176 | } |
177 | | - |
178 | | - // NB: Workaround for Xcode 13.2's new, experimental build system. |
179 | | - // |
180 | | - // defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 |
181 | | - private func appendBannerList(_ allCases: inout [UNNotificationPresentationOptions]) { |
182 | | - #if swift(<5.9) || !canImport(CompositorServices) |
183 | | - allCases.append(.alert) |
184 | | - #endif |
185 | | - allCases.append(.badge) |
186 | | - if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) { |
187 | | - allCases.append(contentsOf: [.banner, .list]) |
188 | | - } |
189 | | - } |
190 | 177 | } |
191 | 178 |
|
192 | 179 | @available(iOS 10, macOS 10.14, tvOS 10, watchOS 3, *) |
|
0 commit comments