Honor repeatInterval when rescheduling outdated notiication

This commit is contained in:
Dariusz Luksza 2018-07-11 17:05:27 +02:00
parent 01c274a2f1
commit 11ccbb42f6
1 changed files with 16 additions and 1 deletions

View File

@ -365,11 +365,26 @@ public class RNFirebaseNotificationManager {
Calendar currentFireDate = Calendar.getInstance();
currentFireDate.setTimeInMillis(fireDate);
newFireDate.add(Calendar.DATE, 1);
newFireDate.set(Calendar.DATE, currentFireDate.get(Calendar.DATE));
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));
switch (schedule.getString("repeatInterval")) {
case "minute":
newFireDate.add(Calendar.MINUTE, 1);
break;
case "hour":
newFireDate.add(Calendar.HOUR, 1);
break;
case "day":
newFireDate.add(Calendar.DATE, 1);
break;
case "week":
newFireDate.add(Calendar.DATE, 7);
break;
}
fireDate = newFireDate.getTimeInMillis();
}