-
Notifications
You must be signed in to change notification settings - Fork 437
[NEW] Let user update name, username, email, password and avatar #1368
Conversation
…ead of UserInfoRequest
…ure all endpoints are working properly
// }, errored: { error in | ||
// print(error) | ||
// }) | ||
let setAvatarRequest = SetAvatarRequest(userId: userId, avatar: UIImage(named: "Launch Screen Icon")!) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
…eric upload request its name shouldn't suggest it
… to upload an avatar
…hod name can better reflects what the method does
…nching media related sources
… ask for current password when updating the e-mail
…ittle issues that were causing to update the in memory user data even on a request failure
return true | ||
} | ||
|
||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
…updated then show the success alert
return true | ||
} | ||
|
||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)
…upress some warnings
return true | ||
} | ||
|
||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
} | ||
|
||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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)
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 |
There was a problem hiding this 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!
@RocketChat/ios
Closes #962