Skip to content

Commit

Permalink
💲[Native Checkout] Pledge Error State CTA (#753)
Browse files Browse the repository at this point in the history
* wip project states

* wip project states button colors and label showing up

* wip project states button height fix

* wip, manage button

* wip setting up vm for states

* wip setting up vm for states

* wip for reward title in manage state

* wip - refactor and vm tests

* wip - getting reward title now

* wip - amount and reward formatted for manage state

* wip

* wip- deleted backer banner

* wip- swiftlint fixes

* wip - got view layer back

* wip - refactor and renaming

* wip - snapshot tests

* wip

* wip- corrected shipping amount in manage state

* wip- final and alphabetize files

* pr feedback -move stylings to bindStyles()

* smapshot tests

* manage and view rewards strings added

* using new strings

* vm tests fix

* swift format

* wip- fix pledge

* revert strings

* backer banner is back

* snapshots

* refactor- was not using user

* light refactor

* refactor and snapshot test correction

* swiftlint fix

* new snapshots

* remove images from new snapshots

* remove image

* wip - fix state

* case

* fix logic is there

* fix vm tests are passing

* snapshot tests fixed

* snapshot tests fix for error state

* strings for error state

* vm refactor

* vm refactor title text

* undid change

* swift format

* fix button width

* new snapshots

* design feedback, new snapshots

* swift format

* added spacing

* renamed a stackview

* capitalized

* capitalized

* fixes

* Cleaning up screenshots, fixing issues with merge conflict

* Formatting

* Revert unneeded project template

* Cleaning up the snapshot configurations so they’re more consistent from test to test

* Formatting

* Line length

* Line length again

* new snapshots

* requested changes

* fixed reward title missing

* fixed snapshot failures

* new snapshots

* swift format

* swift lint fix

* swift format

* pr feedback and snapshot test for error state

* name change to minHeight and minWidth

* snapshot tests for error state

* constant name change

* snapshot correction
  • Loading branch information
cdolm92 authored and ifbarrera committed Aug 6, 2019
1 parent 008c90b commit b9e10b8
Show file tree
Hide file tree
Showing 189 changed files with 362 additions and 79 deletions.
4 changes: 4 additions & 0 deletions Kickstarter-iOS/Locales/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"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 @@ -166,6 +167,7 @@
"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 @@ -480,6 +482,8 @@
"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: 4 additions & 0 deletions Kickstarter-iOS/Locales/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"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 @@ -166,6 +167,7 @@
"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 @@ -480,6 +482,8 @@
"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: 4 additions & 0 deletions Kickstarter-iOS/Locales/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"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 @@ -166,6 +167,7 @@
"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 @@ -480,6 +482,8 @@
"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: 4 additions & 0 deletions Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"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 @@ -166,6 +167,7 @@
"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 @@ -480,6 +482,8 @@
"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: 4 additions & 0 deletions Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"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 @@ -166,6 +167,7 @@
"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 @@ -480,6 +482,8 @@
"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 @@ -42,22 +42,31 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
func testLoggedIn_Backer_LiveProject_NativeCheckout_Enabled() {
let config = Config.template
|> \.features .~ [Feature.checkout.rawValue: true]
let reward = Reward.template
|> Reward.lens.title .~ "Magic Lamp"
let backing = Backing.template
|> Backing.lens.reward .~ reward
let backedProject = Project.cosmicSurgery
|> Project.lens.photo.full .~ ""
|> (Project.lens.creator.avatar .. User.Avatar.lens.small) .~ ""
|> Project.lens.personalization.isBacking .~ true
|> Project.lens.personalization.backing .~ .template
|> Project.lens.personalization.backing .~ backing
|> Project.lens.state .~ .live

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: .template, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: backedProject),
config: config, currentUser: .template, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

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

scheduler.run()

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand All @@ -74,14 +83,19 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
|> Project.lens.state .~ .successful

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: .template, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: backedProject),
config: config, currentUser: .template, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

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

scheduler.run()

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand All @@ -92,17 +106,54 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
|> \.features .~ [Feature.checkout.rawValue: true]

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: .template, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: project),
config: config, currentUser: .template, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(projectOrParam: .left(project), refTag: nil)

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

scheduler.run()

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

func testLoggedIn_Backer_LiveProject_Error_NativeCheckout_Enabled() {
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.creator.avatar .. User.Avatar.lens.small) .~ ""
|> Project.lens.personalization.isBacking .~ true
|> Project.lens.personalization.backing .~ backing
|> Project.lens.state .~ .live

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(
apiService: MockService(fetchProjectResponse: backedProject),
config: config, currentUser: currentUser, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

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

scheduler.run()

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

func testLoggedIn_NonBacker_NonLiveProject_NativeCheckout_Enabled() {
let config = Config.template
|> \.features .~ [Feature.checkout.rawValue: true]
Expand All @@ -113,14 +164,19 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
|> Project.lens.state .~ .successful

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: .template, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: backedProject),
config: config, currentUser: .template, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

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

scheduler.run()

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand All @@ -133,12 +189,17 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
|> \.features .~ [Feature.checkout.rawValue: true]

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: nil, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: project),
config: config, currentUser: nil, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(projectOrParam: .left(project), refTag: nil)

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

scheduler.run()

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand All @@ -154,14 +215,19 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
|> Project.lens.state .~ .successful

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(config: config, currentUser: nil, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: backedProject),
config: config, currentUser: nil, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(
projectOrParam: .left(backedProject), refTag: nil
)

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

scheduler.run()

FBSnapshotVerifyView(vc.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand All @@ -178,7 +244,10 @@ internal final class ProjectPamphletViewControllerTests: TestCase {

// All we want to see here is that the pledge CTA button is hidden

withEnvironment(config: config, currentUser: nil, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: self.project),
config: config, currentUser: nil, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(projectOrParam: .left(project), refTag: nil)
_ = traitControllers(device: device, orientation: .portrait, child: vc)

Expand All @@ -194,7 +263,10 @@ internal final class ProjectPamphletViewControllerTests: TestCase {
let device = Device.phone4_7inch

// All we want to see here is that the pledge CTA button is hidden
withEnvironment(config: config, language: language) {
withEnvironment(
apiService: MockService(fetchProjectResponse: self.project),
config: config, language: language
) {
let vc = ProjectPamphletViewController.configuredWith(projectOrParam: .left(project), refTag: nil)

let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc)
Expand Down
Loading

0 comments on commit b9e10b8

Please sign in to comment.