Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove changes in whitespaces
  • Loading branch information
lukebars committed Jun 5, 2020
commit 50da5a502c06568aa22985bb8c735da355d3459c
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ public void clearNotification(String tag, int notificationID) {
}

public void clearDeliveredNotifications(ReadableArray identifiers) {
NotificationManager notificationManager = notificationManager();
for (int index = 0; index < identifiers.size(); index++) {
NotificationManager notificationManager = notificationManager();
for (int index = 0; index < identifiers.size(); index++) {
String id = identifiers.getString(index);
Log.i(LOG_TAG, "Removing notification with id " + id);
notificationManager.cancel(Integer.parseInt(id));
Expand All @@ -702,26 +702,26 @@ public void clearDeliveredNotifications(ReadableArray identifiers) {

@RequiresApi(api = Build.VERSION_CODES.M)
public WritableArray getDeliveredNotifications() {
NotificationManager notificationManager = notificationManager();
StatusBarNotification delivered[] = notificationManager.getActiveNotifications();
Log.i(LOG_TAG, "Found " + delivered.length + " delivered notifications");
WritableArray result = Arguments.createArray();
/*
* stay consistent to the return structure in
* https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications
* but there is no such thing as a 'userInfo'
*/
for (StatusBarNotification notification : delivered) {
Notification original = notification.getNotification();
Bundle extras = original.extras;
WritableMap notif = Arguments.createMap();
notif.putString("identifier", "" + notification.getId());
notif.putString("title", extras.getString(Notification.EXTRA_TITLE));
notif.putString("body", extras.getString(Notification.EXTRA_TEXT));
notif.putString("tag", notification.getTag());
notif.putString("group", original.getGroup());
result.pushMap(notif);
}
NotificationManager notificationManager = notificationManager();
StatusBarNotification delivered[] = notificationManager.getActiveNotifications();
Log.i(LOG_TAG, "Found " + delivered.length + " delivered notifications");
WritableArray result = Arguments.createArray();
/*
* stay consistent to the return structure in
* https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications
* but there is no such thing as a 'userInfo'
*/
for (StatusBarNotification notification : delivered) {
Notification original = notification.getNotification();
Bundle extras = original.extras;
WritableMap notif = Arguments.createMap();
notif.putString("identifier", "" + notification.getId());
notif.putString("title", extras.getString(Notification.EXTRA_TITLE));
notif.putString("body", extras.getString(Notification.EXTRA_TEXT));
notif.putString("tag", notification.getTag());
notif.putString("group", original.getGroup());
result.pushMap(notif);
}

return result;

Expand Down