@@ -197,26 +197,6 @@ void NotifyListenerSet(Listener* listener) {
197197 id appDelegate = [UIApplication sharedApplication ];
198198
199199 #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-
220200 if ([UNUserNotificationCenter class ] != nil ) {
221201 // iOS 10 or later, and tvOS
222202 // For iOS 10 display notification (sent via APNS)
@@ -226,21 +206,25 @@ void NotifyListenerSet(Listener* listener) {
226206 [[UNUserNotificationCenter currentNotificationCenter ]
227207 requestAuthorizationWithOptions: authOptions
228208 completionHandler: ^(BOOL granted, NSError * _Nullable error) {
229- // ...
230209 }];
231210 [appDelegate registerForRemoteNotifications ];
232211 }
233- #endif
212+ #endif // FIREBASE_PLATFORM_IOS || FIREBASE_PLATFORM_TVOS
234213
235214 #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.
236219 if (floor (NSFoundationVersionNumber ) <= NSFoundationVersionNumber_iOS_7_1) {
237220 // iOS 7.1 or earlier
238221 UIRemoteNotificationType allNotificationTypes =
239222 (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert |
240223 UIRemoteNotificationTypeBadge);
241224 [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
244228 UIUserNotificationType allNotificationTypes =
245229 (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
246230 UIUserNotificationSettings *settings =
0 commit comments