Skip to content

Conversation

@ditman
Copy link
Member

@ditman ditman commented Apr 7, 2023

This PR:

  1. Renames the old SignInButton widget to UserSignIn. This was done because the old SignInButton did much more than rendering a button (it also rendered the "signed-in" status of the user).
  2. Adds a new SignInButton widget, which has two variants:
    • For native, it is the old implementation
    • For web, it uses the new renderButton widget (this required adding two new "any" dependencies to pubspec)
  3. Tweaks the authentication service a little bit (removed unused scopes, simplified some checks)
  4. Fixes an issue where the top navbar wouldn't update after sign-in/sign-out. (Not sure if there's a github issue for this!)
  5. Regenerates mockito mocks, and helps others do the same down the line :)
  6. Tweaks to the index_page and sidebar.

Issues

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member Author

@ditman ditman left a comment

Choose a reason for hiding this comment

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

Hello new sign-in button!


@override
Widget build(BuildContext context) {
return (GoogleSignInPlatform.instance as GoogleSignInPlugin).renderButton();
Copy link
Member Author

@ditman ditman Apr 8, 2023

Choose a reason for hiding this comment

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

We can tweak the looks of the button, see a configurable demo here:

https://dit-gis-button-test.web.app

@@ -1,299 +1,800 @@
// Mocks generated by Mockito 5.0.15 from annotations
// Mocks generated by Mockito 5.4.0 from annotations
Copy link
Member Author

@ditman ditman Apr 8, 2023

Choose a reason for hiding this comment

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

It's been a while! (August 2021)

<meta charset="UTF-8">
<meta name="google-signin-client_id" content="308150028417-vlj9mqlm3gk1d03fb0efif1fu5nagdtt.apps.googleusercontent.com">
<title>Build Dashboard</title>
<title>Flutter Build Dashboard — Cocoon</title>
Copy link
Member Author

Choose a reason for hiding this comment

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

To improve SEO (for myself) :P

@ditman ditman marked this pull request as ready for review April 8, 2023 03:09
Copy link
Member Author

@ditman ditman Apr 8, 2023

Choose a reason for hiding this comment

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

I had to re-format this file after re-generating it (it seems mockito generates at 80 cols, but the repo is validating at 120). Please consider skipping *.mocks.dart from the formatting checks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively, this could run dart format with the right parameters after mocks are regenerated :/

@ricardoamador
Copy link
Contributor

Nice! Thanks for doing this David! If I can clone your branch I can do a test deploy before merging this.

Use flutter pub get rather than dart.

Co-authored-by: Casey Hillers <caseyhillers@gmail.com>
@ditman ditman self-assigned this Apr 10, 2023
@ditman
Copy link
Member Author

ditman commented Apr 10, 2023

Nice! Thanks for doing this David! If I can clone your branch I can do a test deploy before merging this.

@ricardoamador you should be able to fetch from my remote and clone the branch, I think? I marked the checkbox of "collaborators can do whatever they want" while creating the PR (you should be even able to push to the branch if you want to!)

@ricardoamador
Copy link
Contributor

ricardoamador commented Apr 10, 2023

Cool I will check it out. Validating now.

@ricardoamador
Copy link
Contributor

ricardoamador commented Apr 10, 2023

Okay first run went like this:

Restarted application in 191ms.
[GSI_LOGGER-TOKEN_CLIENT]: Instantiated.
[GSI_LOGGER]: The given origin is not allowed for the given client ID.
[GSI_LOGGER]: Prompt will not be displayed
[google_sign_in_web] Error on CredentialResponse:
[google_sign_in_web] Removing error from `userDataEvents`:
[GSI_LOGGER]: Processing click for button: gsi_283171_880200.

Then it just hangs with the authentication pop up like this:
image

@ditman
Copy link
Member Author

ditman commented Apr 10, 2023

[GSI_LOGGER]: The given origin is not allowed for the given client ID.

@ricardoamador The new JS SDK requires localhost:8080 AND localhost as authorized javascript origins in the configuration of the Client ID:

When you perform local tests or development, you must add both http://localhost and http://localhost:<port_number> to the Authorized JavaScript origins box.

(I bet you'd get this error if you tried to do the same test without any of my changes applied, just from the tip of master!)

@ricardoamador
Copy link
Contributor

Okay validated the change and it now works with the google login.
image

Copy link
Contributor

@ricardoamador ricardoamador left a comment

Choose a reason for hiding this comment

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

LGTM!

@ditman ditman added the autosubmit Merge PR when tree becomes green via auto submit App. label Apr 10, 2023
@auto-submit auto-submit bot merged commit 5e711dc into flutter:main Apr 10, 2023
@ditman ditman deleted the use-new-sign-in-button branch April 10, 2023 22:36
@ditman
Copy link
Member Author

ditman commented Apr 10, 2023

Thanks @CaseyHillers @ricardoamador for the super quick review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build dashboard sign in silently is failing cocoon is using libs that are being deprecated soon

3 participants