reschedule just the relevant habit when showing a notification for it

And make sure not to schedule it for a possibly snoozed time, as that'd lead
to an infinite loop of scheduling it repeatedly for the current time.
pull/355/head
Luboš Luňák 8 years ago
parent 47976df813
commit d3887e7e1b

@ -65,7 +65,7 @@ public class ReminderController
long reminderTime) long reminderTime)
{ {
notificationTray.show(habit, timestamp, reminderTime); notificationTray.show(habit, timestamp, reminderTime);
reminderScheduler.scheduleAll(); reminderScheduler.scheduleHabitAtReminder(habit);
} }
public void onSnooze(@NonNull Habit habit, final Context context) public void onSnooze(@NonNull Habit habit, final Context context)

@ -82,7 +82,7 @@ public class ReminderControllerTest extends BaseAndroidJVMTest
Habit habit = mock(Habit.class); Habit habit = mock(Habit.class);
controller.onShowReminder(habit, Timestamp.ZERO.plus(100), 456); controller.onShowReminder(habit, Timestamp.ZERO.plus(100), 456);
verify(notificationTray).show(habit, Timestamp.ZERO.plus(100), 456); verify(notificationTray).show(habit, Timestamp.ZERO.plus(100), 456);
verify(reminderScheduler).scheduleAll(); verify(reminderScheduler).scheduleHabitAtReminder(habit);
} }
@Test @Test

Loading…
Cancel
Save