Move timestamp computation from Reminder to ReminderScheduler
This commit is contained in:
parent
de38383a34
commit
6f1057f825
@ -18,13 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import org.isoron.uhabits.core.utils.DateUtils
|
|
||||||
|
|
||||||
data class Reminder(
|
data class Reminder(
|
||||||
val hour: Int,
|
val hour: Int,
|
||||||
val minute: Int,
|
val minute: Int,
|
||||||
val days: WeekdayList
|
val days: WeekdayList
|
||||||
) {
|
)
|
||||||
val timeInMillis: Long
|
|
||||||
get() = DateUtils.getUpcomingTimeInMillis(hour, minute)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -55,7 +55,10 @@ class ReminderScheduler(
|
|||||||
sys.log("ReminderScheduler", "habit=" + habit.id + " has no reminder. Skipping.")
|
sys.log("ReminderScheduler", "habit=" + habit.id + " has no reminder. Skipping.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var reminderTime = habit.reminder!!.timeInMillis
|
var reminderTime = DateUtils.getUpcomingTimeInMillis(
|
||||||
|
habit.reminder!!.hour,
|
||||||
|
habit.reminder!!.minute
|
||||||
|
)
|
||||||
val snoozeReminderTime = widgetPreferences.getSnoozeTime(habit.id!!)
|
val snoozeReminderTime = widgetPreferences.getSnoozeTime(habit.id!!)
|
||||||
if (snoozeReminderTime != 0L) {
|
if (snoozeReminderTime != 0L) {
|
||||||
val now = DateUtils.applyTimezone(DateUtils.getLocalTime())
|
val now = DateUtils.applyTimezone(DateUtils.getLocalTime())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user