Skip to content

Commit

Permalink
fix: Fix candidate race issue on visible property
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-paing committed Nov 3, 2020
1 parent 6f74fd9 commit c102274
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ class LowerHouseCandidateListController : MvvmController<ControllerLowerHouseCan
}

if (viewModel.viewItemLiveData.value == null) {
lifecycleScope.launch {
//For some reason on fast phone, the candidate list doesn't show up
//Adding delay somehow solves this problem
delay(100)
loadCandidates()
}
}
}

Expand All @@ -91,7 +86,6 @@ class LowerHouseCandidateListController : MvvmController<ControllerLowerHouseCan

private fun observeViewItem(viewState: AsyncViewState<CandidateListResult>) = with(binding) {
progressBar.isVisible = viewState is AsyncViewState.Loading
rvCandidate.isVisible = viewState is AsyncViewState.Success
tvErrorMessage.isVisible = viewState is AsyncViewState.Error
btnRetry.isVisible = viewState is AsyncViewState.Error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class RegionalHouseCandidateListController() : MvvmController<ControllerRegional

private fun observeViewItem(viewState: AsyncViewState<CandidateListResult>) = with(binding) {
progressBar.isVisible = viewState is AsyncViewState.Loading
rvCandidate.isVisible = viewState is AsyncViewState.Success
tvErrorMessage.isVisible = viewState is AsyncViewState.Error
btnRetry.isVisible = viewState is AsyncViewState.Error
groupRemark.isVisible = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class UpperHouseCandidateListController : MvvmController<ControllerUpperHouseCan

private fun observeViewItem(viewState: AsyncViewState<CandidateListResult>) = with(binding) {
progressBar.isVisible = viewState is AsyncViewState.Loading
rvCandidate.isVisible = viewState is AsyncViewState.Success
tvErrorMessage.isVisible = viewState is AsyncViewState.Error
btnRetry.isVisible = viewState is AsyncViewState.Error

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object BuildConfig {

private const val versionMajor = 4
private const val versionMinor = 1
private const val versionPatch = 4
private const val versionPatch = 5
private const val versionBuild = 0

const val versionName =
Expand Down
2 changes: 1 addition & 1 deletion release.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
forceUpdate=false
forceUpdate=true
url=https://us-central1-maepaysoh2020.cloudfunctions.net/deploy/android

0 comments on commit c102274

Please sign in to comment.