Skip to content

Commit 1724498

Browse files
authored
[0.72][Cherry Pick] Refactor RCTPushNotificationManager to use UNNotification (#2033)
1 parent cc679e4 commit 1724498

File tree

4 files changed

+214
-261
lines changed

4 files changed

+214
-261
lines changed

packages/react-native/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,45 @@ type Permissions = {|
2020

2121
type Notification = {|
2222
+alertTitle?: ?string,
23-
// Actual type: string | number
24-
+fireDate?: ?number,
2523
+alertBody?: ?string,
26-
+alertAction?: ?string,
2724
+userInfo?: ?Object,
25+
/**
26+
* Identifier for the notification category. See the [Apple documentation](https://developer.apple.com/documentation/usernotifications/declaring_your_actionable_notification_types)
27+
* for more details.
28+
*/
2829
+category?: ?string,
29-
// Actual type: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute'
30-
+repeatInterval?: ?string,
30+
/**
31+
* Actual type: string | number
32+
*
33+
* Schedule notifications using EITHER `fireDate` or `fireIntervalSeconds`.
34+
* If both are specified, `fireDate` takes precedence.
35+
* If you use `presentLocalNotification`, both will be ignored
36+
* and the notification will be shown immediately.
37+
*/
38+
+fireDate?: ?number,
39+
/**
40+
* Seconds from now to display the notification.
41+
*
42+
* Schedule notifications using EITHER `fireDate` or `fireIntervalSeconds`.
43+
* If both are specified, `fireDate` takes precedence.
44+
* If you use `presentLocalNotification`, both will be ignored
45+
* and the notification will be shown immediately.
46+
*/
47+
+fireIntervalSeconds?: ?number,
48+
/** Badge count to display on the app icon. */
3149
+applicationIconBadgeNumber?: ?number,
50+
/** Whether to silence the notification sound. */
3251
+isSilent?: ?boolean,
52+
/**
53+
* Custom notification sound to play. Write-only: soundName will be null when
54+
* accessing already created notifications using getScheduledLocalNotifications
55+
* or getDeliveredNotifications.
56+
*/
3357
+soundName?: ?string,
58+
/** DEPRECATED. This was used for iOS's legacy UILocalNotification. */
59+
+alertAction?: ?string,
60+
/** DEPRECATED. Use `fireDate` or `fireIntervalSeconds` instead. */
61+
+repeatInterval?: ?string,
3462
|};
3563

3664
export interface Spec extends TurboModule {

packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result);
1616
#endif // [macOS]
1717

1818
#if !TARGET_OS_UIKITFORMAC
19-
#if !TARGET_OS_OSX // [macOS]
20-
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
21-
#endif // [macOS]
2219
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
2320
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification;
2421
#if !TARGET_OS_OSX // [macOS]

0 commit comments

Comments
 (0)