Skip to content

Commit

Permalink
Make sure loading state is dismissed before handling result
Browse files Browse the repository at this point in the history
COAND-984
  • Loading branch information
OscarSpruit committed Nov 26, 2024
1 parent 036ce79 commit 6d2c779
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ internal class DropInActivity :
private fun errorDialogDismissed(reason: String, terminateDropIn: Boolean) {
if (terminateDropIn) {
terminateWithError(reason)
} else {
setLoading(false)
}
}

Expand Down Expand Up @@ -384,6 +382,7 @@ internal class DropInActivity :
private fun handleDropInServiceResult(dropInServiceResult: BaseDropInServiceResult) {
adyenLog(AdyenLogLevel.DEBUG) { "handleDropInServiceResult - ${dropInServiceResult::class.simpleName}" }
dropInViewModel.isWaitingResult = false
setLoading(false)
when (dropInServiceResult) {
is DropInServiceResult -> handleDropInServiceResult(dropInServiceResult)
is BalanceDropInServiceResult -> handleDropInServiceResult(dropInServiceResult)
Expand Down Expand Up @@ -457,10 +456,10 @@ internal class DropInActivity :
dropInServiceResult.errorDialog?.let { errorDialog ->
val errorMessage = errorDialog.message ?: getString(R.string.unknown_error)
showError(errorDialog.title, errorMessage, reason, dropInServiceResult.dismissDropIn)
} ?: if (dropInServiceResult.dismissDropIn) {
terminateWithError(reason)
} else {
setLoading(false)
} ?: run {
if (dropInServiceResult.dismissDropIn) {
terminateWithError(reason)
}
}
}

Expand All @@ -480,7 +479,6 @@ internal class DropInActivity :
handleAction(action)
return
}
setLoading(false)
hideAllScreens()
val actionFragment = ActionComponentDialogFragment.newInstance(action, dropInViewModel.checkoutConfiguration)
actionFragment.show(supportFragmentManager, ACTION_FRAGMENT_TAG)
Expand Down Expand Up @@ -654,7 +652,6 @@ internal class DropInActivity :

private fun handleGiftCardFullPayment(fullPayment: GiftCardBalanceResult.FullPayment) {
adyenLog(AdyenLogLevel.DEBUG) { "handleGiftCardFullPayment" }
setLoading(false)
showGiftCardPaymentConfirmationDialog(fullPayment.data)
}

Expand All @@ -679,7 +676,6 @@ internal class DropInActivity :
}

private fun handleRemovePaymentMethodResult(id: String) {
setLoading(false)
dropInViewModel.removeStoredPaymentMethodWithId(id)

val preselectedStoredPaymentMethodFragment =
Expand Down

0 comments on commit 6d2c779

Please sign in to comment.