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

[in_app_purchase] Federated Android implementation #3841

Merged

Conversation

mvanbeusekom
Copy link
Contributor

This PR adds the Android implementation of the new "in_app_purchase_platform_interface" (see PR #3781).

Note: when running Flutter commands for the in_app_purchase_android package I keep getting the warning below. I think this is caused by the fact that the in_app_purchase_android is missing a MainActivity.java (since is contains pure plugin code and no example which will be part of the in_app_purchase package), but I am not sure. If I made a configuration mistake I would be happy to fix it.

Warning:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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 Flutter Style Guide and the C++, Objective-C, Java style guides. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format. See plugin_tool format)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin 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.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the 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.

@google-cla
Copy link

google-cla bot commented May 3, 2021

☹️ Sorry, but only Googlers may change the label cla: yes.

@google-cla
Copy link

google-cla bot commented May 3, 2021

☹️ Sorry, but only Googlers may change the label cla: yes.

@cyanglaz
Copy link
Contributor

cyanglaz commented May 3, 2021

since is contains pure plugin code and no example which will be part of the in_app_purchase package

I think we should add examples for this plugin as well, also have a readme to document well how to use only android implementations if people want to (since we advertised it in our readme already)

We should also do the same for the iOS package.

However, these are not priorities since most of the people will use the unified API. But still, I think this can be on our future roadmap. We should create an issue and add TODOs to track it.

I created the issue: flutter/flutter#81695, do you mind adding TODO in this PR?

@@ -0,0 +1,23 @@
/// Thrown to indicate that an action failed while interacting with the
/// in_app_purchase plugin.
class InAppPurchaseException implements Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this android only? Does it make sense to be in the platform_interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment it is only used in the Android package. On iOS we don't need this specific exception. However I can imagine the exception to be useful on other platforms in the future.

So I wasn't sure to add it now to the platform_interface or later if we really need it on multiple platform (by that time we might have forgotten that there is a similar class in the Android implementation).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think it belongs to the platform_interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a separate PR (#3852) which adds the InAppPurchaseException to the platform_interface. Once that is merged I will make sure it gets removed from this PR.

@mvanbeusekom mvanbeusekom force-pushed the iap_federated_android_implementation branch 2 times, most recently from 91f05e7 to b9f9778 Compare May 4, 2021 16:46
@mvanbeusekom
Copy link
Contributor Author

mvanbeusekom commented May 4, 2021

since is contains pure plugin code and no example which will be part of the in_app_purchase package

I think we should add examples for this plugin as well, also have a readme to document well how to use only android implementations if people want to (since we advertised it in our readme already)

We should also do the same for the iOS package.

However, these are not priorities since most of the people will use the unified API. But still, I think this can be on our future roadmap. We should create an issue and add TODOs to track it.

I created the issue: flutter/flutter#81695, do you mind adding TODO in this PR?

No problem at all, but I am not sure where I would add these TODOs (as in which files)? Since there is no example, where would it make the most sense to add a TODO so we encounter it in the future?

@cyanglaz
Copy link
Contributor

cyanglaz commented May 4, 2021

since is contains pure plugin code and no example which will be part of the in_app_purchase package

I think we should add examples for this plugin as well, also have a readme to document well how to use only android implementations if people want to (since we advertised it in our readme already)
We should also do the same for the iOS package.
However, these are not priorities since most of the people will use the unified API. But still, I think this can be on our future roadmap. We should create an issue and add TODOs to track it.
I created the issue: flutter/flutter#81695, do you mind adding TODO in this PR?

No problem at all, but I am not sure where I would add these TODOs (as in which files)? Since there is no example, where would it make the most sense to add a TODO so we encounter it in the future?

In the README.md, we can add todo saying we need to add example apps.

@@ -0,0 +1,23 @@
/// Thrown to indicate that an action failed while interacting with the
/// in_app_purchase plugin.
class InAppPurchaseException implements Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think it belongs to the platform_interface

@mvanbeusekom
Copy link
Contributor Author

mvanbeusekom commented May 5, 2021

In the README.md, we can add todo saying we need to add example apps.

Done. I also added a similar comment to the in_app_purchase_ios README.md file as part of PR #3851.

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

@mvanbeusekom mvanbeusekom merged commit 1a4cee7 into flutter:master May 11, 2021
@mvanbeusekom mvanbeusekom deleted the iap_federated_android_implementation branch May 11, 2021 07:47
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
* Implement BillingClientWrapper and unit-tests

* Android specific implementation

* Moved Android specific methods into addition class

* Added missing line end

* Purchases status to restored after call restorePurchases

* Don't force GooglePlayPurchaseParam

* Implement registerPlatform method

* Added TODO comment to add example

* Fixed mistake in API documentation

* Added additional assert to test enablePendingPurchase

* Update Android implementation with latest platform_interface
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.

3 participants