Skip to content

Commit

Permalink
fix: remove usage of `runBlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgerardojacinto committed Aug 27, 2024
1 parent c5ece4a commit 0508154
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/android/com/outsystems/payments/OSPayments.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.outsystems.plugins.payments.model.OSPMTError
import com.outsystems.plugins.payments.model.PaymentConfigurationInfo
import com.outsystems.plugins.payments.model.PaymentDetails
import com.outsystems.plugins.payments.model.Tokenization
import kotlinx.coroutines.runBlocking
import org.apache.cordova.CallbackContext
import org.apache.cordova.CordovaInterface
import org.apache.cordova.CordovaWebView
Expand Down Expand Up @@ -55,22 +54,19 @@ class OSPayments : CordovaImplementation() {

override fun execute(action: String, args: JSONArray, callbackContext: CallbackContext): Boolean {
this.callbackContext = callbackContext
val result = runBlocking {
when (action) {
"setupConfiguration" -> {
setupConfiguration(args)
}
"checkWalletSetup" -> {
checkWalletSetup()
}
"setDetails" -> {
setDetailsAndTriggerPayment(args)
}
else -> false
when (action) {
"setupConfiguration" -> {
setupConfiguration(args)
}
true
"checkWalletSetup" -> {
checkWalletSetup()
}
"setDetails" -> {
setDetailsAndTriggerPayment(args)
}
else -> return false
}
return result
return true
}

private fun setupConfiguration(args: JSONArray) {
Expand Down

0 comments on commit 0508154

Please sign in to comment.