Skip to content

Commit

Permalink
Revert "💲[Native Checkout] Pledge Error State CTA (#746)" (#748)
Browse files Browse the repository at this point in the history
This reverts commit f073a51.
  • Loading branch information
Isabel Barrera authored and ifbarrera committed Aug 5, 2019
1 parent 2df9050 commit 0ec0a8e
Show file tree
Hide file tree
Showing 52 changed files with 100 additions and 350 deletions.
4 changes: 0 additions & 4 deletions Kickstarter-iOS/Locales/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Change_payment_method" = "Change payment method";
"Chat" = "Chat";
"Check_back_later_for_an_update_on_your_export" = "Check back later for an update on your export progress.";
"Check_your_payment_details" = "Check your payment details";
"Chooses_location_for_shipping" = "Chooses %{location} for shipping.";
"Close_live_stream" = "Close live stream";
"Close_project" = "Close project";
Expand Down Expand Up @@ -167,7 +166,6 @@
"Find_projects_youll_love_and_help_bring" = "Find projects you’ll love and help bring creative ideas to life.";
"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";
"Follow_friend_name" = "Follow %{friend_name}";
"Follow_friends" = "Follow friends";
"Follow_more_friends" = "Follow more friends";
Expand Down Expand Up @@ -482,8 +480,6 @@
"View_your_reward" = "View your reward";
"Watch_live" = "Watch live";
"We_couldnt_find_anything_for_search_term" = "We couldn't find anything for “%{search_term}”.";
"We_couldnt_process_your_pledge" = "We couldn't process your pledge.";
"We_think_youll_like_these_too" = "We think you’ll like these, too";
"We_use_your_activity_internally_to_make_recommendations_for_you" = "We use your activity internally to make recommendations for you. Turn recommendations off to opt out of this.";
"We_ve_been_unable_to_send_email" = "We've been unable to send email to this address. Please make sure it is typed correctly.";
"We_were_unable_to_connect_to_the_live_stream_chat" = "We were unable to connect to the live stream chat.";
Expand Down
4 changes: 0 additions & 4 deletions Kickstarter-iOS/Locales/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Change_payment_method" = "Zahlungsmethode ändern";
"Chat" = "Chat";
"Check_back_later_for_an_update_on_your_export" = "Der Fortschritt des Exports wird in Kürze verfügbar sein- schau später noch einmal vorbei.";
"Check_your_payment_details" = "Überprüfe die Daten deiner Zahlungsweise";
"Chooses_location_for_shipping" = "Legt %{location} als Versandort fest.";
"Close_live_stream" = "Live-Stream schließen";
"Close_project" = "Projekt schließen";
Expand Down Expand Up @@ -167,7 +166,6 @@
"Find_projects_youll_love_and_help_bring" = "Finde Projekte, die zu dir passen und hilf mit bei der Umsetzung neuer, kreativer Ideen.";
"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";
"Follow_friend_name" = "%{friend_name} folgen.";
"Follow_friends" = "Freunden folgen";
"Follow_more_friends" = "Folge noch mehr Freunden";
Expand Down Expand Up @@ -482,8 +480,6 @@
"View_your_reward" = "Belohnung ansehen";
"Watch_live" = "Live ansehen";
"We_couldnt_find_anything_for_search_term" = "Es wurden keine Ergebnisse für die Suche \"%{search_term}\" gefunden.";
"We_couldnt_process_your_pledge" = "Dein Finanzierungsbeitrag konnte nicht bearbeitet werden.";
"We_think_youll_like_these_too" = "We think you’ll like these, too";
"We_use_your_activity_internally_to_make_recommendations_for_you" = "Deine Aktivitäten werden intern genutzt, um dir Empfehlungen zu unterbreiten. Um dies zu deaktivieren, wähle \"Empfehlungen\" einfach ab.";
"We_ve_been_unable_to_send_email" = "Wir konnten keine E-Mails an diese Adresse senden. Bitte prüfe, ob sie richtig eingegeben wurde.";
"We_were_unable_to_connect_to_the_live_stream_chat" = "Es konnte leider keine Verbindung zum Chat des Live-Streams hergestellt werden.";
Expand Down
4 changes: 0 additions & 4 deletions Kickstarter-iOS/Locales/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Change_payment_method" = "Cambiar método de pago";
"Chat" = "Chat";
"Check_back_later_for_an_update_on_your_export" = "Vuelve más tarde para obtener una actualización sobre tu progreso de exportación.";
"Check_your_payment_details" = "Revisa tu información de pago";
"Chooses_location_for_shipping" = "Destino determinado: %{location}.";
"Close_live_stream" = "Cerrar Live Stream";
"Close_project" = "Cerrar proyecto";
Expand Down Expand Up @@ -167,7 +166,6 @@
"Find_projects_youll_love_and_help_bring" = "Aquí encuentras proyectos a tu gusto - ¡tu contribución ayudará a hacerlos realidad!";
"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";
"Follow_friend_name" = "Seguir a %{friend_name}.";
"Follow_friends" = "Seguir amigos";
"Follow_more_friends" = "Seguir a más amigos";
Expand Down Expand Up @@ -482,8 +480,6 @@
"View_your_reward" = "Mostrar recompensa";
"Watch_live" = "Ver en vivo";
"We_couldnt_find_anything_for_search_term" = "La búsqueda \"%{search_term}\" no dio resultados.";
"We_couldnt_process_your_pledge" = "No pudimos procesar tu contribución.";
"We_think_youll_like_these_too" = "We think you’ll like these, too";
"We_use_your_activity_internally_to_make_recommendations_for_you" = "Utilizamos tu actividad internamente para hacerte recomendaciones. Desactiva las recomendaciones si no quieres recibirlas.";
"We_ve_been_unable_to_send_email" = "No pudimos enviar el correo electrónico a esta dirección. Asegúrate de que esté escrita correctamente.";
"We_were_unable_to_connect_to_the_live_stream_chat" = "No se pudo conectar al chat de live stream.";
Expand Down
4 changes: 0 additions & 4 deletions Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Change_payment_method" = "Changer de moyen de paiement";
"Chat" = "Chat";
"Check_back_later_for_an_update_on_your_export" = "Repassez plus tard pour suivre la préparation de votre exportation.";
"Check_your_payment_details" = "Check your payment details";
"Chooses_location_for_shipping" = "Sélectionne %{location} pour la livraison.";
"Close_live_stream" = "Fermer la diffusion en direct";
"Close_project" = "Fermer le projet";
Expand Down Expand Up @@ -167,7 +166,6 @@
"Find_projects_youll_love_and_help_bring" = "Découvrez de beaux projets et participez à la concrétisation d'idées créatives.";
"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";
"Follow_friend_name" = "Suivre %{friend_name}";
"Follow_friends" = "Suivez vos amis";
"Follow_more_friends" = "Suivre plus d'amis";
Expand Down Expand Up @@ -482,8 +480,6 @@
"View_your_reward" = "Afficher ma récompense";
"Watch_live" = "Regarder en direct";
"We_couldnt_find_anything_for_search_term" = "Pas de résultats pour « %{search_term} ».";
"We_couldnt_process_your_pledge" = "Impossible de traiter votre engagement.";
"We_think_youll_like_these_too" = "D'autres projets qui pourraient vous plaire";
"We_use_your_activity_internally_to_make_recommendations_for_you" = "À l'interne, nous nous servons de vos activités pour vous faire des recommandations. Si vous ne souhaitez pas participer, nous vous invitons à désactiver vos recommandations.";
"We_ve_been_unable_to_send_email" = "Échec de l'envoi. Veuillez vérifier l'orthographe de votre adresse e-mail.";
"We_were_unable_to_connect_to_the_live_stream_chat" = "Connexion au chat en direct impossible.";
Expand Down
4 changes: 0 additions & 4 deletions Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Change_payment_method" = "支払方法の変更";
"Chat" = "チャット";
"Check_back_later_for_an_update_on_your_export" = "しばらくしてからエクスポートの進捗状況を確認してください。";
"Check_your_payment_details" = "お支払い情報をご確認ください";
"Chooses_location_for_shipping" = "配送先%{location} を選択";
"Close_live_stream" = "ライブ配信を閉じる";
"Close_project" = "プロジェクトを閉じる";
Expand Down Expand Up @@ -167,7 +166,6 @@
"Find_projects_youll_love_and_help_bring" = "お気に入りを見つけて、クリエイティブなプロジェクトに生命を吹き込もう。";
"Find_projects_youll_love_in_art_design_film" = "お気に入りを見つけて、クリエイティブなプロジェクトに生命を吹き込もう。";
"First_created" = "1つめのプロジェクト";
"Fix" = "修正する";
"Follow_friend_name" = "%{friend_name} をフォロー";
"Follow_friends" = "友達をフォロー";
"Follow_more_friends" = "もっと友達をフォローする";
Expand Down Expand Up @@ -482,8 +480,6 @@
"View_your_reward" = "リワードをみる";
"Watch_live" = "ライブをみる";
"We_couldnt_find_anything_for_search_term" = "「%{search_term}」に一致するものがありませんでした。";
"We_couldnt_process_your_pledge" = "プレッジを処理できませんでした。";
"We_think_youll_like_these_too" = "その他おすすめプロジェクト";
"We_use_your_activity_internally_to_make_recommendations_for_you" = "あなたのアクティビティをもとにおすすめの提供を行っています。オプトアウトするにはおすすめ機能をオフにしてください。";
"We_ve_been_unable_to_send_email" = "このアドレスにメールを送信できませんでした。メールアドレスが正確に入力されていることをご確認ください。";
"We_were_unable_to_connect_to_the_live_stream_chat" = "ライブ配信への接続に失敗。";
Expand Down
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 @@ -166,10 +161,10 @@ public final class ProjectPamphletViewController: UIViewController {
self?.navBarTopConstraint.constant = value
}

self.viewModel.outputs.project
self.viewModel.outputs.projectAndUser
.observeForUI()
.observeValues { [weak self] project in
self?.pledgeCTAContainerView.configureWith(project: project)
.observeValues { [weak self] project, user in
self?.pledgeCTAContainerView.configureWith(project: project, user: user)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,42 +110,13 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
}
}

func testBacker_LiveProject_Error_NativeCheckout_Enabled_Landscape() {
let config = Config.template
|> \.features .~ [Feature.checkout.rawValue: true]
let currentUser = User.template
let backing = Backing.template
|> Backing.lens.status .~ .errored
let backedProject = Project.cosmicSurgery
|> Project.lens.photo.full .~ ""
|> Project.lens.personalization.isBacking .~ true
|> Project.lens.personalization.backing .~ backing
|> Project.lens.state .~ .live

[Device.phone4inch, Device.phone5_5inch, Device.phone5_8inch].forEach { device in
let language = Language.en
withEnvironment(config: config, currentUser: currentUser, language: language) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc)
parent.view.frame.size.height = device == .pad ? 1_200 : parent.view.frame.size.height

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)", tolerance: 0.01)
}
}
}

