Skip to content

Conversation

@rs929
Copy link
Contributor

@rs929 rs929 commented Nov 8, 2023

Overview

  • Refactored all textFields to add additional functionality
  • Removed all error pop up views with error messages below each textField
  • Changed textField color change based on interaction

Changes Made

LabeledTextField Added Finite States: (View FSM Below)

  1. Untouched: No label shown, border is muted grey color and displays placeholder text, border width 1px
  2. Currently Editing: Show label in scoopedDarkGreen, border is scoopedDarkGreen color and border width 2px
  3. Finished Editing:
    a. Has Text: Show label in black, border is black color and border width 1px
    b. No Text: Show label in mutedGrey, border is mutedGrey color and displays placeholder text, border width 1px
  4. Error state: Show label in errorRed, border is errorRed color and border width 1px, and displays proper error message below textField

Refactored and updated interactivity for textFields in the following VCs

  • AboutYouViewController
  • PreferredContactViewController
  • PreferencesViewController
  • FavoritesViewController
  • InitialPostRideViewController
  • PostRideTripDetailsViewController
  • SearchRidesViewController

Screenshots (delete if not applicable)

IMG_2428

Error States:

Copy link
Collaborator

@vinnie4k vinnie4k left a comment

Choose a reason for hiding this comment

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

I just glanced over it but make sure you change [self] to [unowned self] to prevent memory leaks when using a reference of self inside of a closure. Otherwise good to go.

setupTitle(name: "About you")

nextAction = UIAction { _ in
nextAction = UIAction { [self] _ in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change [self] to [unowned self]


return
}
nextAction = UIAction { [self] _ in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change [self] to [unowned self]


guard let phoneNumber = self.numberTextField.textField.text, self.validateNumber(value: phoneNumber) else {
self.presentErrorAlert(title: "Error", message: "Please enter a valid phone number.")
self.numberTextField.displayError()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure you retain an [unowned self]

// MARK: Using OnboardingViewController's views

nextAction = UIAction { _ in
nextAction = UIAction { [self] _ in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change to [unowned self]

guard let arrival = arrivalTextField.textField.text, !arrival.isEmpty,
let departure = departureTextField.textField.text, !departure.isEmpty,
studentDriverButton.isSelected || taxiButton.isSelected
else { return }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put else on the line above


func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.endEditing(true)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

New line below

text = placeholder
}

if let error = error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if let error {

Copy link
Contributor

@tiffany-pann tiffany-pann left a comment

Choose a reason for hiding this comment

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

Very very nice ( •̀ ω •́ )✧

func setup(title: String, placeholder: String? = nil) {
func setup(title: String, placeholder: String? = nil, error: String? = nil) {
var text = title
var errorText = "Please complete this field."
Copy link
Contributor

Choose a reason for hiding this comment

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

let errorText =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants