|
26 | 26 | var rawValue: UNAuthorizationOptions |
27 | 27 |
|
28 | 28 | var customDumpDescription: String { |
| 29 | + switch self.rawValue { |
| 30 | + case .alert: |
| 31 | + return "UNAuthorizationOptions.alert" |
29 | 32 | #if os(iOS) || os(watchOS) |
30 | | - if #available(iOS 13, watchOS 6, *), self.rawValue == .announcement { |
| 33 | + case .announcement: |
31 | 34 | return "UNAuthorizationOptions.announcement" |
32 | | - } |
33 | 35 | #endif |
34 | | - if #available(iOS 12, tvOS 12, watchOS 5, *) { |
35 | | - switch self.rawValue { |
36 | | - case .alert: |
37 | | - return "UNAuthorizationOptions.alert" |
38 | | - case .badge: |
39 | | - return "UNAuthorizationOptions.badge" |
40 | | - case .carPlay: |
41 | | - return "UNAuthorizationOptions.carPlay" |
42 | | - case .criticalAlert: |
43 | | - return "UNAuthorizationOptions.criticalAlert" |
44 | | - case .providesAppNotificationSettings: |
45 | | - return "UNAuthorizationOptions.providesAppNotificationSettings" |
46 | | - case .provisional: |
47 | | - return "UNAuthorizationOptions.provisional" |
48 | | - case .sound: |
49 | | - return "UNAuthorizationOptions.sound" |
50 | | - default: |
51 | | - return "UNAuthorizationOptions(rawValue: \(self.rawValue))" |
52 | | - } |
53 | | - } else { |
54 | | - switch self.rawValue { |
55 | | - case .alert: |
56 | | - return "UNAuthorizationOptions.alert" |
57 | | - case .badge: |
58 | | - return "UNAuthorizationOptions.badge" |
59 | | - case .carPlay: |
60 | | - return "UNAuthorizationOptions.carPlay" |
61 | | - case .sound: |
62 | | - return "UNAuthorizationOptions.sound" |
63 | | - default: |
64 | | - return "UNAuthorizationOptions(rawValue: \(self.rawValue))" |
65 | | - } |
| 36 | + case .badge: |
| 37 | + return "UNAuthorizationOptions.badge" |
| 38 | + case .carPlay: |
| 39 | + return "UNAuthorizationOptions.carPlay" |
| 40 | + case .criticalAlert: |
| 41 | + return "UNAuthorizationOptions.criticalAlert" |
| 42 | + case .providesAppNotificationSettings: |
| 43 | + return "UNAuthorizationOptions.providesAppNotificationSettings" |
| 44 | + case .provisional: |
| 45 | + return "UNAuthorizationOptions.provisional" |
| 46 | + case .sound: |
| 47 | + return "UNAuthorizationOptions.sound" |
| 48 | + default: |
| 49 | + return "UNAuthorizationOptions(rawValue: \(self.rawValue))" |
66 | 50 | } |
67 | 51 | } |
68 | 52 | } |
|
72 | 56 | var allCases: [UNAuthorizationOptions] = [ |
73 | 57 | .alert |
74 | 58 | ] |
75 | | - self.append_iOS_13_watchOS_6(&allCases) |
76 | | - self.append_iOS_12_tvOS_12_watchOS_5(&allCases) |
| 59 | + #if os(iOS) || os(watchOS) |
| 60 | + allCases.append(.announcement) |
| 61 | + #endif |
| 62 | + allCases.append(contentsOf: [ |
| 63 | + .badge, |
| 64 | + .carPlay, |
| 65 | + .criticalAlert, |
| 66 | + .providesAppNotificationSettings, |
| 67 | + .provisional, |
| 68 | + .sound, |
| 69 | + ]) |
77 | 70 | for option in allCases { |
78 | 71 | if options.contains(option) { |
79 | 72 | children.append(.init(rawValue: option)) |
|
90 | 83 | displayStyle: .set |
91 | 84 | ) |
92 | 85 | } |
93 | | - |
94 | | - // NB: Workaround for Xcode 13.2's new, experimental build system. (Fixed in Xcode 13.3.) |
95 | | - // |
96 | | - // defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 |
97 | | - private func append_iOS_13_watchOS_6(_ allCases: inout [UNAuthorizationOptions]) { |
98 | | - #if os(iOS) || os(watchOS) |
99 | | - if #available(iOS 13, watchOS 6, *) { |
100 | | - allCases.append(.announcement) |
101 | | - } |
102 | | - #endif |
103 | | - } |
104 | | - |
105 | | - // NB: Workaround for Xcode 13.2's new, experimental build system. (Fixed in Xcode 13.3.) |
106 | | - // |
107 | | - // defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 |
108 | | - private func append_iOS_12_tvOS_12_watchOS_5(_ allCases: inout [UNAuthorizationOptions]) { |
109 | | - if #available(iOS 12, tvOS 12, watchOS 5, *) { |
110 | | - allCases.append(contentsOf: [ |
111 | | - .badge, |
112 | | - .carPlay, |
113 | | - .criticalAlert, |
114 | | - .providesAppNotificationSettings, |
115 | | - .provisional, |
116 | | - .sound, |
117 | | - ]) |
118 | | - } |
119 | | - } |
120 | 86 | } |
121 | 87 |
|
122 | 88 | @available(iOS 10, macOS 10.14, tvOS 10, watchOS 3, *) |
|
207 | 173 | ) |
208 | 174 | } |
209 | 175 |
|
210 | | - // NB: Workaround for Xcode 13.2's new, experimental build system. (Fixed in Xcode 13.3.) |
| 176 | + // NB: Workaround for Xcode 13.2's new, experimental build system. |
211 | 177 | // |
212 | 178 | // defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 |
213 | 179 | private func appendBannerList(_ allCases: inout [UNNotificationPresentationOptions]) { |
|
0 commit comments