Skip to content

Commit 681f58e

Browse files
committed
Revert "feat: add removePendingNotificationRequests method (react-native-push-notification#242)"
This reverts commit 1bad362.
1 parent c41f5a6 commit 681f58e

File tree

5 files changed

+5
-92
lines changed

5 files changed

+5
-92
lines changed

README.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -354,22 +354,6 @@ Allows you to add specific actions for notification with specific category.
354354

355355
---
356356

357-
### `removePendingNotificationRequests()`
358-
359-
```jsx
360-
PushNotificationIOS.removeDeliveredNotifications(identifiers);
361-
```
362-
363-
Removes the specified pending notifications from Notification Center
364-
365-
**Parameters:**
366-
367-
| Name | Type | Required | Description |
368-
| ----------- | ----- | -------- | ---------------------------------- |
369-
| identifiers | string[] | Yes | Array of notification identifiers. |
370-
371-
---
372-
373357
### `removeAllPendingNotificationRequests()`
374358

375359
```jsx
@@ -421,13 +405,13 @@ A delivered notification is an object containing:
421405
PushNotificationIOS.removeDeliveredNotifications(identifiers);
422406
```
423407

424-
Removes the specified delivered notifications from Notification Center
408+
Removes the specified notifications from Notification Center
425409

426410
**Parameters:**
427411

428412
| Name | Type | Required | Description |
429413
| ----------- | ----- | -------- | ---------------------------------- |
430-
| identifiers | string[] | Yes | Array of notification identifiers. |
414+
| identifiers | array | Yes | Array of notification identifiers. |
431415

432416
---
433417

example/App.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -132,41 +132,6 @@ export const App = (): React.Node => {
132132
});
133133
};
134134

135-
const addMultipleRequests = () => {
136-
PushNotificationIOS.addNotificationRequest({
137-
id: 'test-1',
138-
title: 'First',
139-
subtitle: 'subtitle',
140-
body: 'First Notification out of 3',
141-
category: 'test',
142-
threadId: 'thread-id',
143-
fireDate: new Date(new Date().valueOf() + 10000),
144-
repeats: true,
145-
});
146-
147-
PushNotificationIOS.addNotificationRequest({
148-
id: 'test-2',
149-
title: 'Second',
150-
subtitle: 'subtitle',
151-
body: 'Second Notification out of 3',
152-
category: 'test',
153-
threadId: 'thread-id',
154-
fireDate: new Date(new Date().valueOf() + 12000),
155-
repeats: true,
156-
});
157-
158-
PushNotificationIOS.addNotificationRequest({
159-
id: 'test-3',
160-
title: 'Third',
161-
subtitle: 'subtitle',
162-
body: 'Third Notification out of 3',
163-
category: 'test',
164-
threadId: 'thread-id',
165-
fireDate: new Date(new Date().valueOf() + 14000),
166-
repeats: true,
167-
});
168-
};
169-
170135
const getPendingNotificationRequests = () => {
171136
PushNotificationIOS.getPendingNotificationRequests((requests) => {
172137
Alert.alert('Push Notification Received', JSON.stringify(requests), [
@@ -214,10 +179,6 @@ export const App = (): React.Node => {
214179
PushNotificationIOS.removeAllPendingNotificationRequests();
215180
};
216181

217-
const removePendingNotificationRequests = () => {
218-
PushNotificationIOS.removePendingNotificationRequests(['test-1', 'test-2']);
219-
};
220-
221182
const onRegistered = (deviceToken) => {
222183
Alert.alert('Registered For Remote Push', `Device Token: ${deviceToken}`, [
223184
{
@@ -318,18 +279,10 @@ export const App = (): React.Node => {
318279
onPress={addNotificationRequest}
319280
label="Add Notification Request"
320281
/>
321-
<Button
322-
onPress={addMultipleRequests}
323-
label="Add Multiple Notification Requests"
324-
/>
325282
<Button
326283
onPress={setNotificationCategories}
327284
label="Set notification categories"
328285
/>
329-
<Button
330-
onPress={removePendingNotificationRequests}
331-
label="Remove Partial Pending Notification Requests"
332-
/>
333286
<Button
334287
onPress={removeAllPendingNotificationRequests}
335288
label="Remove All Pending Notification Requests"

index.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,6 @@ export interface PushNotificationIOSStatic {
361361
*/
362362
removeAllPendingNotificationRequests(): void;
363363

364-
/**
365-
* Removes specified pending notifications from Notification Center.
366-
*/
367-
removePendingNotificationRequests(identifiers: string[]): void;
368-
369364
/**
370365
* Remove all delivered notifications from Notification Center.
371366
*

ios/RNCPushNotificationIOS.m

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,16 +319,8 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
319319
RCT_EXPORT_METHOD(removeAllPendingNotificationRequests)
320320
{
321321
if ([UNUserNotificationCenter class]) {
322-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
323-
[center removeAllPendingNotificationRequests];
324-
}
325-
}
326-
327-
RCT_EXPORT_METHOD(removePendingNotificationRequests:(NSArray<NSString *> *)identifiers)
328-
{
329-
if ([UNUserNotificationCenter class]) {
330-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
331-
[center removePendingNotificationRequestsWithIdentifiers:identifiers];
322+
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
323+
[center removeAllPendingNotificationRequests];
332324
}
333325
}
334326

js/index.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,6 @@ class PushNotificationIOS {
182182
RNCPushNotificationIOS.removeAllPendingNotificationRequests();
183183
}
184184

185-
/**
186-
* Removes pending notifications with given identifier strings.
187-
*/
188-
static removePendingNotificationRequests(identifiers: string[]) {
189-
invariant(
190-
RNCPushNotificationIOS,
191-
'PushNotificationManager is not available.',
192-
);
193-
RNCPushNotificationIOS.removePendingNotificationRequests(identifiers);
194-
}
195-
196185
/**
197186
* Remove all delivered notifications from Notification Center.
198187
*
@@ -262,7 +251,7 @@ class PushNotificationIOS {
262251

263252
/**
264253
* Cancel local notifications.
265-
* @deprecated - use `removePendingNotifications`
254+
*
266255
* See https://reactnative.dev/docs/pushnotificationios.html#cancellocalnotification
267256
*/
268257
static cancelLocalNotifications(userInfo: Object) {

0 commit comments

Comments
 (0)