From a87ae602cd5c62a58d758d6419dda8cddd26d9d7 Mon Sep 17 00:00:00 2001 From: toluo-stripe Date: Thu, 16 Jan 2025 19:11:50 -0500 Subject: [PATCH] remove combined contract --- .../android/link/NativeLinkActivityContract.kt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/paymentsheet/src/main/java/com/stripe/android/link/NativeLinkActivityContract.kt b/paymentsheet/src/main/java/com/stripe/android/link/NativeLinkActivityContract.kt index fa8f526c0d3..ebc6e54b725 100644 --- a/paymentsheet/src/main/java/com/stripe/android/link/NativeLinkActivityContract.kt +++ b/paymentsheet/src/main/java/com/stripe/android/link/NativeLinkActivityContract.kt @@ -9,7 +9,6 @@ import com.stripe.android.PaymentConfiguration import javax.inject.Inject internal class NativeLinkActivityContract @Inject constructor( - private val webLinkActivityContract: WebLinkActivityContract ) : ActivityResultContract() { override fun createIntent(context: Context, input: LinkActivityContract.Args): Intent { val paymentConfiguration = PaymentConfiguration.getInstance(context) @@ -30,7 +29,10 @@ internal class NativeLinkActivityContract @Inject constructor( } LinkActivity.RESULT_COMPLETE -> { - handleCompleteResult(resultCode, intent) + val result = intent?.extras?.let { + BundleCompat.getParcelable(it, LinkActivityContract.EXTRA_RESULT, LinkActivityResult::class.java) + } + return result ?: LinkActivityResult.Canceled() } else -> { @@ -38,16 +40,4 @@ internal class NativeLinkActivityContract @Inject constructor( } } } - - private fun handleCompleteResult(resultCode: Int, intent: Intent?): LinkActivityResult { - intent ?: return LinkActivityResult.Canceled() - val redirectUri = intent.data - if (redirectUri != null) { - return webLinkActivityContract.parseResult(resultCode, intent) - } - val result = intent.extras?.let { - BundleCompat.getParcelable(it, LinkActivityContract.EXTRA_RESULT, LinkActivityResult::class.java) - } - return result ?: LinkActivityResult.Canceled() - } }