Delete deprecated didReceiveLocal/RemoteNotification (#43117)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43117

Changelog:
[iOS][Breaking] Deleting deprecated didReceiveLocalNotification & didReceiveRemoteNotification callbacks on RCTPushNotificationManager

Reviewed By: philIip

Differential Revision: D52883365

fbshipit-source-id: b7136ecaf73263b8f8b633c8861a673868ac252e
This commit is contained in:
Ingrid Wang
2024-02-20 22:23:54 -08:00
committed by Facebook GitHub Bot
parent 410e3b5ebd
commit 7fffe692e7
2 changed files with 0 additions and 42 deletions
@@ -45,9 +45,4 @@ typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result);
*/
+ (void)setInitialNotification:(UNNotification *)notification;
/** DEPRECATED. Use didReceiveNotification instead. */
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification RCT_DEPRECATED;
/** DEPRECATED. Use didReceiveNotification instead. */
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification RCT_DEPRECATED;
@end
@@ -97,26 +97,6 @@ RCT_ENUM_CONVERTER(
@implementation RCTPushNotificationManager
/** DEPRECATED. UILocalNotification was deprecated in iOS 10. Please don't add new callsites. */
static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
{
NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
if (notification.fireDate) {
NSDateFormatter *formatter = [NSDateFormatter new];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"];
NSString *fireDateString = [formatter stringFromDate:notification.fireDate];
formattedLocalNotification[@"fireDate"] = fireDateString;
}
formattedLocalNotification[@"alertAction"] = RCTNullIfNil(notification.alertAction);
formattedLocalNotification[@"alertBody"] = RCTNullIfNil(notification.alertBody);
formattedLocalNotification[@"applicationIconBadgeNumber"] = @(notification.applicationIconBadgeNumber);
formattedLocalNotification[@"category"] = RCTNullIfNil(notification.category);
formattedLocalNotification[@"soundName"] = RCTNullIfNil(notification.soundName);
formattedLocalNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(notification.userInfo));
formattedLocalNotification[@"remote"] = @NO;
return formattedLocalNotification;
}
/** For delivered notifications */
static NSDictionary<NSString *, id> *RCTFormatUNNotification(UNNotification *notification)
{
@@ -267,23 +247,6 @@ RCT_EXPORT_MODULE()
kInitialNotification = notification;
}
// Deprecated
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification
{
[[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived
object:self
userInfo:RCTFormatLocalNotification(notification)];
}
// Deprecated
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification
{
NSDictionary *userInfo = @{@"notification" : notification};
[[NSNotificationCenter defaultCenter] postNotificationName:RCTRemoteNotificationReceived
object:self
userInfo:userInfo];
}
- (void)invalidate
{
[super invalidate];