func testBacker_NonLiveProject_NativeCheckout_Enabled_Landscape() {
let config = Config.template
|> \.features .~ [Feature.checkout.rawValue: true]
let currentUser = User.template
let backing = Backing.template
let backedProject = Project.cosmicSurgery
|> Project.lens.photo.full .~ ""
|> Project.lens.personalization.isBacking .~ true
|> Project.lens.personalization.backing .~ backing
|> Project.lens.state .~ .successful

[Device.phone4inch, Device.phone5_5inch, Device.phone5_8inch].forEach { device in
Expand Down
59 changes: 22 additions & 37 deletions Kickstarter-iOS/Views/PledgeCTAContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@ import Library
import Prelude
import UIKit

private enum Layout {
enum Button {
static let height: CGFloat = 48.0
static let width: CGFloat = 98.0
}
}

final class PledgeCTAContainerView: UIView {
// MARK: - Properties

private let vm: PledgeCTAContainerViewViewModelType = PledgeCTAContainerViewViewModel()

private lazy var titleAndSubtitleStackView: UIStackView = {
private lazy var amountAndRewardTitleStackView: UIStackView = {
UIStackView(frame: .zero)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
}()

private lazy var subtitleLabel: UILabel = { UILabel(frame: .zero) }()
private lazy var amountOrRewardLabel: UILabel = { UILabel(frame: .zero) }()
private(set) lazy var pledgeCTAButton: UIButton = {
MultiLineButton(type: .custom)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
Expand All @@ -36,7 +29,7 @@ final class PledgeCTAContainerView: UIView {
|> \.translatesAutoresizingMaskIntoConstraints .~ false
}()

private lazy var titleLabel: UILabel = { UILabel(frame: .zero) }()
private lazy var youreABackerLabel: UILabel = { UILabel(frame: .zero) }()

// MARK: - Lifecycle

Expand All @@ -47,16 +40,14 @@ final class PledgeCTAContainerView: UIView {
|> ksr_addSubviewToParent()
|> ksr_constrainViewToEdgesInParent()

_ = ([self.titleLabel, self.subtitleLabel], self.titleAndSubtitleStackView)
_ = ([self.youreABackerLabel, self.amountOrRewardLabel], self.amountAndRewardTitleStackView)
|> ksr_addArrangedSubviewsToStackView()

_ = ([self.titleAndSubtitleStackView, self.spacer, self.pledgeCTAButton], self.rootStackView)
_ = ([self.amountAndRewardTitleStackView, self.spacer, self.pledgeCTAButton], self.rootStackView)
|> ksr_addArrangedSubviewsToStackView()

NSLayoutConstraint.activate([
self.pledgeCTAButton.heightAnchor.constraint(greaterThanOrEqualToConstant: Layout.Button.height),
self.pledgeCTAButton.widthAnchor.constraint(greaterThanOrEqualToConstant: Layout.Button.width),
self.rootStackView.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor)
self.pledgeCTAButton.heightAnchor.constraint(greaterThanOrEqualToConstant: Styles.minTouchSize.height)
])

self.bindViewModel()
Expand All @@ -73,30 +64,29 @@ final class PledgeCTAContainerView: UIView {

let isAccessibilityCategory = self.traitCollection.preferredContentSizeCategory.isAccessibilityCategory

_ = self.titleAndSubtitleStackView
_ = self.amountAndRewardTitleStackView
|> \.axis .~ NSLayoutConstraint.Axis.vertical
|> \.isLayoutMarginsRelativeArrangement .~ true
|> \.spacing .~ 0

_ = self.amountOrRewardLabel
|> \.font .~ UIFont.ksr_caption1(size: 14)
|> \.textColor .~ UIColor.ksr_dark_grey_500
|> \.numberOfLines .~ 0

_ = self.pledgeCTAButton
|> pledgeCTAButtonStyle(
isAccessibilityCategory,
amountAndRewardTitleStackViewIsHidden: self.titleAndSubtitleStackView.isHidden
amountAndRewardTitleStackViewIsHidden: self.amountAndRewardTitleStackView.isHidden
)

_ = self.rootStackView
|> adaptableStackViewStyle(isAccessibilityCategory)
|> \.isLayoutMarginsRelativeArrangement .~ true
|> \.layoutMargins .~ UIEdgeInsets.init(topBottom: Styles.grid(3), leftRight: Styles.grid(3))
|> \.alignment .~ .center

_ = self.titleLabel
|> \.font .~ UIFont.ksr_callout().bolded
|> \.numberOfLines .~ 0

_ = self.subtitleLabel
|> \.font .~ UIFont.ksr_caption1().bolded
|> \.textColor .~ UIColor.ksr_dark_grey_500
_ = self.youreABackerLabel
|> \.font .~ UIFont.ksr_headline(size: 14)
|> \.text %~ { _ in Strings.Youre_a_backer() }
|> \.numberOfLines .~ 0
}

Expand All @@ -105,24 +95,17 @@ final class PledgeCTAContainerView: UIView {
override func bindViewModel() {
super.bindViewModel()

self.vm.outputs.buttonTitleTextColor
.observeForUI()
.observeValues { [weak self] textColor in
self?.pledgeCTAButton.setTitleColor(textColor, for: .normal)
}

self.titleAndSubtitleStackView.rac.hidden = self.vm.outputs.stackViewIsHidden
self.titleLabel.rac.text = self.vm.outputs.titleText
self.subtitleLabel.rac.text = self.vm.outputs.subtitleText
self.amountAndRewardTitleStackView.rac.hidden = self.vm.outputs.stackViewIsHidden
self.amountOrRewardLabel.rac.text = self.vm.outputs.rewardTitle
self.pledgeCTAButton.rac.backgroundColor = self.vm.outputs.buttonBackgroundColor
self.pledgeCTAButton.rac.title = self.vm.outputs.buttonTitleText
self.spacer.rac.hidden = self.vm.outputs.spacerIsHidden
}

// MARK: - Configuration

func configureWith(project: Project) {
self.vm.inputs.configureWith(project: project)
func configureWith(project: Project, user: User) {
self.vm.inputs.configureWith(project: project, user: user)
}
}

Expand All @@ -148,8 +131,10 @@ private func pledgeCTAButtonStyle(

return button
|> roundedStyle(cornerRadius: 12)
|> UIButton.lens.titleColor(for: .normal) .~ UIColor.white
|> UIButton.lens.titleLabel.font .~ UIFont.ksr_headline(size: 15)
|> UIButton.lens.layer.borderWidth .~ 0
|> UIButton.lens.titleEdgeInsets .~ .init(topBottom: Styles.grid(1), leftRight: Styles.grid(2))
|> (UIButton.lens.titleLabel .. UILabel.lens.textAlignment) .~ NSTextAlignment.center
|> (UIButton.lens.titleLabel .. UILabel.lens.lineBreakMode) .~ lineBreakMode
}
Expand Down
Loading

0 comments on commit 0ec0a8e

Please sign in to comment.