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

[google_sign_in] Port plugin to use the federated Platform Interface #2266

Merged
merged 5 commits into from
Nov 15, 2019

Conversation

ditman
Copy link
Member

@ditman ditman commented Nov 12, 2019

Description

  • Migrate the 'native' plugin to the Platform Interface
  • Adapt tests to the new API

This is required for plugin federation (to implement the Web version in a separate package)

The GoogleSignInPlatform.instance interface is defined (and implemented) in the google_sign_in_platform_interface package, here.

Related Issues

flutter/flutter#43775

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.

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

LGTM!

 * Refactor endlessly growing --exclude param value into a string that
 gets generated for a list of plugin names.
* Throw in some trailing commas to make dartfmt nicer
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 overall. Left some nits.

final Map<String, dynamic> response =
await channel.invokeMapMethod<String, dynamic>(method);
return _setCurrentUser(response != null && response.isNotEmpty
final dynamic response = await method();
Copy link
Contributor

Choose a reason for hiding this comment

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

what would happen if the method is not an async function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call! It seems to work, though, check this DartPad!

@@ -251,6 +244,7 @@ class GoogleSignIn {
final Completer<void> completer = Completer<void>();
future.whenComplete(completer.complete).catchError((dynamic _) {
// Ignore if previous call completed with an error.
// TODO: Should we log errors here, if debug or similar?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. let's log an error here. Personally, I think we should be clear about things like this error is completely harmless and it is logged for debug purpose only.
@mehmetf I saw that this is added in 4eeb744
Did you recall why did we ignore this error?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll revisit this to add logging, so you guys can discuss how much of it we need :)

(I'd recommend that this gets logged at the lowest level that makes sense, like trace or similar)

@ditman ditman merged commit 1b5eae5 into flutter:master Nov 15, 2019
@ditman ditman deleted the federated_google_sign_in_native branch November 15, 2019 02:37
mormih pushed a commit to mormih/plugins that referenced this pull request Nov 17, 2019
…lutter#2266)

* Port google_sign_in.dart to use the federated Platform Interface, instead of MethodChannels.
* Ignore google_sign_in_platform_interface on all-plugins-app call.
  * Refactor endlessly growing --exclude param value into a string that
 gets generated for a list of plugin names.
hjc22 pushed a commit to hjc22/plugins that referenced this pull request Dec 13, 2019
* newCache/blackVideos: (105 commits)
  [connectivity] Fix reachability stream for iOS (flutter#2281)
  [google_sign_in] Port plugin to use the federated Platform Interface (flutter#2266)
  [webview_flutter] Add async NavigationDelegates (flutter#2257)
  Update cirrus to create IOS simulator on 13.2 an xCode 11 (flutter#2275)
  [battery] Update and migrate iOS example project (flutter#2089)
  [url_launcher] DartDoc and test improvements (flutter#2274)
  [google_maps_flutter] Define clang module for iOS, fix analyzer warnings (flutter#2182)
  [video_player] Add v2 embedding support (flutter#2226)
  [path_provider] Update and migrate iOS example project (flutter#2099)
  [sensors] Documentation and test improvements (flutter#2272)
  [image_picker] Lint for public DartDocs (flutter#2270)
  [connectivity] Lint for public DartDocs (flutter#2269)
  [shared_preferences] Update and migrate iOS example project (flutter#2103)
  [quick_actions] Update and migrate iOS example project (flutter#2100)
  [infra] Ignore analyzer issues in CI (flutter#2271)
  [android_intent] Add missing DartDocs (flutter#2268)
  Bump google_maps_flutter pubspec to match CHANGELOG (flutter#2267)
  [google_sign_in] Handle new style URLs in GoogleUserCircleAvatar (flutter#2252)
  [google_sign_in] Move plugin to its subdir to allow for federated implementations. Add platform interface. (flutter#2244)
  Make setMockInitialValues handle non-prefixed keys (flutter#2260)
  ...

# Conflicts:
#	packages/video_player/CHANGELOG.md
#	packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
#	packages/video_player/ios/video_player.podspec
#	packages/video_player/pubspec.yaml
#	packages/video_player/test/video_player_test.dart
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
…lutter#2266)

* Port google_sign_in.dart to use the federated Platform Interface, instead of MethodChannels.
* Ignore google_sign_in_platform_interface on all-plugins-app call.
  * Refactor endlessly growing --exclude param value into a string that
 gets generated for a list of plugin names.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants