Replace AppleUser with SocialService.User#763
Conversation
| socialService: SocialServiceName? = nil, | ||
| socialServiceIDToken: String? = nil, | ||
| googleUser: GIDGoogleUser? = nil, | ||
| appleUser: AppleUser? = nil) { | ||
| appleUser: SocialService.User? = nil) { |
There was a problem hiding this comment.
Eventually, I think all these social related fields could be collapsed into one custom type to rule them all 💍
| /// A type that can create WordPress.com users given a social users, either coming from Google or Apple. | ||
| protocol SocialUserCreating: AnyObject { |
There was a problem hiding this comment.
This is for the purpose of controlling behavior in the tests.
| let service = loginFields.meta.appleUser.map { | ||
| SocialService.apple(user: $0) | ||
| } |
There was a problem hiding this comment.
1/2 changes from the code deleted above: use map instead of flatMap. There's no need to flatMap because the transformation doesn't return Optional.
|
|
||
| updateLoginFields(email: email, fullName: name, token: token) | ||
|
|
||
| signupService.createWPComUserWithApple( |
There was a problem hiding this comment.
2/2 changes from the code deleted above: use the signupService property instead of instantiating ad hoc.
4f53f04 to
22a7b69
Compare
|
Hey @Gio2018 . My contribution was years ago, and I'm on Day One now. You might want to replace me with someone on the WP team. Sorry! |
Good to see you all!! I take you might have the wrong gio here? 😄 😄 |
Co-authored-by: Tony Li <tony.li@automattic.com>
Instead of using a type with "Apple" in its name as the associated type for
SocialServicecase .apple, we can use a general purpose type,SocialService.User. After all, there is nothing Apple-specific in the email, full name pair and the information that the service used was Google or Apple is already encoded in thecasename.The next step for this will be to make
case .googleuseUser, too, as described in #759. But I need #761 first.The bulk of this PR is actually code to enable testing the change.
@ScoutHarris @jaclync, I asked for your review as suggested by GitHub. I assume that's because you worked on Sing In with Apple? If so, your input would be much appreciated 🙇♂️
CHANGELOG.mdif necessary.