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

Email undeliverable/unverified #478

Merged
merged 12 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
5 changes: 5 additions & 0 deletions Kickstarter-iOS/Locales/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Any_payment_methods_you_saved_to_Kickstarter" = "Any payment methods you've saved to Kickstarter are listed here (securely) for your convenience.";
"App_version" = "App version";
"Are_you_sure" = "Are you sure?";
"Are_you_sure_you_wish_to_remove_this_card" = "Are you sure you wish to remove this card from your payment method options?";
"Ask_me_anything" = "Ask me anything";
"Available_to_watch_for_time_more_units" = "Available to watch for %{time} more %{units}";
"Back" = "Back";
Expand Down Expand Up @@ -249,6 +250,7 @@
"Messages" = "Messages";
"Name" = "Name";
"Never" = "Never";
"New_email" = "New email";
"New_password" = "New password";
"New_pledge_activity" = "New pledge activity";
"New_work_and_big_ideas_from_established_and" = "New work and big ideas from established and emerging artists.";
Expand All @@ -257,6 +259,7 @@
"No_Results" = "No Results";
"No_comments_yet" = "No comments yet.";
"No_messages" = "No messages";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "No one has posted an update yet.";
"No_pledges_from_friends_yet" = "No pledges\nfrom friends yet.";
"No_replay_is_available_for_this_live_stream" = "No replay is available for this live stream.";
Expand Down Expand Up @@ -335,6 +338,7 @@
"Recommended_For_You" = "Recommended For You";
"Recorded_Live" = "Recorded Live";
"Recorded_live_with_creator_name" = "Recorded live with <b>%{creator_name}</b>";
"Remove_this_card" = "Remove this card";
"Replay" = "Replay";
"Replay_available_for_time_more_units" = "Replay available for %{time} more %{units}";
"Replay_live_stream_with_creator_name" = "Replay live stream with<br><b>%{creator_name}</b>";
Expand Down Expand Up @@ -460,6 +464,7 @@
"When_you_save_a_project_we_ll_send_you_a_reminder" = "When you save a project we’ll send you a reminder 48 hours before it ends";
"Write_a_bio" = "Write a short bio. Just a sentence or two is great.";
"Yes_change_currency" = "Yes, Change currency";
"Yes_remove" = "Yes, remove";
"Yes_turn_off" = "Yes, turn off";
"You_Launched" = "You Launched!";
"You_backed_this_project" = "You backed this project.";
Expand Down
5 changes: 5 additions & 0 deletions Kickstarter-iOS/Locales/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Any_payment_methods_you_saved_to_Kickstarter" = "Sämtliche auf Kickstarter gespeicherten Zahlungsmethoden sind hier (sicher) hinterlegt.";
"App_version" = "App-Version";
"Are_you_sure" = "Bist du sicher?";
"Are_you_sure_you_wish_to_remove_this_card" = "Are you sure you wish to remove this card from your payment method options?";
"Ask_me_anything" = "Frage stellen";
"Available_to_watch_for_time_more_units" = "Kann noch %{time} %{units} angesehen werden";
"Back" = "Zurück";
Expand Down Expand Up @@ -249,6 +250,7 @@
"Messages" = "Nachrichten";
"Name" = "Name";
"Never" = "Niemals";
"New_email" = "New email";
"New_password" = "Neues Passwort";
"New_pledge_activity" = "Neue Finanzierungsbeiträge";
"New_work_and_big_ideas_from_established_and" = "Neue Arbeiten und großartige Ideen von etablierten und neuen Künstlern.";
Expand All @@ -257,6 +259,7 @@
"No_Results" = "Keine Ergebnisse";
"No_comments_yet" = "Bisher noch keine Kommentare.";
"No_messages" = "Keine Nachrichten";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "Es wurden noch keine Updates gepostet.";
"No_pledges_from_friends_yet" = "Es gibt noch keine Beiträge von Freunden.";
"No_replay_is_available_for_this_live_stream" = "Keine Wiedergabe verügbar für diesen Live-Stream.";
Expand Down Expand Up @@ -335,6 +338,7 @@
"Recommended_For_You" = "Empfehlungen für dich";
"Recorded_Live" = "Live aufgenommen";
"Recorded_live_with_creator_name" = "Live aufgenommen von <b>%{creator_name}</b>";
"Remove_this_card" = "Remove this card";
"Replay" = "Wiedergabe";
"Replay_available_for_time_more_units" = "Wiedergabe verfügbar für weitere %{time} %{units}";
"Replay_live_stream_with_creator_name" = "Wiedergabe des Live-Streams von<br><b>%{creator_name}</b>";
Expand Down Expand Up @@ -460,6 +464,7 @@
"When_you_save_a_project_we_ll_send_you_a_reminder" = "Wenn du ein Projekt speicherst, senden wir dir 48 Stunden vor Ablauf eine Erinnerungs-E-Mail";
"Write_a_bio" = "Schreibe eine kurze Biografie, ein oder zwei Sätze genügen.";
"Yes_change_currency" = "Ja, Währung ändern";
"Yes_remove" = "Yes, remove";
"Yes_turn_off" = "Ja, deaktivieren";
"You_Launched" = "Dein Projekt ist live!";
"You_backed_this_project" = "Du hast dieses Projekt unterstützt.";
Expand Down
5 changes: 5 additions & 0 deletions Kickstarter-iOS/Locales/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Any_payment_methods_you_saved_to_Kickstarter" = "Para tu comodidad, aquí se enumeran (de manera absolutamente segura) los métodos de pago que guardaste en Kickstarter.";
"App_version" = "Versión de la aplicación";
"Are_you_sure" = "¿Estás seguro?";
"Are_you_sure_you_wish_to_remove_this_card" = "Are you sure you wish to remove this card from your payment method options?";
"Ask_me_anything" = "¡Pregúntame!";
"Available_to_watch_for_time_more_units" = "Disponible para reproducción %{time} %{units} más";
"Back" = "Atrás";
Expand Down Expand Up @@ -249,6 +250,7 @@
"Messages" = "Mensajes";
"Name" = "Nombre";
"Never" = "Nunca";
"New_email" = "New email";
"New_password" = "Contraseña nueva";
"New_pledge_activity" = "Nueva actividad de contribución";
"New_work_and_big_ideas_from_established_and" = "Nuevos trabajos y grandes ideas de artistas establecidos y emergentes.";
Expand All @@ -257,6 +259,7 @@
"No_Results" = "Sin resultados";
"No_comments_yet" = "No hay comentarios todavia.";
"No_messages" = "No hay mensajes";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "Todavía no se han publicado actualizaciones.";
"No_pledges_from_friends_yet" = "Todavía no hay contribuciones de amigos.";
"No_replay_is_available_for_this_live_stream" = "Este Live Stream no cuenta con repetición.";
Expand Down Expand Up @@ -335,6 +338,7 @@
"Recommended_For_You" = "Recomendaciones para ti";
"Recorded_Live" = "Grabado en vivo";
"Recorded_live_with_creator_name" = "Grabado en vivo por <b>%{creator_name}</b>";
"Remove_this_card" = "Remove this card";
"Replay" = "Repetición";
"Replay_available_for_time_more_units" = "Repetición disponible por %{time} %{units} más";
"Replay_live_stream_with_creator_name" = "Repetir live stream de<br><b>%{creator_name}</b>";
Expand Down Expand Up @@ -460,6 +464,7 @@
"When_you_save_a_project_we_ll_send_you_a_reminder" = "Cuando guardes un proyecto, te enviaremos un recordatorio por correo electrónico 48 horas antes de que finalice";
"Write_a_bio" = "Escribe una biografía breve mediante una oración o dos.";
"Yes_change_currency" = "Sí, cambiar la moneda";
"Yes_remove" = "Yes, remove";
"Yes_turn_off" = "Sí, desactivar";
"You_Launched" = "¡Tu proyecto fue publicado!";
"You_backed_this_project" = "Patrocinaste este proyecto.";
Expand Down
5 changes: 5 additions & 0 deletions Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Any_payment_methods_you_saved_to_Kickstarter" = "Voici une liste (sécurisée) de tous les moyens de paiement que vous avez ajoutés à votre compte Kickstarter.";
"App_version" = "Version de l'application";
"Are_you_sure" = "Êtes-vous certain ?";
"Are_you_sure_you_wish_to_remove_this_card" = "Are you sure you wish to remove this card from your payment method options?";
"Ask_me_anything" = "Posez-moi une question !";
"Available_to_watch_for_time_more_units" = "Plus que %{time}%{units} pour regarder cette diffusion";
"Back" = "Retour";
Expand Down Expand Up @@ -249,6 +250,7 @@
"Messages" = "Messages";
"Name" = "Nom";
"Never" = "Jamais";
"New_email" = "New email";
"New_password" = "Nouveau mot de passe";
"New_pledge_activity" = "Nouveaux engagements";
"New_work_and_big_ideas_from_established_and" = "Grandes idées et nouveaux travaux signés par des artistes établis et émergents.";
Expand All @@ -257,6 +259,7 @@
"No_Results" = "Pas de résultats";
"No_comments_yet" = "Pas de commentaires.";
"No_messages" = "Pas de messages";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "Pas d'actus publiées pour le moment.";
"No_pledges_from_friends_yet" = "Mes amis \nn'ont rien soutenu.";
"No_replay_is_available_for_this_live_stream" = "Pas de rediffusion possible pour cette diffusion en direct.";
Expand Down Expand Up @@ -335,6 +338,7 @@
"Recommended_For_You" = "Rien que pour vous";
"Recorded_Live" = "Enregistré en direct";
"Recorded_live_with_creator_name" = "Enregistré en direct avec <b>%{creator_name}</b>";
"Remove_this_card" = "Remove this card";
"Replay" = "Rediffuser";
"Replay_available_for_time_more_units" = "Rediffusion encore disponible pendant %{time} %{units}";
"Replay_live_stream_with_creator_name" = "Revoir la diffusion en direct de <br><b>%{creator_name}</b>";
Expand Down Expand Up @@ -460,6 +464,7 @@
"When_you_save_a_project_we_ll_send_you_a_reminder" = "Pour chaque projet que vous enregistrez, nous vous enverrons un rappel 48 heures avant la fin de sa campagne.";
"Write_a_bio" = "Une petite biographie d'une phrase ou deux.";
"Yes_change_currency" = "Oui, changer de devise";
"Yes_remove" = "Yes, remove";
"Yes_turn_off" = "Oui, désactiver";
"You_Launched" = "Projet lancé !";
"You_backed_this_project" = "Vous avez soutenu ce projet.";
Expand Down
5 changes: 5 additions & 0 deletions Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Any_payment_methods_you_saved_to_Kickstarter" = "Kickstarter に保存されたお支払い方法は、こちらに (安全に) リストアップされます。";
"App_version" = "アプリ版";
"Are_you_sure" = "オフにしてもよろしいですか?";
"Are_you_sure_you_wish_to_remove_this_card" = "Are you sure you wish to remove this card from your payment method options?";
"Ask_me_anything" = "お問い合わせ";
"Available_to_watch_for_time_more_units" = "さらに%{time} の%{units} を見ることができます";
"Back" = "バック";
Expand Down Expand Up @@ -249,6 +250,7 @@
"Messages" = "メッセージ";
"Name" = "名前";
"Never" = "通知を受けない";
"New_email" = "New email";
"New_password" = "新しいパスワード";
"New_pledge_activity" = "新しいプレッジ";
"New_work_and_big_ideas_from_established_and" = "新進アーティストや著名アーティストの最新プロジェクトやアイデアをご紹介。";
Expand All @@ -257,6 +259,7 @@
"No_Results" = "該当結果なし";
"No_comments_yet" = "まだコメントはありません。";
"No_messages" = "メッセージがありません。";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "まだアップデートの投稿はありません。";
"No_pledges_from_friends_yet" = "友達からのプレッジはありません。";
"No_replay_is_available_for_this_live_stream" = "このライブ配信を再生することはできません";
Expand Down Expand Up @@ -335,6 +338,7 @@
"Recommended_For_You" = "あなたへのおすすめ";
"Recorded_Live" = "配信済ライブ";
"Recorded_live_with_creator_name" = "配信された<b>%{creator_name}</b>のライブ";
"Remove_this_card" = "Remove this card";
"Replay" = "リプレイ";
"Replay_available_for_time_more_units" = "あと%{time}%{units} リプレイ可能";
"Replay_live_stream_with_creator_name" = "<b>%{creator_name}</b>のライブ配信を再生";
Expand Down Expand Up @@ -460,6 +464,7 @@
"When_you_save_a_project_we_ll_send_you_a_reminder" = "プロジェクトを保存し、終了の48時間前にリマインドする。";
"Write_a_bio" = "簡単な自己紹介を書いてください。ほんの1~2文で構いません。";
"Yes_change_currency" = "はい、通貨を変更します";
"Yes_remove" = "Yes, remove";
"Yes_turn_off" = "はい、オフにします";
"You_Launched" = "発表されました!";
"You_backed_this_project" = "バック済";
Expand Down
49 changes: 28 additions & 21 deletions Kickstarter-iOS/Views/Controllers/ChangeEmailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ import UIKit
internal final class ChangeEmailViewController: UIViewController {
@IBOutlet fileprivate weak var currentEmailLabel: UILabel!
@IBOutlet fileprivate weak var currentEmail: UILabel!
@IBOutlet fileprivate weak var errorLabel: UILabel!
@IBOutlet fileprivate weak var errorView: UIView!
@IBOutlet fileprivate weak var messageLabelView: UIView!
@IBOutlet fileprivate weak var newEmailLabel: UILabel!
@IBOutlet fileprivate weak var newEmailTextField: UITextField!
@IBOutlet fileprivate weak var onePasswordButton: UIButton!
@IBOutlet fileprivate weak var passwordLabel: UILabel!
@IBOutlet fileprivate weak var passwordTextField: UITextField!
@IBOutlet fileprivate weak var resendVerificationEmailButton: UIButton!
@IBOutlet fileprivate weak var resendVerificationStackView: UIStackView!

@IBOutlet fileprivate weak var resendVerificationEmailView: UIView!
@IBOutlet fileprivate weak var scrollView: UIScrollView!
@IBOutlet fileprivate weak var resendVerificationEmailStackView: UIStackView!
@IBOutlet fileprivate weak var unverifiedEmailLabel: UILabel!
@IBOutlet fileprivate weak var warningMessageLabel: UILabel!

private let viewModel: ChangeEmailViewModelType = ChangeEmailViewModel()
private var messageBannerView: MessageBannerViewController!
Expand Down Expand Up @@ -67,56 +66,64 @@ internal final class ChangeEmailViewController: UIViewController {
Strings.Change_email()
}

_ = onePasswordButton
_ = self.onePasswordButton
|> onePasswordButtonStyle

_ = errorLabel
_ = self.messageLabelView
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here would be a good opportunity to remove the lenses and adopt the same pattern of self.passwordTextField styling.

|> UIView.lens.backgroundColor .~ .ksr_grey_200

_ = self.unverifiedEmailLabel
|> settingsDescriptionLabelStyle
|> UILabel.lens.text %~ { _ in Strings.Email_unverified() }

_ = currentEmailLabel
_ = self.warningMessageLabel
|> settingsDescriptionLabelStyle
|> UILabel.lens.textColor .~ .ksr_red_400
|> UILabel.lens.text %~ { _ in Strings.We_ve_been_unable_to_send_email() }

_ = self.currentEmailLabel
|> settingsTitleLabelStyle
|> UILabel.lens.text %~ { _ in Strings.Current_email() }

_ = currentEmail
_ = self.currentEmail
|> settingsDetailLabelStyle

_ = newEmailLabel
_ = self.newEmailLabel
|> settingsTitleLabelStyle
|> UILabel.lens.text %~ { _ in Strings.New_email() }

_ = newEmailTextField
_ = self.newEmailTextField
|> formFieldStyle
|> UITextField.lens.returnKeyType .~ .next
|> UITextField.lens.textAlignment .~ .right
|> UITextField.lens.placeholder %~ { _ in
Strings.login_placeholder_email()
}

_ = passwordLabel
_ = self.passwordLabel
|> settingsTitleLabelStyle
|> UILabel.lens.text %~ { _ in Strings.Current_password() }

_ = resendVerificationStackView
|> \.isHidden .~ true

_ = passwordTextField
_ = self.passwordTextField
|> passwordFieldStyle
|> \.textAlignment .~ .right
|> \.returnKeyType .~ .go

_ = resendVerificationEmailButton
_ = self.resendVerificationEmailButton
|> UIButton.lens.titleLabel.font .~ .ksr_body()
|> UIButton.lens.titleColor(for: .normal) .~ .ksr_text_green_700
}

