-
Notifications
You must be signed in to change notification settings - Fork 0
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
Redo networking because of backend changes #137
Conversation
let userGoogleId = user.googleID { | ||
profileImageView.kf.setImage(with: Base64ImageDataProvider(base64String: profilePictureURL, cacheKey: userGoogleId)) | ||
} | ||
/* |
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.
I'm commenting this out for now because our server has some outdated users with the wrong profile photo string, which causes app to crash. Will comment back in when backend does this.
Pear/View/MeetupStatusView.swift
Outdated
.socialMediaLinks(instagram: user.instagram, facebook: user.facebook) | ||
.normalFont(".") | ||
} | ||
// if user.instagram != nil || user.facebook != nil { |
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.
Comment out for now because backend took social media out of user model but I'm requesting they add it back. Will uncomment when that is done.
Pear/View/MeetupStatusView.swift
Outdated
.socialMediaLinks(instagram: user.instagram, facebook: user.facebook) | ||
.normalFont(".") | ||
} | ||
// if user.instagram != nil || user.facebook != nil { |
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.
Comment out for now because backend took social media out of user model but I'm requesting they add it back. Will uncomment when that is done.
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.
Looks great 🤩
self.setUserAndTabPage(newUser: newUser) | ||
self.getUserMatchThen(netId: newUser.netID) { [weak self] matches in | ||
guard let self = self else { return } | ||
if self.user == nil || self.user != newUser { |
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.
I haven't checked, but just be sure that ==
is defined as you expect for the user
object.
self.profileImageView.kf.setImage(with: Base64ImageDataProvider(base64String: newUser.profilePictureURL, cacheKey: newUser.googleID)) | ||
let firstActiveMatch = newUser.matches.filter({ $0.status != "inactive" }).first | ||
self.setupTabPageViewController(with: firstActiveMatch, user: newUser) | ||
private func setUserAndTabPage(newUser: User, match: Match? = nil ) { |
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.
Delete space before )
.
guard result.success else { | ||
print("Network error: could not get user's pair.") | ||
return | ||
} | ||
closure(result.data) |
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.
I would call it something more descriptive (and consistent with other places), like completion
Pear/Models/CommunityUser.swift
Outdated
@@ -19,7 +19,7 @@ struct CommunityUser: Codable { | |||
let lastName: String? | |||
let major: String? | |||
let netID: String? | |||
let profilePictureURL: String? | |||
// let profilePictureURL: String? |
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.
Delete?
let lastName: String | ||
let major: String | ||
let netID: String | ||
let hometown: String |
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.
alphabetize
guard response.success else { | ||
print("Network error: could not get user match.") | ||
return |
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.
When a success doesn't even work :(
Pear/Models/User.swift
Outdated
static func == (lhs: User, rhs: User) -> Bool { | ||
lhs.firstName == rhs.firstName && | ||
lhs.goals == rhs.goals && | ||
lhs.googleID == rhs.googleID && | ||
lhs.graduationYear == rhs.graduationYear && |
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 you enforce any invariants on the backend, but this could probably just be lhs.netID == rhs.netID
since a user should not be able to sign up twice w/ the same ID (something would be broken then). Just a thought, but feels like cheating.
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.
looks good!! 😊
} | ||
} | ||
|
||
private func getUserAvailabilitiesThen(_ closure: @escaping ([DaySchedule]) -> Void) { |
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.
to keep it uniform, call this completion
instead of closure
?
func getMatchHistory(netID: String) -> Future<Response<[Match]>> { | ||
networking(Endpoint.getMatchHistory(netID: netID)).decode() | ||
} | ||
|
||
// MARK: - Stored |
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.
what does Stored mean?
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.
just temporarily hard coded stored values
Overview
Backend changed up their backend models to make the code more stable cuappdev/pear-backend#49 . In this PR, I change our models to fit their new model.
Changes Made
Test Coverage
Next Steps (delete if not applicable)
Related PRs or Issues (delete if not applicable)
#134
Screenshots (delete if not applicable)
Screen Shot Name