Skip to content

Commit

Permalink
fix: Preset timers not getting removed when the time picker is set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Apr 16, 2024
1 parent 666ab63 commit 1a12339
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class TimerModel : ViewModel() {
policy = object : SnapshotMutationPolicy<List<PersistentTimer>> {
override fun equivalent(a: List<PersistentTimer>, b: List<PersistentTimer>): Boolean {
if (a == b) return true
if (timePickerSeconds != 0) {
PersistentTimer.setTimers(b)
}
PersistentTimer.setTimers(b)
return false
}
}
Expand Down Expand Up @@ -64,6 +62,7 @@ class TimerModel : ViewModel() {
}

fun addPersistentTimer(seconds: Int) {
if (seconds == 0) return
persistentTimers = (persistentTimers + PersistentTimer(seconds)).distinct()
}

Expand Down

0 comments on commit 1a12339

Please sign in to comment.