Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Conversation

@ScoutHarris
Copy link
Contributor

@ScoutHarris ScoutHarris commented Aug 22, 2019

Description

Fixes #n/a

This does two things:

  1. Adds an apple service name. This was needed for the associated WPAuth change.
  2. Adds Apple specific parameters to the social-login/connect endpoint. This wasn't needed yet, but hey, while we're here...

Testing Details

This can be tested with WPiOS PR: wordpress-mobile/WordPress-iOS#12360
Ref WPAuth PR: wordpress-mobile/WordPressAuthenticator-iOS#117

  • Please check here if your pull request includes additional test coverage.

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

Just a query about the parameters for the social method!

public func connectToSocialService(_ service: SocialServiceName, serviceIDToken token: String, oAuthClientID: String, oAuthClientSecret: String, success:@escaping (() -> Void), failure:@escaping ((NSError) -> Void)) {
public func connectToSocialService(_ service: SocialServiceName,
serviceIDToken token: String,
appleEmail: String? = nil,
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like these apple parameters don't really belong in here 🤔 The method can be used for any service, so having apple specific parameters there if you're using Google doesn't feel quite right to me (even though you can ignore them because of the defaults).

How about if we just accept a parameters dictionary, which we can append to our own params? We could add a separate method to generate it, like appleSignInParameters(email:fullName:), so the client doesn't need to know the correct keys for those items.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or we could just pass in userEmail and userFullName, and the services can do with them what they want (or ignore them)

@ScoutHarris
Copy link
Contributor Author

Hey @frosty . Changes made and ready for another review please.

@ScoutHarris ScoutHarris requested a review from frosty August 22, 2019 17:37
Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

Hey, one more suggestion for a tweak to make the method less Apple centric.

serviceIDToken token: String,
appleEmail: String? = nil,
appleFullName: String? = nil,
appleConnectParameters: [String:AnyObject]? = nil,
Copy link
Contributor

Choose a reason for hiding this comment

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

So could we just name this connectParameters? Perhaps the doc comment could say "currently only used for the Apple service".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

if service == .apple {
params["user_email"] = appleEmail as AnyObject
params["user_name"] = appleFullName as AnyObject
if service == .apple, let appleConnectParameters = appleConnectParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could just always append the parameters regardless of the service, then we don't need special conditional code for Apple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured it's better not to append them just in case, but ok.

@ScoutHarris
Copy link
Contributor Author

ScoutHarris commented Aug 22, 2019

make the method less Apple centric.

I'm not trying to make it Apple centric. I'm trying to point out that these params are for Apple only. But ok, I'll generalize everything and just have a comment.

@ScoutHarris
Copy link
Contributor Author

OK @frosty . One more time (🤞 ) please kind sir.

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

Thank you for putting up with my suggestions! Looks good! 👍

@ScoutHarris ScoutHarris merged commit 161630c into develop Aug 23, 2019
@ScoutHarris ScoutHarris deleted the feature/add_apple_social_service branch August 23, 2019 01:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants