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

Implemented validation for EditProfileVC #73

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

caitlynjin
Copy link
Contributor

@caitlynjin caitlynjin commented Nov 1, 2023

Overview

Implemented validation for the edit profile page.

Changes Made

Edit Profile Page

  • In EditProfileViewController, modified saveEdit so that the user is unable to save their edits if any of the following apply:
    • Any of the text fields are left blank.
    • The name field is less than or greater than two words long (must only include first and last name).
    • (Temporary) Error statements in terminal for these two cases. Will be deleted after new text fields are implemented.
  • Once exiting a text field, trims the extra whitespace the user may have inputted into the text fields.
  • Once exiting a text field, checks whether the text fields are completed (using the same conditions as above) with textFieldsComplete, and if so, changes the opacity of the button to its respective state using setSaveButtonColor.

Test Coverage

  • Did manual testing to ensure functionality.

Screenshots

Validation
edit-profile-validation.mp4

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.

Before I approve this PR, I need to see what this PR is actually doing. At this moment, I am confused on how you are invalidating. Will the save button be grayed out and disabled? Will they still be able to save but an error pops up? Will the textfields be outlined red?

Please provide a screenshot of what you implemented as well as a more detailed description about how you are preventing the user. I would also communicate this with design to see how they want to deal with this.

let snack = snackTextField.getText(), !snack.isEmpty,
let song = songTextField.getText(), !song.isEmpty,
let stop = stopTextField.getText(), !stop.isEmpty else {
print("Error: Please complete all fields")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am really against having these error statements printed out because it clutters the console and is unnecessary as the UI should tell you if it's invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the button color change and updated the PR. Richie said that he would change the custom text fields, so displaying the error would be dealt with later. The print statements are just temporary in place of that for now.

self.stop = stop

guard let nameArray = nameTextField.getText()?.split(separator: " "), nameArray.count == 2 else {
print("Error: Name field does not contain first and last name")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also want to communicate with @rs929 about having the successful print statements for every network request. I was guilty of doing this before, but I now realize that it clogs up the console and makes it difficult to debug, especially since you can have tons of network requests. If you don't see an error message then you can assume that it succeeded.

@tiffany-pann Let me know what you think as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missed this notification but I agree, perhaps we can just comment out for now and re-comment if we need to debug networking

- Created text field completion function that returns whether the fields are filled out and the name field contains both first and last name
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.

🚙🚙

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.

3 participants