From c3be6e7e4eaacf4254021093e5ed8271a4b88df2 Mon Sep 17 00:00:00 2001 From: Evan Strat Date: Sun, 8 Sep 2024 15:21:57 -0400 Subject: [PATCH] Fix merch distribution getting into the wrong error flow --- .../apiary/merchandise/model/MerchandiseViewModel.kt | 1 + .../apiary/merchandise/ui/MerchandiseDistributionScreen.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/merchandise/src/main/java/org/robojackets/apiary/merchandise/model/MerchandiseViewModel.kt b/merchandise/src/main/java/org/robojackets/apiary/merchandise/model/MerchandiseViewModel.kt index a863521..242eb77 100644 --- a/merchandise/src/main/java/org/robojackets/apiary/merchandise/model/MerchandiseViewModel.kt +++ b/merchandise/src/main/java/org/robojackets/apiary/merchandise/model/MerchandiseViewModel.kt @@ -320,6 +320,7 @@ class MerchandiseViewModel @Inject constructor( } fun dismissPickupDialog() { + error.value = null screenState.value = MerchandiseDistributionScreenState.ReadyForTap } } diff --git a/merchandise/src/main/java/org/robojackets/apiary/merchandise/ui/MerchandiseDistributionScreen.kt b/merchandise/src/main/java/org/robojackets/apiary/merchandise/ui/MerchandiseDistributionScreen.kt index 8cc80e3..bdea239 100644 --- a/merchandise/src/main/java/org/robojackets/apiary/merchandise/ui/MerchandiseDistributionScreen.kt +++ b/merchandise/src/main/java/org/robojackets/apiary/merchandise/ui/MerchandiseDistributionScreen.kt @@ -8,6 +8,7 @@ import com.nxp.nfclib.NxpNfcLib import org.robojackets.apiary.base.ui.error.ErrorMessageWithRetry import org.robojackets.apiary.base.ui.util.ContentPadding import org.robojackets.apiary.base.ui.util.LoadingSpinner +import org.robojackets.apiary.merchandise.model.MerchandiseDistributionScreenState import org.robojackets.apiary.merchandise.model.MerchandiseViewModel import timber.log.Timber @@ -33,7 +34,7 @@ fun MerchandiseDistributionScreen( prioritizeRetryButton = true, ) } - state.error != null -> { + state.error != null && state.screenState == MerchandiseDistributionScreenState.ReadyForTap -> { ErrorMessageWithRetry( title = state.error ?: "Merchandise distribution is temporarily unavailable", onRetry = { viewModel.selectMerchandiseItemForDistribution(merchandiseItemId) },