-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_sign_in] Adds support to send clientId
as a parameter
#3640
Conversation
I'm not exactly sure how to update |
Thanks for the contribution! Looks like this is a pretty straightforward PR, so we can try to get it reviewed quickly. It will need tests though, per the contribution guidelines (you've checked the box, but there are no test files changed in the PR, so if there are test changes they were left out of the PR).
The release is now stable, so you can proceed here as normal once you merge in master. |
@stuartmorgan I forgot to push my test commit. Now this PR should be complete |
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.
=
@@ -77,7 +77,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result | |||
ofType:@"plist"]; | |||
if (path) { | |||
NSMutableDictionary *plist = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; | |||
[GIDSignIn sharedInstance].clientID = plist[kClientIdKey]; | |||
[GIDSignIn sharedInstance].clientID = [call.arguments objectForKey:@"clientId"] ?: plist[kClientIdKey]; |
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 think we also need to check [[call.arguments objectForKey:@"clientId"] isEqualTo:[NSNull null]]
Maybe refactor it out to a local bool var:
BOOL hasDynamicClientId = [[call.arguments objectForKey:@"clientId"] isKindOfClass:NSString.class]
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.
You mean checking if clientId
is a NSString
object? Because ternary operator ?:
will already check for nullability
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.
So we need to check != nil and != [NSNull null]
Checking is a NSString
covers both cases.
@@ -30,6 +30,7 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { | |||
'signInOption': signInOption.toString(), | |||
'scopes': scopes, | |||
'hostedDomain': hostedDomain, | |||
'clientId': clientId, |
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.
This change need to be published first.
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.
@cyanglaz You mean in a separate PR? I can create a new one with only this change
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.
Yep, we need this in a separate PR and a version bump for the platform_interface. Then google_sign_in needs to dep on the new version.
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 landed #3686. Once published, this PR should update the platform interface dependency to 2.0.1 . |
@cyanglaz Updated and Rebased |
Looks like there's some issue with the format CI, could you fix it? The lint_darwin ci could be fixed by rebasing master I believe |
@cyanglaz Formatting issues fixed and branched rebased master |
This pull request is not suitable for automatic merging in its current state.
|
1 similar comment
This pull request is not suitable for automatic merging in its current state.
|
@cyanglaz I don't understand the failing output from the CI build:
Could you help me understand what is going wrong here so I can fix it? |
That failure is due to a change in Flutter itself; you'll need to merge master in again to pick up the corresponding fix in flutter/plugins. |
…n and updates CHANGELOG
This PR introduces the ability to send
clientId
as a parameter ingoogle_sign_in
plugin. It priorizes the parameterizedclientId
in iOS and Android platforms. If it wasn't send, then they try to fetch it fromGoogleService-info.plist
andgoogle-services.json
respectively.List which issues are fixed by this PR. You must list at least one issue.
Pre-launch Checklist
[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.