mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-25 15:16:01 +00:00
Reminder current time fix
Fix issue with creating reminders for current or past current time.
This commit is contained in:
parent
f3bfb11b7e
commit
9f5591cc41
1 changed files with 8 additions and 1 deletions
|
|
@ -82,9 +82,16 @@ class TaskAlarmManager(
|
|||
return remindersItem
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If reminderItem time is before now, a new reminder will not be created until the reminder passes.
|
||||
* The exception to this is if the task & reminder was newly created for the same time,
|
||||
* in which the alarm will be created -
|
||||
* which is indicated by first nextDue being null (As the alarm is created before the API returns nextDue times)
|
||||
*/
|
||||
private fun setAlarmForRemindersItem(reminderItemTask: Task, remindersItem: RemindersItem?) {
|
||||
val now = ZonedDateTime.now().withZoneSameLocal(ZoneId.systemDefault())?.toInstant()
|
||||
if (remindersItem == null || remindersItem.getLocalZonedDateTimeInstant()?.isBefore(now) == true) {
|
||||
if (remindersItem == null || (remindersItem.getLocalZonedDateTimeInstant()?.isBefore(now) == true && reminderItemTask.nextDue?.first() != null)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue