Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit e3a5a14

Browse files
authored
Properly update Done button once submission fails. (#5754)
1 parent 9b86324 commit e3a5a14

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Corona-Warn-App/src/main/java/de/rki/coronawarnapp/srs/ui/symptoms/intro/SrsSymptomsIntroductionFragment.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ class SrsSymptomsIntroductionFragment : Fragment(R.layout.fragment_submission_sy
5757
updateButtons(it)
5858
}
5959

60-
viewModel.showLoadingIndicator.observe(viewLifecycleOwner) { binding.symptomButtonNext.isLoading = it }
60+
viewModel.showLoadingIndicator.observe(viewLifecycleOwner) {
61+
binding.symptomButtonNext.isLoading = it.first
62+
if (!it.first) updateButtons(it.second)
63+
}
6164

6265
viewModel.events.observe(viewLifecycleOwner) {
6366
when (it) {

Corona-Warn-App/src/main/java/de/rki/coronawarnapp/srs/ui/symptoms/intro/SrsSymptomsIntroductionViewModel.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SrsSymptomsIntroductionViewModel @AssistedInject constructor(
2727
) : CWAViewModel(dispatcherProvider) {
2828

2929
val events = SingleLiveEvent<SrsSymptomsIntroductionNavigation>()
30-
val showLoadingIndicator = SingleLiveEvent<Boolean>()
30+
val showLoadingIndicator = SingleLiveEvent<Pair<Boolean, Symptoms.Indication?>>()
3131

3232
private val symptomIndicationInternal = MutableStateFlow<Symptoms.Indication?>(null)
3333
val symptomIndication = symptomIndicationInternal.asLiveData(context = dispatcherProvider.Default)
@@ -49,7 +49,7 @@ class SrsSymptomsIntroductionViewModel @AssistedInject constructor(
4949
}
5050

5151
fun onWarningClicked() {
52-
showLoadingIndicator.postValue(true)
52+
showLoadingIndicator.postValue(Pair(true, symptomIndicationInternal.value))
5353
when (symptomIndicationInternal.value) {
5454
Symptoms.Indication.NEGATIVE -> {
5555
submitSRS(Symptoms.Indication.NEGATIVE)
@@ -86,7 +86,7 @@ class SrsSymptomsIntroductionViewModel @AssistedInject constructor(
8686
else -> events.postValue(SrsSymptomsIntroductionNavigation.Error(e))
8787
}
8888
} finally {
89-
showLoadingIndicator.postValue(false)
89+
showLoadingIndicator.postValue(Pair(false, symptomsIndication))
9090
}
9191
}
9292

0 commit comments

Comments
 (0)