Skip to content

Commit

Permalink
Use activity instead of fragment for cardscan (#6253)
Browse files Browse the repository at this point in the history
* Use the cardscan activity in payment sheet

* Remove commented-out code

* Update changelog
  • Loading branch information
awush-stripe authored Feb 23, 2023
1 parent 4fc1e68 commit 97d7561
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## XX.XX.XX - 2023-XX-XX

### StripeCardScan
[FIXED][6253](https://github.com/stripe/stripe-android/pull/6253) Use the full screen card scanner to alleviate fragment crashes

## 20.19.3 - 2023-02-13

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.stripe.android.PaymentConfiguration
import com.stripe.android.stripecardscan.cardscan.CardScanSheetResult
import com.stripe.android.ui.core.R
import com.stripe.android.ui.core.StripeCardScanProxy
import com.stripe.android.ui.core.databinding.ActivityCardScanBinding

Expand All @@ -25,16 +24,7 @@ internal class CardScanActivity : AppCompatActivity() {
PaymentConfiguration.getInstance(this).publishableKey,
this::onScanFinished
)
}

override fun onStart() {
super.onStart()
stripeCardScanProxy.attachCardScanFragment(
this,
supportFragmentManager,
R.id.fragment_container,
this::onScanFinished
)
stripeCardScanProxy.present()
}

private fun onScanFinished(result: CardScanSheetResult) {
Expand All @@ -47,11 +37,6 @@ internal class CardScanActivity : AppCompatActivity() {
finish()
}

override fun onStop() {
StripeCardScanProxy.removeCardScanFragment(supportFragmentManager)
super.onStop()
}

companion object {
const val CARD_SCAN_PARCELABLE_NAME = "CardScanActivityResult"
}
Expand Down

0 comments on commit 97d7561

Please sign in to comment.