Fix stuck on error when activation failed due to disconnect

> Remove PatchStep.ERROR state
This commit is contained in:
jbr7rr 2024-01-21 19:38:15 +01:00
parent 23e7af2d82
commit 43a3d8d8de
6 changed files with 0 additions and 7 deletions

View file

@ -15,7 +15,6 @@ enum class PatchStep {
ACTIVATE_COMPLETE, ACTIVATE_COMPLETE,
RETRY_ACTIVATION, RETRY_ACTIVATION,
RETRY_ACTIVATION_CONNECT, RETRY_ACTIVATION_CONNECT,
ERROR,
CANCEL, CANCEL,
COMPLETE; COMPLETE;
} }

View file

@ -38,7 +38,6 @@ class MedtrumActivateFragment : MedtrumBaseFragment<FragmentMedtrumActivateBindi
MedtrumViewModel.SetupStep.ACTIVATED -> moveStep(PatchStep.ACTIVATE_COMPLETE) MedtrumViewModel.SetupStep.ACTIVATED -> moveStep(PatchStep.ACTIVATE_COMPLETE)
MedtrumViewModel.SetupStep.ERROR -> { MedtrumViewModel.SetupStep.ERROR -> {
moveStep(PatchStep.ERROR)
updateSetupStep(MedtrumViewModel.SetupStep.PRIMED) // Reset setup step updateSetupStep(MedtrumViewModel.SetupStep.PRIMED) // Reset setup step
binding.textActivatingPump.text = rh.gs(R.string.activating_error) binding.textActivatingPump.text = rh.gs(R.string.activating_error)
binding.btnPositive.visibility = View.VISIBLE binding.btnPositive.visibility = View.VISIBLE

View file

@ -43,7 +43,6 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
PatchStep.ATTACH_PATCH -> setupViewFragment(MedtrumAttachPatchFragment.newInstance()) PatchStep.ATTACH_PATCH -> setupViewFragment(MedtrumAttachPatchFragment.newInstance())
PatchStep.ACTIVATE -> setupViewFragment(MedtrumActivateFragment.newInstance()) PatchStep.ACTIVATE -> setupViewFragment(MedtrumActivateFragment.newInstance())
PatchStep.ACTIVATE_COMPLETE -> setupViewFragment(MedtrumActivateCompleteFragment.newInstance()) PatchStep.ACTIVATE_COMPLETE -> setupViewFragment(MedtrumActivateCompleteFragment.newInstance())
PatchStep.ERROR -> Unit // Do nothing, let activity handle this
PatchStep.RETRY_ACTIVATION -> setupViewFragment(MedtrumRetryActivationFragment.newInstance()) PatchStep.RETRY_ACTIVATION -> setupViewFragment(MedtrumRetryActivationFragment.newInstance())
PatchStep.RETRY_ACTIVATION_CONNECT -> setupViewFragment(MedtrumRetryActivationConnectFragment.newInstance()) PatchStep.RETRY_ACTIVATION_CONNECT -> setupViewFragment(MedtrumRetryActivationConnectFragment.newInstance())
PatchStep.START_DEACTIVATION -> setupViewFragment(MedtrumStartDeactivationFragment.newInstance()) PatchStep.START_DEACTIVATION -> setupViewFragment(MedtrumStartDeactivationFragment.newInstance())

View file

@ -38,7 +38,6 @@ class MedtrumDeactivatePatchFragment : MedtrumBaseFragment<FragmentMedtrumDeacti
} }
MedtrumViewModel.SetupStep.ERROR -> { MedtrumViewModel.SetupStep.ERROR -> {
moveStep(PatchStep.ERROR)
updateSetupStep(MedtrumViewModel.SetupStep.START_DEACTIVATION) // Reset setup step updateSetupStep(MedtrumViewModel.SetupStep.START_DEACTIVATION) // Reset setup step
binding.textDeactivatingPump.text = rh.gs(R.string.deactivating_error) binding.textDeactivatingPump.text = rh.gs(R.string.deactivating_error)
binding.btnNegative.visibility = View.VISIBLE binding.btnNegative.visibility = View.VISIBLE

View file

@ -39,7 +39,6 @@ class MedtrumPrimingFragment : MedtrumBaseFragment<FragmentMedtrumPrimingBinding
MedtrumViewModel.SetupStep.PRIMED -> moveStep(PatchStep.PRIME_COMPLETE) MedtrumViewModel.SetupStep.PRIMED -> moveStep(PatchStep.PRIME_COMPLETE)
MedtrumViewModel.SetupStep.ERROR -> { MedtrumViewModel.SetupStep.ERROR -> {
moveStep(PatchStep.ERROR)
updateSetupStep(MedtrumViewModel.SetupStep.FILLED) // Reset setup step updateSetupStep(MedtrumViewModel.SetupStep.FILLED) // Reset setup step
binding.textWaitForPriming.text = rh.gs(R.string.priming_error) binding.textWaitForPriming.text = rh.gs(R.string.priming_error)
binding.btnNegative.visibility = View.VISIBLE binding.btnNegative.visibility = View.VISIBLE

View file

@ -137,7 +137,6 @@ class MedtrumViewModel @Inject constructor(
PatchStep.CANCEL, PatchStep.CANCEL,
PatchStep.COMPLETE, PatchStep.COMPLETE,
PatchStep.ACTIVATE_COMPLETE, PatchStep.ACTIVATE_COMPLETE,
PatchStep.ERROR,
PatchStep.START_DEACTIVATION, PatchStep.START_DEACTIVATION,
PatchStep.DEACTIVATE, PatchStep.DEACTIVATE,
PatchStep.FORCE_DEACTIVATION, PatchStep.FORCE_DEACTIVATION,
@ -307,7 +306,6 @@ class MedtrumViewModel @Inject constructor(
PatchStep.COMPLETE, PatchStep.COMPLETE,
PatchStep.FORCE_DEACTIVATION, PatchStep.FORCE_DEACTIVATION,
PatchStep.ERROR,
PatchStep.CANCEL -> _title.value PatchStep.CANCEL -> _title.value
} }