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
change naming of notification params returned on android, return date…
… in unix timestamp as before
  • Loading branch information
lukebars committed Jun 8, 2020
commit 0e5ad3493cb0890d56fba5e5c9829dbe689ea16e
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.json.JSONArray;
import org.json.JSONException;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
Expand Down Expand Up @@ -731,22 +730,16 @@ public WritableArray getScheduledLocalNotifications() {
WritableArray scheduled = Arguments.createArray();

Map<String, ?> scheduledNotifications = scheduledNotificationsPersistence.getAll();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ");

for (Map.Entry<String, ?> entry : scheduledNotifications.entrySet()) {
try {
RNPushNotificationAttributes notification = fromJson(entry.getValue().toString());
WritableMap notificationMap = Arguments.createMap();

long fireDateTimestamp = (long) notification.getFireDate();
Date date = new java.util.Date(fireDateTimestamp);
String fireDate = formatter.format(date);

notificationMap.putString("alertTitle", notification.getTitle());
notificationMap.putString("alertBody", notification.getMessage());
notificationMap.putString("alertAction", notification.getActions());
notificationMap.putString("applicationIconBadgeNumber", notification.getNumber());
notificationMap.putString("fireDate", fireDate);
notificationMap.putString("title", notification.getTitle());
notificationMap.putString("message", notification.getMessage());
notificationMap.putString("number", notification.getNumber());
notificationMap.putString("date", notification.getFireDate());
notificationMap.putString("id", notification.getId());
notificationMap.putBoolean("remote", false);
notificationMap.putString("repeatInterval", notification.getRepeatType());
Expand Down