Merge pull request #1073 from dluksza/notification-schedule-classcastexception
Fix ClassCastException while parsing fireDate
This commit is contained in:
commit
6848044f13
|
@ -309,17 +309,19 @@ public class RNFirebaseNotificationManager {
|
||||||
// fireDate is stored in the Bundle as Long after notifications are rescheduled.
|
// fireDate is stored in the Bundle as Long after notifications are rescheduled.
|
||||||
// This would lead to a fireDate of 0.0 when trying to extract a Double from the bundle.
|
// This would lead to a fireDate of 0.0 when trying to extract a Double from the bundle.
|
||||||
// Instead always try extract a Long
|
// Instead always try extract a Long
|
||||||
Long fireDate = schedule.getLong("fireDate", -1);
|
Long fireDate = -1L;
|
||||||
if (fireDate == -1) {
|
try {
|
||||||
fireDate = (long) schedule.getDouble("fireDate", -1);
|
fireDate = (long) schedule.getDouble("fireDate", -1);
|
||||||
if (fireDate == -1) {
|
} catch (ClassCastException e) {
|
||||||
if (promise == null) {
|
fireDate = schedule.getLong("fireDate", -1);
|
||||||
Log.e(TAG, "Missing schedule information");
|
}
|
||||||
} else {
|
if (fireDate == -1) {
|
||||||
promise.reject("notification/schedule_notification_error", "Missing fireDate information");
|
if (promise == null) {
|
||||||
}
|
Log.e(TAG, "Missing schedule information");
|
||||||
return;
|
} else {
|
||||||
|
promise.reject("notification/schedule_notification_error", "Missing fireDate information");
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scheduled alarms are cleared on restart
|
// Scheduled alarms are cleared on restart
|
||||||
|
|
Loading…
Reference in New Issue