Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public void isRegisteredForRemoteNotifications(Promise promise) {
promise.resolve(new Boolean(hasPermission));
}

@ReactMethod void removeAllDeliveredNotifications() {
IPushNotificationsDrawer notificationsDrawer = PushNotificationsDrawer.get(getReactApplicationContext().getApplicationContext());
notificationsDrawer.onAllNotificationsClearRequest();
}

protected void startFcmIntentService(String extraFlag) {
final Context appContext = getReactApplicationContext().getApplicationContext();
final Intent tokenFetchIntent = new Intent(appContext, FcmInstanceIdRefreshHandlerService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public interface IPushNotificationsDrawer {

void onNotificationOpened();
void onNotificationClearRequest(int id);
void onAllNotificationsClearRequest();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public void onNotificationClearRequest(int id) {
notificationManager.cancel(id);
}

@Override
public void onAllNotificationsClearRequest() {
final NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
}

protected void clearAll() {
final NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
Expand Down
4 changes: 4 additions & 0 deletions lib/src/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export class NotificationsAndroid {
static cancelLocalNotification(id) {
RNNotifications.cancelLocalNotification(id);
}

static removeAllDeliveredNotifications() {
RNNotifications.removeAllDeliveredNotifications();
}
}

export class PendingNotifications {
Expand Down