Skip to content

Commit

Permalink
💲[Native Checkout] Re-enable the CTA button action (#728)
Browse files Browse the repository at this point in the history
* Remove unused property

* Re-add target to the CTA button
  • Loading branch information
dusi authored and justinswart committed Aug 5, 2019
1 parent a802877 commit dd6b299
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public final class ProjectPamphletViewController: UIViewController {
PledgeCTAContainerView(frame: .zero) |> \.translatesAutoresizingMaskIntoConstraints .~ false
}()

private let pledgeCTAButton: UIButton = {
MultiLineButton(type: .custom)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
}()

public static func configuredWith(
projectOrParam: Either<Project, Param>,
refTag: RefTag?
Expand Down Expand Up @@ -94,6 +89,10 @@ public final class ProjectPamphletViewController: UIViewController {
_ = (self.pledgeCTAContainerView, self.view)
|> ksr_addSubviewToParent()

self.pledgeCTAContainerView.pledgeCTAButton.addTarget(
self, action: #selector(ProjectPamphletViewController.backThisProjectTapped), for: .touchUpInside
)

// Configure constraints
let pledgeCTAContainerViewConstraints = [
self.pledgeCTAContainerView.leftAnchor.constraint(equalTo: self.view.leftAnchor),
Expand Down Expand Up @@ -190,7 +189,9 @@ public final class ProjectPamphletViewController: UIViewController {
}

private func updateContentInsets() {
let buttonSize = self.pledgeCTAButton.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
let buttonSize = self.pledgeCTAContainerView.pledgeCTAButton.systemLayoutSizeFitting(
UIView.layoutFittingCompressedSize
)
let bottomInset = buttonSize.height + 2 * self.pledgeCTAContainerViewMargins

self.contentController.additionalSafeAreaInsets = UIEdgeInsets(bottom: bottomInset)
Expand Down
2 changes: 1 addition & 1 deletion Kickstarter-iOS/Views/PledgeCTAContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class PledgeCTAContainerView: UIView {
}()

private lazy var amountOrRewardLabel: UILabel = { UILabel(frame: .zero) }()
private lazy var pledgeCTAButton: UIButton = {
private(set) lazy var pledgeCTAButton: UIButton = {
MultiLineButton(type: .custom)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
}()
Expand Down

0 comments on commit dd6b299

Please sign in to comment.