fix command recovery on start

This commit is contained in:
Andrei Vereha 2021-07-13 21:27:37 +02:00
parent bf81db0f6e
commit 21b78562e2

View file

@ -436,7 +436,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun onStart() { override fun onStart() {
when (getCommandConfirmationFromState()) { when (getCommandConfirmationFromState()) {
CommandConfirmationSuccess, CommandConfirmationDenied -> { CommandConfirmationSuccess, CommandConfirmationDenied -> {
val now = System.currentTimeMillis() val now = SystemClock.elapsedRealtime()
val newCommand = podState.activeCommand?.copy( val newCommand = podState.activeCommand?.copy(
createdRealtime = now, createdRealtime = now,
sentRealtime = now + 1 sentRealtime = now + 1
@ -446,7 +446,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
} }
CommandSendingNotConfirmed -> { CommandSendingNotConfirmed -> {
val now = System.currentTimeMillis() val now = SystemClock.elapsedRealtime()
val newCommand = podState.activeCommand?.copy( val newCommand = podState.activeCommand?.copy(
createdRealtime = now, createdRealtime = now,
sentRealtime = now + 1 sentRealtime = now + 1