Skip to content

Commit

Permalink
Address element bug bash issues pt. 1 (#1363)
Browse files Browse the repository at this point in the history
* Make phone optional by default

* upper case county codes

* Only suggest line 1 for auto complete

* Expand address section when auto complete line is tapped if needed

* update snapshots

* update test

* Revert "upper case county codes"

This reverts commit c17b78a6c233089a06574ee7b7029bb2a23bfc31.

* Uppercase country codes in address section element

* Revert "Expand address section when auto complete line is tapped if needed"

This reverts commit c9c47ca34046bcde98911188f9c07fdfcd3a21bc.

* Remove un-needed beginEditing call

* update test
  • Loading branch information
porter-stripe authored Aug 11, 2022
1 parent bcc9c45 commit ea35446
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Stripe/AddressViewController+Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import Foundation
public var checkboxLabel: String?

/// Initializes an AdditionalFields
public init(name: FieldConfiguration = .required, phone: FieldConfiguration = .hidden, checkboxLabel: String? = nil) {
public init(name: FieldConfiguration = .required, phone: FieldConfiguration = .optional, checkboxLabel: String? = nil) {
self.name = name
self.phone = phone
self.checkboxLabel = checkboxLabel
Expand Down
4 changes: 0 additions & 4 deletions Stripe/AddressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ extension AddressViewController {
if addressSection.collectionMode == .autoCompletable,
!AutoCompleteConstants.supportedCountries.contains(addressSection.selectedCountryCode) {
addressSection.collectionMode = .all
// Slight delay to make animations smoother
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.addressSection.line1?.beginEditing()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ import UIKit
additionalFields: AdditionalFields = .init(),
theme: ElementsUITheme = .default
) {
let dropdownCountries = countries ?? addressSpecProvider.countries
let dropdownCountries = countries?.map{$0.uppercased()} ?? addressSpecProvider.countries
let countryCodes = locale.sortedByTheirLocalizedNames(dropdownCountries)
self.collectionMode = collectionMode
self.countryCodes = countryCodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import UIKit
case .line2:
return .init(type: .default, textContentType: .streetAddressLine2, autocapitalization: .words)
case .autoComplete:
return .init(type: .default, textContentType: .fullStreetAddress, autocapitalization: .words)
return .init(type: .default, textContentType: .streetAddressLine1, autocapitalization: .words)
}
}

Expand Down
Binary file modified ...sts.AddressViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ssViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ssViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ea35446

Please sign in to comment.