Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[google_sign_in] Fix "pick account" on iOS #2587

Closed

Conversation

JanKn
Copy link

@JanKn JanKn commented Mar 7, 2020

Description

iOS Google Sign-in flow was always forcing user to fill email and password, the null check fixes the account picker, so the flow suggest Google Accounts already signed-in on iOS device.

Related Issues

Fixes: flutter/flutter#48602

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

Sign-in flow was always forcing user to fill email and password, the null check fixes the account picker, so the flow suggest Google Accounts already signed-in on iOS device.

flutter/flutter#48602
@JanKn JanKn changed the title [google_sign_in]: Fix "pick account" on iOS [google_sign_in] Fix "pick account" on iOS Mar 7, 2020
@JanKn
Copy link
Author

JanKn commented Mar 20, 2020

Cc @cyanglaz

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM modulo the version updates. Thank you so much for fixing this! Do you think you can add tests for this?

@@ -1,5 +1,6 @@
## 4.1.5

* Fix flutter/flutter#48602 iOS flow shows account selection, if user is signed in to Google on the device.
Copy link
Contributor

Choose a reason for hiding this comment

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

You might need to rebase and fix the version.

@JanKn
Copy link
Author

JanKn commented Mar 21, 2020

Sure I think it might be possible to mock GoogleSignIn iOS library and do at least a unit test for the plugin that it sends "nil" to GoogleSignIn iOS library if the hostedDomain is not set (and correct hosted domain if it is set).
Or may be even E2E plugin test to the same point. However I am not an iOS developer and iOS side of testing is missing in the guidance. Checking the iOS WebView if it displays the account selection will be quite an effort :-)
Do you have some sample where I can get some inspiration on how to do this in iOS @cyanglaz ?

@cyanglaz
Copy link
Contributor

#2599 is setting up unit test in iOS and android as well as adding some tests. You can follow that pattern when it is landed.

@enzobonggio
Copy link

this is must have for an app that have social login. What is needed in order to merge this one? Could I help with something?

@Zfinix
Copy link

Zfinix commented Jul 29, 2020

Hi can this be merged already its a real issue that affects my apps UX

@cyanglaz
Copy link
Contributor

Hi @JanKn, it's been a while since the unit tests are set up for the plugin. Do you plan to add tests for this PR? I can land it after you adding the tests.

@atrope
Copy link
Member

atrope commented Oct 6, 2020

@cyanglaz && @JanKn do you intend to finish this PR? It's a terrible UX for iOS Users..

@orestesgaolin
Copy link

@cyanglaz && @JanKn do you intend to finish this PR? It's a terrible UX for iOS Users..

@atrope what I can recommend for now is to fork the plugin; I'm doing this right now and it works pretty well

Sample fork:

dependency_overrides:
  google_sign_in:
    git:
      url: https://github.com/orestesgaolin/plugins.git
      path: packages/google_sign_in/google_sign_in
      ref: fix/ios-sign-in-with-google

@scaraux
Copy link

scaraux commented Oct 23, 2020

Can this be merged please this is a huge UX issue and blocker for our app. 🙏

@atrope
Copy link
Member

atrope commented Oct 27, 2020

@cyanglaz Which test should be done on this PR so it get merged? Just like it does not have tests for "clientId" i don't see which tests we have to create for this change..
This is long Stalled and i could code the test but i can't see any

@JanKn
Copy link
Author

JanKn commented Nov 4, 2020

@atrope I was looking at it myself couple of weeks ago. My main issue for me was to actually run the tests in the latest XCode (I am mostly Android dev and I did not find any documentation on how to run tests on this project).
The change in this PR is making sure that hostedDomain is set to "nil" on iOS side of the Platform Plugin in case hostedDomain is not set from the Flutter platform channel call.
I wanted to create a test for this behavior. (The test should fail on master, but pass on this PR)

To check:
[GIDSignIn sharedInstance].hostedDomain = nil;

I did not have much time to investigate it more, thanks for help.

@atrope
Copy link
Member

atrope commented Dec 22, 2020

@cyanglaz this is a one liner PR affecting a major UX..
Almoçar 1 year and still not merged..
What should we do to get this merged?

I Can't believe 1 liner code should take this long to reach master..

@cyanglaz
Copy link
Contributor

cyanglaz commented Jan 7, 2021

@atrope We should add a test to check if [GIDSignIn sharedInstance].hostedDomain is nil when [NSNull null] is passed from method channel. There are some similar tests here: https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/ios/Tests/GoogleSignInPluginTest.m

@vmeretin
Copy link
Contributor

vmeretin commented Mar 9, 2021

Any news?

@vmeretin
Copy link
Contributor

@cyanglaz Tried to write required test here #3805

@cyanglaz
Copy link
Contributor

@JanKn Thank you again for providing the PR, unfortunately I'm going to close this in favor of #3805
The other PR is closer to land as it has tests.

Please feel free to keep contributing to our repo :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[google_sign_in] Not redirect to "Choose an account"