Skip to content

Commit

Permalink
Delete deprecated didReceiveLocal/RemoteNotification (#43117)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #43117

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

Reviewed By: philIip

Differential Revision: D52883365

fbshipit-source-id: b7136ecaf73263b8f8b633c8861a673868ac252e
  • Loading branch information
Ingrid Wang authored and facebook-github-bot committed Feb 21, 2024
1 parent 410e3b5 commit 7fffe69
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,6 @@ @implementation RCTConvert (UIBackgroundFetchResult)

@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)
{
Expand Down Expand Up @@ -267,23 +247,6 @@ + (void)setInitialNotification:(UNNotification *)notification
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];
Expand Down

0 comments on commit 7fffe69

Please sign in to comment.