Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0671b2246f
|
@ -36,6 +36,7 @@ import java.io.IOException;
|
|||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -357,6 +358,21 @@ public class RNFirebaseNotificationManager {
|
|||
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
if (schedule.containsKey("repeatInterval")) {
|
||||
// If fireDate you specify is in the past, the alarm triggers immediately.
|
||||
// So we need to adjust the time for correct operation.
|
||||
if (fireDate < System.currentTimeMillis()) {
|
||||
Calendar newFireDate = Calendar.getInstance();
|
||||
Calendar currentFireDate = Calendar.getInstance();
|
||||
currentFireDate.setTimeInMillis(fireDate);
|
||||
|
||||
newFireDate.add(Calendar.DATE, 1);
|
||||
newFireDate.set(Calendar.HOUR_OF_DAY, currentFireDate.get(Calendar.HOUR_OF_DAY));
|
||||
newFireDate.set(Calendar.MINUTE, currentFireDate.get(Calendar.MINUTE));
|
||||
newFireDate.set(Calendar.SECOND, currentFireDate.get(Calendar.SECOND));
|
||||
|
||||
fireDate = newFireDate.getTimeInMillis();
|
||||
}
|
||||
|
||||
Long interval = null;
|
||||
switch (schedule.getString("repeatInterval")) {
|
||||
case "minute":
|
||||
|
|
Loading…
Reference in New Issue