Skip to content

Commit

Permalink
Disable auto complete if default shipping values are present (#1242)
Browse files Browse the repository at this point in the history
* Don't show autocomplete if default shipping values are present

* Use only line 1 for keyboard suggestions for auto complete

* Revert "Use only line 1 for keyboard suggestions for auto complete"

This reverts commit afe896269b3337792687be3f771d8e2d196ba696.
  • Loading branch information
porter-stripe authored Jun 21, 2022
1 parent 5198b89 commit e04f99d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Stripe/ShippingAddressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class ShippingAddressViewController: UIViewController {
}
}

private var shouldDisplayAutoComplete = true
private lazy var shouldDisplayAutoComplete: Bool = {
// Only display auto complete if defaults are empty
return AddressSectionElement.Defaults(from: configuration.shippingAddress.defaultValues) == .empty
}()

// MARK: - Views
lazy var navigationBar: SheetNavigationBar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation
*/
@_spi(STP) public class AddressSectionElement: SectionElement {
/// Describes an address to use as a default for AddressSectionElement
public struct Defaults {
public struct Defaults: Equatable {
@_spi(STP) public static let empty = Defaults()
var name: String?
var phone: String?
Expand Down

0 comments on commit e04f99d

Please sign in to comment.