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

💲[Native Checkout] RewardCardContainerView snapshots and view model bindings #779

Merged
merged 116 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
94ca65c
💲[Native Checkout] Rename CheckoutViewController to DeprecatedCheckou…
dusi Mar 29, 2019
77f4507
💲[Native Checkout] Hide rewards when "ios_native_checkout" feature fl…
ifbarrera Apr 2, 2019
35429b5
💲[Native Checkout] Rename RewardPledgeVC/VM to DeprecatedRewardPledge…
dusi Apr 3, 2019
96dbb61
💲 [Native Checkout] Plumbing (#654)
dusi Apr 8, 2019
ee5c0e7
💲[Native Checkout] Pledge Amount Cell (#660)
dusi Apr 17, 2019
4f9a14d
[Native Checkout] "Back this project" button (#659)
ifbarrera Apr 17, 2019
9eade4c
Merge branch 'master' of https://github.com/kickstarter/ios-oss into …
dusi Apr 18, 2019
c080e45
Set stepper images using a lens (#661)
dusi Apr 23, 2019
0cb3394
💲[Native Checkout] Shipping Location Cell 1/3 (UI) (#666)
dusi Apr 30, 2019
b5c331f
💲[Native Checkout] Description Cell (#663)
cdolm92 May 3, 2019
ed973f2
💲[Native Checkout] Rewards Collection View Plumbing (#664)
May 6, 2019
1f23126
💲[Native Checkout] Pledge Continue Button - UI Only (#670)
May 8, 2019
d19a718
💲[Native Checkout] Description Cell User Interaction (#668)
cdolm92 May 8, 2019
9c4dc94
Merge branch 'master' into feature-native-checkout
dusi May 8, 2019
294e9cb
💲[Native Checkout] "Peek" functionality using hidden scroll view (#665)
May 10, 2019
40c00e5
Merge branch 'master' of https://github.com/kickstarter/ios-oss into …
ifbarrera May 10, 2019
a44c37b
Use HTML string with anchor tags (#673)
justinswart May 16, 2019
6ccdfb6
Merge branch 'master' into feature-native-checkout
justinswart May 16, 2019
a52c4e5
Add missing imports, update to use traitCollection.preferredContentSi…
justinswart May 16, 2019
5778e71
Fix imports in tests
justinswart May 17, 2019
3bad8c3
💲[Native Checkout] Sheet Overlay Container (#674)
May 22, 2019
e2eaa98
Merge branch 'master' of https://github.com/kickstarter/ios-oss into …
ifbarrera May 22, 2019
a48b021
Clean up issues with live stream deprecation
ifbarrera May 22, 2019
a05c511
💲[Native Checkout] Shipping Location Cell 2/3 (Currency formatter 🤯) …
dusi May 23, 2019
e4abb8e
Merge branch 'master' into feature-native-checkout
dusi May 24, 2019
7324bf0
💲[Native Checkout] Reward Selection (no animation) (#683)
May 24, 2019
ff804ac
💲[Native Checkout] - SwiftFormat (#687)
dusi May 28, 2019
e42a163
Merge branch 'master' into feature-native-checkout
justinswart May 28, 2019
7fd1363
Merge branch 'master' into feature-native-checkout
justinswart May 28, 2019
353e2c8
Merge branch 'master' into feature-native-checkout
justinswart May 30, 2019
56ecf6a
Fix version after merge
justinswart May 30, 2019
5433d37
Merge branch 'master' into feature-native-checkout
justinswart May 30, 2019
5e93ad0
💲[Native Checkout] Shipping location cell plus sign (#691)
dusi May 31, 2019
5eda5cf
Merge branch 'master' into feature-native-checkout
dusi May 31, 2019
4325229
Resolve swiftformat configuration merge conflict
dusi May 31, 2019
71bafed
Format files that were missed during merge conflict resolution
dusi May 31, 2019
b77e12a
💲[Native Checkout] Load Shipping Rules (#682)
Jun 5, 2019
ad15d3a
💲[Native Checkout] Refactor cells to be backed by view model (#693)
dusi Jun 11, 2019
62b3663
💲[Native Checkout] Rewards - Basic (#700)
Jun 18, 2019
ad3a1f7
Merge branch 'master' of https://github.com/kickstarter/ios-oss into …
ifbarrera Jun 18, 2019
ee7895b
Merge branch 'master' into feature-native-checkout
justinswart Jun 20, 2019
ad39509
💲[Native Checkout] Stepper haptics (#711)
dusi Jun 21, 2019
a79bf1b
Revert "💲[Native Checkout] Stepper haptics (#711)" (#714)
justinswart Jun 21, 2019
3b1179d
Feature Flag Tools 🔨 (#705)
Jun 21, 2019
cfc51e9
💲[Native Checkout] Stepper Haptics Final Final (#716)
dusi Jun 21, 2019
7d74c02
Merge branch 'master' into feature-native-checkout
justinswart Jun 25, 2019
73ad884
💲[Native Checkout] Pledge amount Stepper and Textfield input + Done b…
dusi Jun 25, 2019
9c4261e
Persist Debug Feature Flags (#721)
Jun 25, 2019
0351d37
💲[Native Checkout] Pledge Summary Cell Layout (#715)
justinswart Jun 26, 2019
d1f96a8
💲[Native Checkout] UITextView bottom padding improvements (#723)
justinswart Jun 26, 2019
3d50c91
💲[Native Checkout] Disable non-numeric, non-decimal separator input f…
dusi Jun 27, 2019
0e15fe8
💲[Native Checkout] Project Pledge States UI (#702)
cdolm92 Jun 27, 2019
4c96bd7
💲[Native Checkout] Re-enable the CTA button action (#728)
dusi Jun 27, 2019
11cef5e
Remove padding fix, instead use correct string (#729)
justinswart Jun 27, 2019
ea6ba76
💲[Native Checkout] Load default, min and max pledge values properly (…
dusi Jun 27, 2019
6f4810f
[Native Checkout] Pledge Payment Methods Collection View UI (#725)
Scollaco Jun 28, 2019
f2c1fa7
Merge branch 'master' into feature-native-checkout
justinswart Jul 3, 2019
d65e900
Merge branch 'master' into feature-native-checkout
dusi Jul 4, 2019
bcd871b
Rename deprecated vc and vm (#739)
dusi Jul 5, 2019
39a7dbb
💲[Native Checkout] Refactor shipping rules (#736)
dusi Jul 5, 2019
027f5e6
Feature native checkout applepay button (#742)
Scollaco Jul 9, 2019
05d7791
💲[Native Checkout] Shipping Picker - Navigation Workflow - 1/4 (#738)
dusi Jul 9, 2019
f4cfc49
Merge branch 'master' into feature-native-checkout
justinswart Jul 11, 2019
f073a51
💲[Native Checkout] Pledge Error State CTA (#746)
cdolm92 Jul 11, 2019
7d307de
Revert "💲[Native Checkout] Pledge Error State CTA (#746)" (#748)
Jul 11, 2019
139fe01
💲[Native Checkout] Fix Pledge CTA for logged out users (#744)
Jul 11, 2019
8ce75ac
💲[Native Checkout] Shipping Picker - Show List - 2/4 (#747)
dusi Jul 11, 2019
cb6932a
💲[Native Checkout] Login & Sign-up on the pledge screen (Part 1) (#727)
Jul 12, 2019
7a2df88
Merge branch 'master' into feature-native-checkout
dusi Jul 12, 2019
742e822
Change pragma mark from Binding to View model (#749)
dusi Jul 12, 2019
b0d93c2
Merge branch 'master' into feature-native-checkout
dusi Jul 15, 2019
d04021d
💲[Native Checkout] Prepare reward checkmark image view UI (#755)
dusi Jul 18, 2019
f619123
💲[Native Checkout] Pledge Screen Refactor: UITableView -> UIStackView…
Jul 18, 2019
7736c0d
Merge branch 'master' of https://github.com/kickstarter/ios-oss into …
ifbarrera Jul 18, 2019
fbe8a79
Make alert icon single scale (#759)
dusi Jul 19, 2019
d54a401
💲[Native Checkout] Prepare reward pill collection view UI (#757)
dusi Jul 22, 2019
c5e5c27
💲[Native Checkout] Pledge Error State CTA (#753)
cdolm92 Jul 23, 2019
547d276
💲[Native Checkout] Pledge Screen Separators (#760)
Jul 23, 2019
83f01bb
💲[Native Checkout] Reward -> Pledge View transition animation (#741)
justinswart Jul 25, 2019
9b7ea15
Light design pass and screenshots (#771)
Jul 26, 2019
bdc8fa5
💲[Native Checkout] Sheet Overlay iPad Bugfix (#769)
Jul 26, 2019
be8b202
Merge branch 'master' into feature-native-checkout
justinswart Jul 26, 2019
3ba3f75
💲[Native Checkout] Login/Signup design pass (#770)
ifbarrera Jul 29, 2019
232247c
Add outputs and bindings
justinswart Jul 29, 2019
b6eb2ef
SwiftFormat
justinswart Jul 29, 2019
03c7bec
Merge branch 'master' into feature-native-checkout
justinswart Jul 30, 2019
e9e183e
💲[Native Checkout] Activity Indicator for the Pledge View (#773)
Jul 30, 2019
46fabcc
Merge branch 'feature-native-checkout' into feature-native-checkout-r…
justinswart Jul 30, 2019
8d97fd6
snapshots and fix title font (#775)
cdolm92 Jul 31, 2019
75641f6
[Native Checkout] Credit card cell (#766)
Scollaco Jul 31, 2019
df55b06
Add RewardCardContainerView snapshot tests
justinswart Aug 1, 2019
fe10bee
Update RewardsCollectionViewController snapshots
justinswart Aug 1, 2019
4df9cf0
Merge branch 'feature-native-checkout' into feature-native-checkout-r…
justinswart Aug 1, 2019
ff85d92
Add NoReward snapshots
justinswart Aug 1, 2019
e48be9b
Improve snapshot naming
justinswart Aug 1, 2019
2f57bf5
Feature native checkout rewards gradient (#776)
Scollaco Aug 1, 2019
2197984
Tidy up some logic
justinswart Aug 1, 2019
18624c5
Merge branch 'feature-native-checkout' into feature-native-checkout-r…
justinswart Aug 1, 2019
0a22a5d
Feature native checkout reward pledge states (#764)
cdolm92 Aug 2, 2019
c8ab67e
💲[Native Checkout] Add New Card View (#777)
Aug 2, 2019
4985ecc
Merge branch 'master' into feature-native-checkout
justinswart Aug 2, 2019
3361492
💲[Native Checkout] Add native pledge view feature flag (#774)
justinswart Aug 2, 2019
a575cc5
Merge branch 'feature-native-checkout' into feature-native-checkout-r…
justinswart Aug 2, 2019
bb2bc4c
Remove type after merge
justinswart Aug 2, 2019
83ba683
💲[Native Checkout] Button style sweep (#781)
justinswart Aug 2, 2019
230a893
Merge branch 'feature-native-checkout' into feature-native-checkout-r…
justinswart Aug 2, 2019
5413203
SwiftFormat
justinswart Aug 2, 2019
65939a3
Merge pull request #652 from kickstarter/feature-native-checkout
justinswart Aug 2, 2019
5d035a4
Merge branch 'master' into feature-native-checkout-reward-cell-state-…
justinswart Aug 2, 2019
f750ebf
Merge branch 'master' into feature-native-checkout-reward-cell-state-…
justinswart Aug 6, 2019
52ac96c
Repair merge
justinswart Aug 6, 2019
50d6e1d
Revert unrelated code-changes from merging
justinswart Aug 6, 2019
1c065fb
Tidy up logic with guards and ternary operators
justinswart Aug 6, 2019
6c94205
Add logged out non-backer test
justinswart Aug 6, 2019
380cc93
💲[Native Checkout] RewardCardView states VM tests (#780)
justinswart Aug 7, 2019
54ac574
Add tests for NonLive, Backed and NonLive, NonBacked
justinswart Aug 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Find projects you’ll love in art, design, film, games, music, and more. Once you back a project, you’ll see all your activity here.";
"First_created" = "First created";
"Fix" = "Fix";
"Fix_your_payment_method" = "Fix your payment method";
"Follow_friend_name" = "Follow %{friend_name}";
"Follow_friends" = "Follow friends";
"Follow_more_friends" = "Follow more friends";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Newsletters";
"No_Results" = "No Results";
"No_comments_yet" = "No comments yet.";
"No_longer_available" = "No longer available";
"No_messages" = "No messages";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "No one has posted an update yet.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Finde Projekte nach deinem Geschmack - in Kunst, Design, Film, Spiele, Musik und vielen anderen Kategorien. Wenn du ein Projekt unterstützt hast, wird deren Aktivität hier angezeigt.";
"First_created" = "Erstes Projekt";
"Fix" = "Korrigieren";
"Fix_your_payment_method" = "Zahlungsmethode ändern";
"Follow_friend_name" = "%{friend_name} folgen.";
"Follow_friends" = "Freunden folgen";
"Follow_more_friends" = "Folge noch mehr Freunden";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Newsletter";
"No_Results" = "Keine Ergebnisse";
"No_comments_yet" = "Bisher noch keine Kommentare.";
"No_longer_available" = "Nicht mehr verfügbar";
"No_messages" = "Keine Nachrichten";
"No_nevermind" = "Nein, ich habe es mir anders überlegt";
"No_one_has_posted_an_update_yet" = "Es wurden noch keine Updates gepostet.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Proyectos a tu gusto - en arte, diseño, cine, juegos, música y otras categorías. Una vez que hayas patrocinado un proyecto, verás todas las actividades pertinentes aquí.";
"First_created" = "Primer proyecto creado";
"Fix" = "Corregir";
"Fix_your_payment_method" = "Corrige tu método de pago";
"Follow_friend_name" = "Seguir a %{friend_name}.";
"Follow_friends" = "Seguir amigos";
"Follow_more_friends" = "Seguir a más amigos";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Boletines informativos";
"No_Results" = "Sin resultados";
"No_comments_yet" = "No hay comentarios todavia.";
"No_longer_available" = "Ya no está disponible";
"No_messages" = "No hay mensajes";
"No_nevermind" = "No, ignorar";
"No_one_has_posted_an_update_yet" = "Todavía no se han publicado actualizaciones.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Découvrez des projets que vous allez adorer : art, design, cinéma, jeux, musique et plus encore. L'activité des projets que vous soutenez s'affichera ici.";
"First_created" = "Premier projet créé";
"Fix" = "Corriger";
"Fix_your_payment_method" = "Corriger votre moyen de paiement";
"Follow_friend_name" = "Suivre %{friend_name}";
"Follow_friends" = "Suivez vos amis";
"Follow_more_friends" = "Suivre plus d'amis";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Lettres d'information";
"No_Results" = "Pas de résultats";
"No_comments_yet" = "Pas de commentaires.";
"No_longer_available" = "Indisponible";
"No_messages" = "Pas de messages";
"No_nevermind" = "Non, j'ai changé d'avis";
"No_one_has_posted_an_update_yet" = "Pas d'actus publiées pour le moment.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "お気に入りを見つけて、クリエイティブなプロジェクトに生命を吹き込もう。";
"First_created" = "1つめのプロジェクト";
"Fix" = "修正する";
"Fix_your_payment_method" = "お支払い方法を修正";
"Follow_friend_name" = "%{friend_name} をフォロー";
"Follow_friends" = "友達をフォロー";
"Follow_more_friends" = "もっと友達をフォローする";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "ニュースレター";
"No_Results" = "該当結果なし";
"No_comments_yet" = "まだコメントはありません。";
"No_longer_available" = "利用できなくなりました";
"No_messages" = "メッセージがありません。";
"No_nevermind" = "いいえ、削除しません";
"No_one_has_posted_an_update_yet" = "まだアップデートの投稿はありません。";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal final class BetaToolsViewController: UITableViewController {
self.navigationController?.dismiss(animated: true)
}

// MARK: Private Helper Functions
// MARK: - Private Helper Functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be Functions 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol thanks


private func configureFooterView() {
let containerView = UIView(frame: .zero)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ internal final class DashboardProjectsDrawerViewController: UITableViewControlle
self.tableView.backgroundView?.addGestureRecognizer(
UITapGestureRecognizer(
target: self, action: #selector(DashboardProjectsDrawerViewController.backgroundTapped)
))
)
)
})

UIView.animate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ internal final class DeprecatedRewardPledgeViewController: UIViewController {
project: Project,
reward: Reward,
applePayCapable: Bool = PKPaymentAuthorizationViewController.applePayCapable()
)
-> DeprecatedRewardPledgeViewController {
) -> DeprecatedRewardPledgeViewController {
let vc = Storyboard.RewardPledge.instantiate(DeprecatedRewardPledgeViewController.self)
vc.viewModel.inputs.configureWith(project: project, reward: reward, applePayCapable: applePayCapable)
return vc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ final class FeatureFlagToolsViewController: UITableViewController {
private func updateConfig(with features: Features) {
guard let config = AppEnvironment.current.config else { return }

let updatedConfig = config
|> \.features .~ features
let updatedConfig = config |> \.features .~ features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔


AppEnvironment.updateDebugData(DebugData(config: updatedConfig))
AppEnvironment.updateConfig(updatedConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public final class ProjectPamphletViewController: UIViewController {
}

private var initialTopConstraint: CGFloat {
return parent?.view.safeAreaInsets.top ?? 0.0
return self.parent?.view.safeAreaInsets.top ?? 0.0
}

private func configurePledgeCTAContainerView() {
Expand Down
71 changes: 59 additions & 12 deletions Kickstarter-iOS/Views/RewardCardContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public final class RewardCardContainerView: UIView {

private let pledgeButtonLayoutGuide = UILayoutGuide()
private var pledgeButtonMarginConstraints: [NSLayoutConstraint]?
private var pledgeButtonShownConstraints: [NSLayoutConstraint] = []
private var pledgeButtonHiddenConstraints: [NSLayoutConstraint] = []
private let rewardCardView: RewardCardView = {
RewardCardView(frame: .zero)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
Expand All @@ -52,9 +54,6 @@ public final class RewardCardContainerView: UIView {
|> roundedStyle(cornerRadius: Styles.grid(3))
|> \.layoutMargins .~ .init(all: Styles.grid(3))

_ = self.pledgeButton
|> greenButtonStyle

_ = self.gradientView
|> \.backgroundColor .~ .clear
|> \.startPoint .~ .zero
Expand Down Expand Up @@ -84,6 +83,25 @@ public final class RewardCardContainerView: UIView {

self.pledgeButton.rac.title = self.viewModel.outputs.pledgeButtonTitleText
self.pledgeButton.rac.enabled = self.viewModel.outputs.pledgeButtonEnabled

self.viewModel.outputs.pledgeButtonHidden.observeValues { [weak self] hidden in
guard let self = self else { return }

if hidden {
NSLayoutConstraint.activate(self.pledgeButtonHiddenConstraints)
NSLayoutConstraint.deactivate(self.pledgeButtonShownConstraints)
} else {
NSLayoutConstraint.activate(self.pledgeButtonShownConstraints)
NSLayoutConstraint.deactivate(self.pledgeButtonHiddenConstraints)
}
}

self.viewModel.outputs.pledgeButtonStyle
.observeForUI()
.observeValues { [weak self] style in
guard let self = self else { return }
_ = self.pledgeButton |> style
}
}

internal func configure(with value: (project: Project, reward: Either<Reward, Backing>)) {
Expand Down Expand Up @@ -112,6 +130,25 @@ public final class RewardCardContainerView: UIView {
}

public func setupConstraints() {
self.pledgeButtonHiddenConstraints = self.hiddenPledgeHiddenConstraints()
self.pledgeButtonShownConstraints = self.shownPledgeButtonConstraints()
NSLayoutConstraint.activate(self.pledgeButtonShownConstraints)
}

private func hiddenPledgeHiddenConstraints() -> [NSLayoutConstraint] {
let containerMargins = self.layoutMarginsGuide

let rewardCardViewConstraints = [
self.rewardCardView.leftAnchor.constraint(equalTo: containerMargins.leftAnchor),
self.rewardCardView.rightAnchor.constraint(equalTo: containerMargins.rightAnchor),
self.rewardCardView.topAnchor.constraint(equalTo: containerMargins.topAnchor),
self.rewardCardView.bottomAnchor.constraint(equalTo: containerMargins.bottomAnchor)
]

return rewardCardViewConstraints
}

private func shownPledgeButtonConstraints() -> [NSLayoutConstraint] {
let containerMargins = self.layoutMarginsGuide

let rewardCardViewConstraints = [
Expand All @@ -131,36 +168,46 @@ public final class RewardCardContainerView: UIView {
self.pledgeButtonLayoutGuide.bottomAnchor.constraint(equalTo: containerMargins.bottomAnchor),
self.pledgeButtonLayoutGuide.leftAnchor.constraint(equalTo: containerMargins.leftAnchor),
self.pledgeButtonLayoutGuide.rightAnchor.constraint(equalTo: containerMargins.rightAnchor),
// swiftlint:disable:next line_length
self.pledgeButtonLayoutGuide.topAnchor.constraint(equalTo: self.rewardCardView.bottomAnchor, constant: Styles.grid(3)),
self.pledgeButtonLayoutGuide.topAnchor.constraint(
equalTo: self.rewardCardView.bottomAnchor, constant: Styles.grid(3)
),
self.pledgeButtonLayoutGuide.heightAnchor.constraint(equalTo: self.pledgeButton.heightAnchor)
]

NSLayoutConstraint.activate([
let constraints = [
[pledgeButtonTopConstraint],
rewardCardViewConstraints,
pledgeButtonLayoutGuideConstraints
]
.flatMap { $0 })
.flatMap { $0 }

return constraints
}

private func addBottomViewsMarginConstraints(with layoutMarginsGuide: UILayoutGuide) {
NSLayoutConstraint.deactivate(self.pledgeButtonMarginConstraints ?? [])
let minTouchSize = Styles.minTouchSize.height

NSLayoutConstraint.activate([
let pledgeButtonMarginConstraints = [
self.pledgeButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor),
self.pledgeButton.rightAnchor.constraint(equalTo: layoutMarginsGuide.rightAnchor),
self.pledgeButton.bottomAnchor.constraint(lessThanOrEqualTo: layoutMarginsGuide.bottomAnchor),
self.pledgeButton.heightAnchor.constraint(greaterThanOrEqualToConstant: minTouchSize)
])
self.pledgeButton.heightAnchor.constraint(
greaterThanOrEqualToConstant: minTouchSize
)
]

NSLayoutConstraint.activate(pledgeButtonMarginConstraints)

self.pledgeButtonMarginConstraints = pledgeButtonMarginConstraints

NSLayoutConstraint.activate([
self.gradientView.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor),
self.gradientView.rightAnchor.constraint(equalTo: layoutMarginsGuide.rightAnchor),
self.gradientView.topAnchor.constraint(equalTo: self.pledgeButton.topAnchor, constant: -minTouchSize),
// swiftlint:disable:next line_length
self.gradientView.bottomAnchor.constraint(equalTo: self.pledgeButton.bottomAnchor, constant: minTouchSize / 2)
self.gradientView.bottomAnchor.constraint(
equalTo: self.pledgeButton.bottomAnchor, constant: minTouchSize / 2
)
])
}

Expand Down
Loading