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

[Unticketed] user needs_password not returned in v1/discover/ creator #1758

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ public final class LoginToutViewController: UIViewController, MFMailComposeViewC
AppEnvironment.login(accessTokenEnv)

guard featureFacebookLoginDeprecationEnabled(),
accessTokenEnv.user.needsPassword else {
let needsPassword = accessTokenEnv.user.needsPassword,
needsPassword else {
strongSelf.pushSetYourPasswordViewController()

return
Expand Down
6 changes: 3 additions & 3 deletions KsApi/models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public struct User {
public var location: Location?
public var name: String
public var needsFreshFacebookToken: Bool?
public var needsPassword: Bool
public var needsPassword: Bool?
public var newsletters: NewsletterSubscriptions
public var notifications: Notifications
public var optedOutOfRecommendations: Bool?
Expand Down Expand Up @@ -122,7 +122,7 @@ extension User: Decodable {
self.location = try? values.decodeIfPresent(Location.self, forKey: .location)
self.name = try values.decode(String.self, forKey: .name)
self.needsFreshFacebookToken = try values.decodeIfPresent(Bool.self, forKey: .needsFreshFacebookToken)
self.needsPassword = try values.decode(Bool.self, forKey: .needsPassword)
self.needsPassword = try values.decodeIfPresent(Bool.self, forKey: .needsPassword)
self.newsletters = try User.NewsletterSubscriptions(from: decoder)
self.notifications = try User.Notifications(from: decoder)
self.optedOutOfRecommendations = try values.decodeIfPresent(Bool.self, forKey: .optedOutOfRecommendations)
Expand Down Expand Up @@ -162,7 +162,7 @@ extension User: EncodableType {
result["is_friend"] = self.isFriend ?? false
result["location"] = self.location?.encode()
result["name"] = self.name
result["needs_password"] = self.needsPassword
result["needs_password"] = self.needsPassword ?? false
result["opted_out_of_recommendations"] = self.optedOutOfRecommendations ?? false
result["social"] = self.social ?? false
result["show_public_profile"] = self.showPublicProfile ?? false
Expand Down
2 changes: 1 addition & 1 deletion KsApi/models/UserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class UserTests: XCTestCase {
XCTAssertEqual(true, user.notifications.mobileMarketingUpdate)
XCTAssertEqual(false, user.facebookConnected)
XCTAssertEqual(false, user.isEmailVerified)
XCTAssertTrue(user.needsPassword)
XCTAssertTrue(user.needsPassword!)
XCTAssertEqual(false, user.isFriend)
XCTAssertNotNil(user.location)
XCTAssertEqual(json as NSDictionary?, user.encode() as NSDictionary?)
Expand Down