Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_sign_in] Add macOS support #4962

Merged
merged 18 commits into from
Dec 6, 2023

Conversation

stuartmorgan
Copy link
Contributor

@stuartmorgan stuartmorgan commented Sep 21, 2023

Adds macOS support to google_sign_in_ios by moving the existing source to darwin/, adjusting it somewhat to be macOS-compatible, and enabling sharedDarwinSource in the podspec.

Unlike previous cases of code sharing, this doesn't rename the package to be something more generic, since when we do that the name is based on the underlying SDK, and the SDK is still mostly called "Google Sign-In for iOS", so I don't think there's a better name to give it at the moment.

Most of flutter/flutter#46157
(Once this lands, there will be a follow-up PR to update the app-facing package to endorse it and list it in the README.)

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 and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • 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.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@stuartmorgan
Copy link
Contributor Author

test-exempt: Existing tests are being enabled for macOS in this PR (the bot just doesn't recognize the path).

@stuartmorgan
Copy link
Contributor Author

This isn't landable yet since it won't compile for macOS on the current stable, but I wanted to post it to ensure CI doesn't find any other issues. It can be reviewed now though, since the only change to actually land it (modulo fixing anything else CI turns up) will be bumping the min SDK version again after the next stable release.

}
completion(error == nil ? @(granted) : nil, error);
}];
[self addScopes:requestedScopes.allObjects
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason it looks like there are a lot of changes here (and in the previous block) is that switching to the new helper function without presentingViewController changed the indentation of the whole block. The code in the block doesn't have any non-whitespace changes.

code:kGIDSignInErrorCodeHasNoAuthInKeychain
userInfo:nil];
[[self.mockSignIn stub] disconnectWithCallback:[OCMArg invokeBlockWithArgs:error, nil]];
NSError *sdkError = [NSError errorWithDomain:kGIDSignInErrorDomain
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the error renaming is because the macOS build settings catch variable shadowing, which apparently our iOS build doesn't have enabled, and the blocks in all of these methods have an error parameter.

Copy link
Member

Choose a reason for hiding this comment

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

Is there an issue filed to get the iOS lints consistent with the macOS lints? (also raises the question of whether macOS is missing any iOS lints)

hint:nil
additionalScopes:OCMOCK_ANY
callback:OCMOCK_ANY]);
OCMVerify([self configureMock:self.mockSignIn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As with the changes in the implementation file, all of these changes are whitespace changes from the switch to the new configureMock helper.

@stuartmorgan
Copy link
Contributor Author

since the only change to actually land it (modulo fixing anything else CI turns up) will be bumping the min SDK version again after the next stable release

And I'll have to publish a new Flutter Pod so that the pod linter passes.

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

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

The iOS side LGTM, but looks like the macOS side is failing to build with

no visible @interface for 'NSObject<FlutterPluginRegistrar>'

@stuartmorgan
Copy link
Contributor Author

That's:

This isn't landable yet since it won't compile for macOS on the current stable, but I wanted to post it to ensure CI doesn't find any other issues.

The PR uses API that I added to the macOS engine recently, so doesn't exist on stable yet.

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan stuartmorgan added the waiting for stable update Can't be landed until functionality reaches the stable channel label Oct 5, 2023
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

lgtm!

@behrangnm
Copy link

That's:

This isn't landable yet since it won't compile for macOS on the current stable, but I wanted to post it to ensure CI doesn't find any other issues.

The PR uses API that I added to the macOS engine recently, so doesn't exist on stable yet.

How would I test this on my flutter project for building a macos app that uses google_sing_io with your changes?
Thanks for the PR!

@stuartmorgan
Copy link
Contributor Author

How would I test this

See flutter/flutter#46157 (comment)

@FelixMethe
Copy link

Thank you for the PR!
I'm having troubles getting it to work for me.

After completing the authentication in the Google Popup, the Future and the currentUser getter returns null.
(The same code works on iOS)

I can tell that the authentication never completes, as I am missing the email notification from Google.

The only error/warning I get is this:
2023-10-17 16:29:14.739 flutter_google_signin_test[17035:149636] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
This prints when the popup opens.
It appears to be a macOS Sonoma thing. I don't think this is the problem.

@chenenyu
Copy link

Hi, when will this PR be merged? 😆

@stuartmorgan
Copy link
Contributor Author

Hi, when will this PR be merged? 😆

After I have time to manually publish a new FlutterMacOS pod so that CI analysis can pass.

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 6, 2023
@auto-submit auto-submit bot merged commit afd4517 into flutter:main Dec 6, 2023
@stuartmorgan stuartmorgan deleted the google-sign-in-macos branch December 6, 2023 20:14
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 7, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 7, 2023
flutter/packages@ca16173...15584a3

2023-12-07 ditman@gmail.com [gis_web] Migrate to package:web. (flutter/packages#5581)
2023-12-07 kevmoo@users.noreply.github.com Drop quiver usage in several packages (flutter/packages#5595)
2023-12-07 stuartmorgan@google.com [video_player] Unfork publish: for macOS (flutter/packages#5578)
2023-12-07 kevmoo@users.noreply.github.com [web_benchmarks] migrate to pkg:web (flutter/packages#5592)
2023-12-07 43054281+camsim99@users.noreply.github.com [animations] Bump minimum supported Dart version to 3.2 (flutter/packages#5598)
2023-12-06 43054281+camsim99@users.noreply.github.com [animations] Bump minimum Flutter version (flutter/packages#5596)
2023-12-06 6655696+guidezpl@users.noreply.github.com Migrate Material curves to new names (flutter/packages#4898)
2023-12-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[pointer_interceptor] Add ios implementation and move web implementation to federated structure" (flutter/packages#5591)
2023-12-06 louisehsu@google.com [pointer_interceptor] Add ios implementation and move web implementation to federated structure (flutter/packages#5500)
2023-12-06 stuartmorgan@google.com [pigeon] Use dart:io output inheritance for tooling (flutter/packages#5536)
2023-12-06 43759233+kenzieschmoll@users.noreply.github.com Fix benchmark reload bug and migrate away from deprecated `js_util` APIs (flutter/packages#5577)
2023-12-06 stuartmorgan@google.com [google_sign_in] Add macOS support (flutter/packages#4962)
2023-12-06 ian@hixie.ch [rfw,flutter_markdown] Apparently you need a comma to end an //ignore (flutter/packages#5582)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
Adds macOS support to `google_sign_in_ios` by moving the existing source to `darwin/`, adjusting it somewhat to be macOS-compatible, and enabling `sharedDarwinSource` in the podspec.

Unlike previous cases of code sharing, this doesn't rename the package to be something more generic, since when we do that the name is based on the underlying SDK, and the SDK is still mostly called "Google Sign-In for iOS", so I don't think there's a better name to give it at the moment.

Most of flutter/flutter#46157
(Once this lands, there will be a follow-up PR to update the app-facing package to endorse it and list it in the README.)
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
Adds macOS support to `google_sign_in_ios` by moving the existing source to `darwin/`, adjusting it somewhat to be macOS-compatible, and enabling `sharedDarwinSource` in the podspec.

Unlike previous cases of code sharing, this doesn't rename the package to be something more generic, since when we do that the name is based on the underlying SDK, and the SDK is still mostly called "Google Sign-In for iOS", so I don't think there's a better name to give it at the moment.

Most of flutter/flutter#46157
(Once this lands, there will be a follow-up PR to update the app-facing package to endorse it and list it in the README.)
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 p: google_sign_in platform-ios platform-macos waiting for stable update Can't be landed until functionality reaches the stable channel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants