Skip to content

Commit 088f921

Browse files
committed
merge PR zo0r#636
1 parent ae4f9fd commit 088f921

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,16 @@ public void cancelAllLocalNotifications() {
211211
mRNPushNotificationHelper.clearNotifications();
212212
}
213213

214+
@ReactMethod
215+
/**
216+
* Remove all delivered notifications from Notification Center
217+
*
218+
* @see <a href="https://facebook.github.io/react-native/docs/pushnotificationios.html#removealldeliverednotifications">RN docs</a>
219+
*/
220+
public void removeAllDeliveredNotifications() {
221+
mRNPushNotificationHelper.clearNotifications();
222+
}
223+
214224
@ReactMethod
215225
/**
216226
* Cancel scheduled notifications, and removes notifications from the notification centre.

component/index.android.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ NotificationsComponent.prototype.cancelAllLocalNotifications = function() {
4646
RNPushNotification.cancelAllLocalNotifications();
4747
};
4848

49+
NotificationsComponent.prototype.removeAllDeliveredNotifications = function() {
50+
RNPushNotification.removeAllDeliveredNotifications();
51+
};
52+
4953
NotificationsComponent.prototype.presentLocalNotification = function(details: Object) {
5054
RNPushNotification.presentLocalNotification(details);
5155
};

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ Notifications.cancelAllLocalNotifications = function() {
300300
return this.callNative('cancelAllLocalNotifications', arguments);
301301
};
302302

303+
Notifications.removeAllDeliveredNotifications = function() {
304+
return this.callNative('removeAllDeliveredNotifications', arguments);
305+
};
306+
303307
Notifications.setApplicationIconBadgeNumber = function() {
304308
return this.callNative('setApplicationIconBadgeNumber', arguments);
305309
};

0 commit comments

Comments
 (0)