Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Finalize federated architecture #40

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

Merged

Conversation

Copy link
Contributor

@JeroenWeener JeroenWeener commented Mar 14, 2023

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

This PR updates the app-facing package of the google-api-availability to make use of the previously published google-api-availability-platform-interface and google-api-availability-android packages. This concludes #33, finishing our work on making this plugin use the federated architecture.

In the process, the example has been updated and an issue in the PR template has been resolved.

⤵️ What is the current behavior?

The package contains an android implementation and uses this to achieve its functionality.

🆕 What is the new behavior (if this is a feature change)?

The package will use the aforementioned packages to achieve the same functionality in a federated way.

💥 Does this PR introduce a breaking change?

Yes it does, as we no longer support iOS (we never actually did, but now we mention it).

🐛 Recommendations for testing

App-facing tests have been updated.
As models have moved around, we should make sure that all the right classes are exposed to the end-user.

📝 Links to relevant issues/docs

Closes #33.

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current develop

Copy link

@paulppn paulppn left a comment

Choose a reason for hiding this comment

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

Some small things from me

@@ -1,3 +1,7 @@
## 1.0.0+1

* Declares `dartPluginClass` in pubspec declaration.
Copy link

Choose a reason for hiding this comment

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

I am not sure why these files are in the PR, they are already in the main branch right? Is your branch up to date with main?

Copy link
Contributor Author

@JeroenWeener JeroenWeener Mar 14, 2023

Choose a reason for hiding this comment

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

Turns out it was not. I have reread https://github.com/flutter/flutter/wiki/Tree-hygiene to learn how to do it and fixed it.

@@ -1,4 +1,4 @@
library google_api_availability;

export 'src/google_api_availability.dart';
export 'src/models/google_play_services_availability.dart';
export 'package:google_api_availability_platform_interface/google_api_availability_platform_interface.dart';
Copy link

Choose a reason for hiding this comment

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

I don't think this is correct, why would you export a different package?

Copy link
Contributor Author

@JeroenWeener JeroenWeener Mar 14, 2023

Choose a reason for hiding this comment

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

We export a model that can be returned from a function call. As the model resides in the platform code, we need to export it here (as the end-user might not have a dependency on the platform interface).

I changed the export to export only the model itself, as I do agree this is exposes too much.

/// Creates an instance of the [GoogleApiAvailability] class.
///
/// This constructor is exposed for testing purposes only and should not be
/// used by clients of the plugin as it may break or change at any time.
@visibleForTesting
const GoogleApiAvailability.private();

/// Acquires an instance of the [GoogleApiAvailability] class.
static const GoogleApiAvailability instance = GoogleApiAvailability._();
Copy link

Choose a reason for hiding this comment

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

I am genuinly not sure about this, so just asking, but does GoogleApiAvailability._() equal null? Since you use that below to actually check both of them, why not just change it here to a nullable?

Copy link
Contributor Author

@JeroenWeener JeroenWeener Mar 14, 2023

Choose a reason for hiding this comment

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

I agree that this might be a little confusing; there is both GoogleApiAvailability and GoogleApiAvailabilityPlatform, both implementing the singleton pattern (having instances). The _() and private() constructors of GoogleApiAvailability construct an instance of the class. In Dart, things starting with an _ are considered private, and cannot be called by outsiders. This is great for implementing the singleton pattern, as we can now prevent the end user from accidentally instantiating the class multiple times. To make sure tests can still instantiate as much as they want, we expose the constructor private(), marked with @visibleForTesting.

The check we do at the method calls considers the instance of the platform interface, and is unrelated to GoogleApiAvailability.

@JeroenWeener JeroenWeener force-pushed the enhancement/finalize-federated-architecture branch from d662303 to 0783ef5 Compare March 14, 2023 11:45
Copy link

@paulppn paulppn left a comment

Choose a reason for hiding this comment

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

Two small nits, if you change those it is fine with me.

@@ -1,11 +1,16 @@
## 5.0.0

* **BREAKING CHANGE**: No longer supports iOS, as it was never truly supported.
Copy link

Choose a reason for hiding this comment

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

"Removes support for iOS, as it was never truly supported."

JeroenWeener reacted with thumbs up emoji
@@ -10,16 +10,18 @@ environment:
dependencies:
flutter:
sdk: flutter
meta: ^1.8.0
google_api_availability_android: ^1.0.0+1
google_api_availability_platform_interface: ^1.0.0
Copy link

Choose a reason for hiding this comment

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

You can also upgrade this version since I merged the other one, Maurits will have to release all of them though.

JeroenWeener reacted with thumbs up emoji
@JeroenWeener JeroenWeener force-pushed the enhancement/finalize-federated-architecture branch from 83c5341 to 8848f15 Compare March 23, 2023 15:40
@paulppn paulppn merged commit 7a01d7e into Baseflow:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@mvanbeusekom mvanbeusekom Awaiting requested review from mvanbeusekom

1 more reviewer

@paulppn paulppn paulppn approved these changes

Reviewers whose approvals may not affect merge requirements
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Refactor to use Federated Plugin Architecture

AltStyle によって変換されたページ (->オリジナル) /