Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

[NEW] Let user update name, username, email, password and avatar #1368

Merged
merged 74 commits into from
Mar 23, 2018

Conversation

filipealva
Copy link
Collaborator

@filipealva filipealva commented Mar 1, 2018

@RocketChat/ios

Closes #962

// }, errored: { error in
// print(error)
// })
let setAvatarRequest = SetAvatarRequest(userId: userId, avatar: UIImage(named: "Launch Screen Icon")!)

Choose a reason for hiding this comment

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

Force Unwrapping Violation: Force unwrapping should be avoided. (force_unwrapping)

if newPassword == passwordConfirmation {
password = newPassword
} else {
// TODO: Alert about password confirmation not matching

Choose a reason for hiding this comment

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

Todo Violation: TODOs should be avoided (Alert about password confirmat...). (todo)

guard let user = user, let userId = user.identifier else { return }
guard let name = name.text, let username = username.text, let email = email.text,
!name.isEmpty, !username.isEmpty, !email.isEmpty else {
// TODO: Alert about empty fields

Choose a reason for hiding this comment

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

Todo Violation: TODOs should be avoided (Alert about empty fields). (todo)

@rafaelks rafaelks changed the title [WIP] Let user update name, username, email, password and avatar [WIP][NEW] Let user update name, username, email, password and avatar Mar 2, 2018
@rafaelks rafaelks added this to the 2.1.0 milestone Mar 2, 2018
return true
}

}

Choose a reason for hiding this comment

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

File Line Length Violation: File should contain 400 lines or less: currently contains 420 (file_length)

import MBProgressHUD
import SwiftyJSON

class EditProfileTableViewController: UITableViewController, MediaPicker {

Choose a reason for hiding this comment

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

Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 224 lines (type_body_length)


// MARK: Actions

@IBAction func saveProfile(_ sender: UIBarButtonItem) {

Choose a reason for hiding this comment

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

Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)

}

guard email.isValidEmail else {
Alert(key: "alert.update_profile_empty_fields").present() // TODO: Add invalid e-mail strings

Choose a reason for hiding this comment

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

Todo Violation: TODOs should be avoided (Add invalid e-mail strings). (todo)

return true
}

}

Choose a reason for hiding this comment

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

File Line Length Violation: File should contain 400 lines or less: currently contains 428 (file_length)

import MBProgressHUD
import SwiftyJSON

class EditProfileTableViewController: UITableViewController, MediaPicker {

Choose a reason for hiding this comment

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

Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 230 lines (type_body_length)


// MARK: Actions

@IBAction func saveProfile(_ sender: UIBarButtonItem) {

Choose a reason for hiding this comment

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

Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 42 lines (function_body_length)

return true
}

}

Choose a reason for hiding this comment

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

File Line Length Violation: File should contain 400 lines or less: currently contains 437 (file_length)

import MBProgressHUD
import SwiftyJSON

class EditProfileTableViewController: UITableViewController, MediaPicker {

Choose a reason for hiding this comment

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

Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 233 lines (type_body_length)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this warning is valid, but maybe try splitting the MediaPicker conformance into an extension below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The warning is valid, but the MediaPicker conformance is implemented into the MediaPicker extension, so it wouldn't decrease a line of the body :/

return true
}

}

Choose a reason for hiding this comment

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

File Line Length Violation: File should contain 400 lines or less: currently contains 429 (file_length)

import MBProgressHUD
import SwiftyJSON

class EditProfileTableViewController: UITableViewController, MediaPicker {

Choose a reason for hiding this comment

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

Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 226 lines (type_body_length)

@filipealva
Copy link
Collaborator Author

Guys, I tried to clean up the most I could without overthinking on how to fit the 400/200 lines to satisfy SwiftLint.

Should we ignore the type_body_length and file_length?

@filipealva filipealva changed the title [WIP][NEW] Let user update name, username, email, password and avatar [NEW] Let user update name, username, email, password and avatar Mar 15, 2018
Copy link
Contributor

@rafaelks rafaelks left a comment

Choose a reason for hiding this comment

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

Great! Thank you @filipealva!

@rafaelks rafaelks merged commit 9e21696 into develop Mar 23, 2018
@rafaelks rafaelks deleted the feature/user-profile branch March 23, 2018 13:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants