From 1397e4ae72ea3b8d16a9b44ed1235caca47b3d9e Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Thu, 12 Apr 2018 14:24:03 -0700 Subject: Remove deprecated token callback (#1074) --- Firebase/Messaging/FIRMessaging.m | 17 ++++------------- Firebase/Messaging/Public/FIRMessaging.h | 13 +------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m index fe59a41..6111ceb 100644 --- a/Firebase/Messaging/FIRMessaging.m +++ b/Firebase/Messaging/FIRMessaging.m @@ -572,18 +572,16 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS [self validateDelegateConformsToTokenAvailabilityMethods]; } -// Check if the delegate conforms to either |didReceiveRegistrationToken:| or -// |didRefreshRegistrationToken:|, and display a warning to the developer if not. +// Check if the delegate conforms to |didReceiveRegistrationToken:| +// and display a warning to the developer if not. // NOTE: Once |didReceiveRegistrationToken:| can be made a required method, this // check can be removed. - (void)validateDelegateConformsToTokenAvailabilityMethods { if (self.delegate && - ![self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)] && - ![self.delegate respondsToSelector:@selector(messaging:didRefreshRegistrationToken:)]) { + ![self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)]) { FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented, @"The object %@ does not respond to " - @"-messaging:didReceiveRegistrationToken:, nor " - @"-messaging:didRefreshRegistrationToken:. Please implement " + @"-messaging:didReceiveRegistrationToken:. Please implement " @"-messaging:didReceiveRegistrationToken: to be provided with an FCM " @"token.", self.delegate.description); } @@ -877,13 +875,6 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS if (self.defaultFcmToken && ![self.defaultFcmToken isEqualToString:oldToken]) { [self notifyDelegateOfFCMTokenAvailability]; } - // Call deprecated refresh method, because it should still work (until it is removed). -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if ([self.delegate respondsToSelector:@selector(messaging:didRefreshRegistrationToken:)]) { - [self.delegate messaging:self didRefreshRegistrationToken:token]; - } -#pragma clang diagnostic pop NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center postNotificationName:FIRMessagingRegistrationTokenRefreshedNotification object:nil]; } diff --git a/Firebase/Messaging/Public/FIRMessaging.h b/Firebase/Messaging/Public/FIRMessaging.h index c950700..3ad15da 100644 --- a/Firebase/Messaging/Public/FIRMessaging.h +++ b/Firebase/Messaging/Public/FIRMessaging.h @@ -239,10 +239,8 @@ NS_SWIFT_NAME(MessagingRemoteMessage) @class FIRMessaging; /** - * A protocol to handle events from FCM for devices running iOS 10 or above. + * A protocol to handle token update or data message delivery from FCM. * - * To support devices running iOS 9 or below, use the local and remote notifications handlers - * defined in UIApplicationDelegate protocol. */ NS_SWIFT_NAME(MessagingDelegate) @protocol FIRMessagingDelegate @@ -259,15 +257,6 @@ NS_SWIFT_NAME(MessagingDelegate) didReceiveRegistrationToken:(NSString *)fcmToken NS_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:)); -/// This method will be called whenever FCM receives a new, default FCM token for your -/// Firebase project's Sender ID. This method is deprecated. Please use -/// `messaging:didReceiveRegistrationToken:`. -- (void)messaging:(FIRMessaging *)messaging - didRefreshRegistrationToken:(NSString *)fcmToken - NS_SWIFT_NAME(messaging(_:didRefreshRegistrationToken:)) - __deprecated_msg("Please use messaging:didReceiveRegistrationToken:, which is called for both \ - current and refreshed tokens."); - /// This method is called on iOS 10 devices to handle data messages received via FCM through its /// direct channel (not via APNS). For iOS 9 and below, the FCM data message is delivered via the /// UIApplicationDelegate's -application:didReceiveRemoteNotification: method. -- cgit v1.2.3