aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
diff options
context:
space:
mode:
authorGravatar Chen Liang <chliang@google.com>2018-04-11 11:38:26 -0700
committerGravatar GitHub <noreply@github.com>2018-04-11 11:38:26 -0700
commit14bcf8ff741c96c76367c5c0afe92be90c2c452f (patch)
tree6d77b005e0dc73f80d956256db315b9ff195f5c9 /Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
parent09e4eddd826e6391ab099f79bb0117c01801ab7a (diff)
remove deprecated data message callback (#1068)
* remove deprecated data message callback * Fix the issue that swizzling is not setup in recommended data message callback for message tracking.
Diffstat (limited to 'Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m')
-rw-r--r--Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m19
1 files changed, 10 insertions, 9 deletions
diff --git a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
index 0b8d92b..e9d4791 100644
--- a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
+++ b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
@@ -30,6 +30,7 @@ static NSString *kUserNotificationWillPresentSelectorString =
@"userNotificationCenter:willPresentNotification:withCompletionHandler:";
static NSString *kUserNotificationDidReceiveResponseSelectorString =
@"userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:";
+static NSString *kReceiveDataMessageSelectorString = @"messaging:didReceiveMessage:";
@interface FIRMessagingRemoteNotificationsProxy ()
@@ -141,9 +142,6 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
SEL remoteNotificationWithFetchHandlerSelector =
@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:);
- // For data message from MCS.
- SEL receiveDataMessageSelector = NSSelectorFromString(@"applicationReceivedRemoteMessage:");
-
// For recording when APNS tokens are registered (or fail to register)
SEL registerForAPNSFailSelector =
@selector(application:didFailToRegisterForRemoteNotificationsWithError:);
@@ -172,11 +170,13 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
didSwizzleAppDelegate = YES;
}
+ // For data message from MCS.
+ SEL receiveDataMessageSelector = NSSelectorFromString(kReceiveDataMessageSelectorString);
if ([appDelegate respondsToSelector:receiveDataMessageSelector]) {
[self swizzleSelector:receiveDataMessageSelector
- inClass:appDelegateClass
- withImplementation:(IMP)FCM_swizzle_applicationReceivedRemoteMessage
- inProtocol:@protocol(UIApplicationDelegate)];
+ inClass:appDelegateClass
+ withImplementation:(IMP)FCM_swizzle_messagingDidReceiveMessage
+ inProtocol:@protocol(UIApplicationDelegate)];
didSwizzleAppDelegate = YES;
}
@@ -669,14 +669,15 @@ id userInfoFromNotification(id notification) {
return notificationUserInfo;
}
-void FCM_swizzle_applicationReceivedRemoteMessage(
- id self, SEL _cmd, FIRMessagingRemoteMessage *remoteMessage) {
+void FCM_swizzle_messagingDidReceiveMessage(id self, SEL _cmd, FIRMessaging *message,
+ FIRMessagingRemoteMessage *remoteMessage) {
[[FIRMessaging messaging] appDidReceiveMessage:remoteMessage.appData];
IMP original_imp =
[[FIRMessagingRemoteNotificationsProxy sharedProxy] originalImplementationForSelector:_cmd];
if (original_imp) {
- ((void (*)(id, SEL, FIRMessagingRemoteMessage *))original_imp)(self, _cmd, remoteMessage);
+ ((void (*)(id, SEL, FIRMessaging *, FIRMessagingRemoteMessage *))original_imp)(
+ self, _cmd, message, remoteMessage);
}
}