@@ -197,26 +197,6 @@ void NotifyListenerSet(Listener* listener) {
197
197
id appDelegate = [UIApplication sharedApplication ];
198
198
199
199
#if FIREBASE_PLATFORM_IOS || FIREBASE_PLATFORM_TVOS
200
- // Register for remote notifications. Both codepaths result in
201
- // application:didRegisterForRemoteNotificationsWithDeviceToken: being called when they
202
- // complete, or application:didFailToRegisterForRemoteNotificationsWithError: if there was an
203
- // error. We complete the future there.
204
- // if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
205
- // // iOS 7.1 or earlier
206
- // UIRemoteNotificationType allNotificationTypes =
207
- // (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert |
208
- // UIRemoteNotificationTypeBadge);
209
- // [appDelegate registerForRemoteNotificationTypes:allNotificationTypes];
210
- // } else {
211
- // // iOS 8 or later
212
- // UIUserNotificationType allNotificationTypes =
213
- // (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
214
- // UIUserNotificationSettings *settings =
215
- // [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
216
- // [appDelegate registerUserNotificationSettings:settings];
217
- // [appDelegate registerForRemoteNotifications];
218
- // }
219
-
220
200
if ([UNUserNotificationCenter class ] != nil ) {
221
201
// iOS 10 or later, and tvOS
222
202
// For iOS 10 display notification (sent via APNS)
@@ -226,21 +206,25 @@ void NotifyListenerSet(Listener* listener) {
226
206
[[UNUserNotificationCenter currentNotificationCenter ]
227
207
requestAuthorizationWithOptions: authOptions
228
208
completionHandler: ^(BOOL granted, NSError * _Nullable error) {
229
- // ...
230
209
}];
231
210
[appDelegate registerForRemoteNotifications ];
232
211
}
233
- #endif
212
+ #endif // FIREBASE_PLATFORM_IOS || FIREBASE_PLATFORM_TVOS
234
213
235
214
#if FIREBASE_PLATFORM_IOS
215
+ // Register for remote notifications. Both codepaths result in
216
+ // application:didRegisterForRemoteNotificationsWithDeviceToken: being called when they
217
+ // complete, or application:didFailToRegisterForRemoteNotificationsWithError: if there was an
218
+ // error. We complete the future there.
236
219
if (floor (NSFoundationVersionNumber ) <= NSFoundationVersionNumber_iOS_7_1) {
237
220
// iOS 7.1 or earlier
238
221
UIRemoteNotificationType allNotificationTypes =
239
222
(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert |
240
223
UIRemoteNotificationTypeBadge);
241
224
[appDelegate registerForRemoteNotificationTypes: allNotificationTypes];
242
- } else if (floor (NSFoundationVersionNumber ) <= NSFoundationVersionNumber_iOS_10_0) {
243
- // iOS 8 or later
225
+ } else if (floor (NSFoundationVersionNumber ) < NSFoundationVersionNumber_iOS_10_0) {
226
+ // 8.0 <= iOS version < 10.0
227
+ // > 10.0 is handled by the if block above
244
228
UIUserNotificationType allNotificationTypes =
245
229
(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
246
230
UIUserNotificationSettings *settings =
0 commit comments