override func bindViewModel() {
super.bindViewModel()

self.resendVerificationStackView.rac.hidden = self.viewModel.outputs.resendVerificationStackViewIsHidden
self.currentEmail.rac.text = self.viewModel.outputs.emailText

self.resendVerificationEmailView.rac.hidden = self.viewModel.outputs.resendVerificationEmailViewIsHidden
self.resendVerificationEmailButton.rac.title = self.viewModel.outputs.verificationEmailButtonTitle

self.onePasswordButton.rac.hidden = self.viewModel.outputs.onePasswordButtonIsHidden

self.messageLabelView.rac.hidden = self.viewModel.outputs.messageLabelViewHidden
self.unverifiedEmailLabel.rac.hidden = self.viewModel.outputs.unverifiedEmailLabelHidden
self.warningMessageLabel.rac.hidden = self.viewModel.outputs.warningMessageLabelHidden
self.passwordTextField.rac.text = self.viewModel.outputs.passwordText

self.viewModel.outputs.activityIndicatorShouldShow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,63 @@ final class ChangeEmailViewControllerTests: TestCase {

func testChangeEmail() {
combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(language: language) {
withEnvironment(currentUser: User.template, language: language) {
let controller = ChangeEmailViewController.instantiate()
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)

scheduler.advance()

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

func testChangeEmailScreen_unverifiedEmail() {
let userEnvelope = UserEnvelope(me: UserEmailFields.template |> \.isEmailVerified .~ false)
let service = MockService(changeEmailResponse: userEnvelope)
combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(apiService: service, currentUser: User.template, language: language) {
let controller = ChangeEmailViewController.instantiate()
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)

scheduler.advance()

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

func testChangeEmailScreen_unverifiedEmail_isCreator() {
let creator = User.template
|> \.stats.createdProjectsCount .~ 3
let userEnvelope = UserEnvelope(me: UserEmailFields.template |> \.isEmailVerified .~ false)

combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(apiService: MockService(changeEmailResponse: userEnvelope),
currentUser: creator,
language: language) {
let controller = ChangeEmailViewController.instantiate()
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)

scheduler.advance()

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

func testChangeEmailScreen_undeliverableEmail() {
let userEnvelope = UserEnvelope(me: UserEmailFields.template
|> \.isEmailVerified .~ false
|> \.isDeliverable .~ false)
let service = MockService(changeEmailResponse: userEnvelope)
combos(Language.allLanguages, Device.allCases).forEach { language, device in
withEnvironment(apiService: service, currentUser: User.template, language: language) {
let controller = ChangeEmailViewController.instantiate()
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)

scheduler.advance()

FBSnapshotVerifyView(parent.view, identifier: "lang_\(language)_device_\(device)")
}
}
Expand Down
Loading