Skip to content

Commit

Permalink
Merge pull request #1432 from minvws/bugfix/5019
Browse files Browse the repository at this point in the history
fix retry dialog buttons
  • Loading branch information
ktiniatros authored Nov 7, 2022
2 parents 9f3993d + 49b8210 commit edc5f53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ abstract class BaseFragment(contentLayoutId: Int) : Fragment(contentLayoutId) {
*/
abstract fun onButtonClickWithRetryAction()

/**
* Function that is also called when a network requests fails and a user presses the "close" button
*/
open fun onButtonClickClose() {
}

open fun onButtonClickWithRetryTitle(): Int {
return R.string.dialog_retry
}
Expand All @@ -46,7 +52,8 @@ abstract class BaseFragment(contentLayoutId: Int) : Fragment(contentLayoutId) {
positiveButtonCallback = {
onButtonClickWithRetryAction()
},
negativeButtonText = R.string.dialog_close
negativeButtonText = R.string.dialog_close,
negativeButtonCallback = this::onButtonClickClose
)
}
is NetworkRequestResult.Failed.ServerNetworkError -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ class FuzzyMatchingSyncFragment : BaseFragment(R.layout.fragment_saved_events_sy

private val fuzzyMatchingSyncFragmentArgs: FuzzyMatchingSyncFragmentArgs by navArgs()

override fun onButtonClickClose() {
findNavControllerSafety()?.popBackStack()
}

override fun onButtonClickWithRetryAction() {
// This screen does not have a retry button
syncGreenCardsViewModel.refresh()
}

override fun getFlow(): Flow {
Expand Down

0 comments on commit edc5f53

Please sign in to comment.