Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cardScanningEnabled to false change nothing #1751

Closed
djacques33 opened this issue Jan 20, 2021 · 2 comments
Closed

cardScanningEnabled to false change nothing #1751

djacques33 opened this issue Jan 20, 2021 · 2 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@djacques33
Copy link

Hello Team,

Summary

I need to disable scan card button in add card view but when i set to false cardScanningEnabled in STPPaymentConfiguration the button not disapear. The only issue for remove this button is remove NSCameraUsageDescription in info.plist but i need this for other usage.

Code to reproduce

STPPaymentConfiguration.shared.cardScanningEnabled = false
self.paymentContext = STPPaymentContext(customerContext: self.customerContext)
self.paymentContext.presentPaymentOptionsViewController()

SDK version

21.2.0

Other information

In STPAddCardViewController i see the lines where the button is created :

func setUpCardScanningIfAvailable() {
  if #available(iOS 13.0, *) {
    if !STPCardScanner.cardScanningAvailable() || configuration?.cardScanningEnabled == nil {
      return
    }
    let scannerCell = STPCardScannerTableViewCell()
    self.scannerCell = scannerCell

    let cardScanner = STPCardScanner(delegate: self)
    cardScanner.cameraView = scannerCell.cameraView
    self.cardScanner = cardScanner

    cardHeaderView?.buttonHidden = false
    cardHeaderView?.button?.setTitle(
      STPLocalizedString("Scan Card", "Text for button to scan a credit card"), for: .normal)
    cardHeaderView?.button?.addTarget(self, action: #selector(scanCard), for: .touchUpInside)
    cardHeaderView?.setNeedsLayout()
  }
}

cardScanningEnabled is not used for display cause is not nil this value is false but i can't set to nil in my code is Bool var.

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jan 20, 2021
@davidme-stripe
Copy link
Contributor

davidme-stripe commented Jan 20, 2021

Hey @djacques33, sorry about that, and thanks for catching it! We didn't translate this line correctly from Objective-C. We'll issue a fix soon.

@davidme-stripe
Copy link
Contributor

This was fixed in 21.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

2 participants