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

[in_app_purchase] Add alternative billing apis for android #6056

Merged

Conversation

reidbaker
Copy link
Contributor

@reidbaker reidbaker commented Feb 5, 2024

  • Update the emulator versions and expose cipd. (Update the emulator versions and expose cipd. #6025
  • Enable alternitive billing only available check, add test and code to handle service unavilable in getBillingConfig
  • Enable alternative billing only during client creation and tests covering fallback path
  • ShowAlternativeBillingDialog android native method added
  • Add tests for null activity behavior
  • Remove not needed lines of code
  • Add showAlternativeBillingOnlyInformationDialog and isAlternativeBillingOnlyAvailable to android platform addition and billing client wrapper.
  • test showAlternativeBillingOnlyInformationDialog and isAlternativeBillingOnlyAvailable in platfrom addition and billing_client

Fixes flutter/flutter/issues/142618

Still left TODO:

  • incorporate new apis into example app
  • expose alternative billing only dart api
  • Expose alternative billing reporting details
  • Configure end to end working example with playstore

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 [linked to 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.

@reidbaker reidbaker marked this pull request as ready for review February 5, 2024 20:11
@@ -1,3 +1,7 @@
## 0.3.0+19
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: As a new feature it should be incrementing the "minor" version (which for <1.0 in Dart convention is the third instead of the second), so this should be 0.3.1.

Copy link
Contributor Author

@reidbaker reidbaker Feb 6, 2024

Choose a reason for hiding this comment

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

Fixed, and thank you for letting me know.
I do think that it is weird that0.3.0+19 is less than 0.3.1

@reidbaker
Copy link
Contributor Author

This code is in its final intended state.
I am trying to understand why we have a test failing. When I run the same command from the logs it passes for me

@reidbaker reidbaker marked this pull request as draft February 9, 2024 19:53
@reidbaker reidbaker marked this pull request as ready for review February 12, 2024 17:18
@reidbaker
Copy link
Contributor Author

Requesting re-review because I had to modify a decent bit of code to support billing mode as an enum.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gmackall gmackall left a comment

Choose a reason for hiding this comment

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

LGTM


if (billingChoiceMode == BillingChoiceMode.ALTERNATIVE_BILLING_ONLY) {
// https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app
builder.enableAlternativeBillingOnly();
Copy link
Member

@gmackall gmackall Feb 12, 2024

Choose a reason for hiding this comment

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

Not an actionable comment, but: Interesting that the billing client builder example they show at the link doesn't call enablePendingPurchases. That must be a mistake in their documentation, right? It is documented as required in all circumstances
https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder#enablePendingPurchases()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I am not sure. Organizationally I think it should be safe to include because if the caller was going to use alternative billing only then there are no pending purchases to enable or if there are all that happens on the callers side since they are providing the billing implementation.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 12, 2024
@auto-submit auto-submit bot merged commit 41a0078 into flutter:main Feb 12, 2024
78 checks passed
@reidbaker reidbaker deleted the i142618-alternitive-billing-api-intro branch February 12, 2024 21:01
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 13, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 13, 2024
flutter/packages@0a69259...9385bbb

2024-02-13 [email protected] Convert startProductRequest(), finishTransaction(), restoreTransactions(), presentCodeRedemptionSheet() to pigeon (flutter/packages#6032)
2024-02-13 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump org.json:json from 20231013 to 20240205 in /packages/in_app_purchase/in_app_purchase/example/android/app (flutter/packages#6096)
2024-02-12 [email protected] [local_auth] Rename iOS classes (flutter/packages#6108)
2024-02-12 [email protected] [video_player_android] Handle BehindLiveWindowException (flutter/packages#5869)
2024-02-12 [email protected] [in_app_purchase] Add alternative billing apis for android (flutter/packages#6056)
2024-02-12 [email protected] [webview_flutter] Update compileSdk to 34 (flutter/packages#6106)
2024-02-12 [email protected] [cupertino_icons] Add example to cupertino icons (flutter/packages#5312)

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 [email protected],[email protected] 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
@fareesh
Copy link

fareesh commented Mar 4, 2024

Seems there is a deadline to switch from manual reporting to the API by March 13. Is there a chance this will be in a release prior to that? Else we'll have to use a patched version or implement our own and then switch over

@stuartmorgan
Copy link
Contributor

This was released three weeks ago.

@reidbaker
Copy link
Contributor Author

reidbaker commented Mar 7, 2024

Most all of the apis are available except the combined user choice billing. To get the latest android plugin you will need to reference the android version that was recently released.

Also if you are planning on using these apis I would welcome your code review on #6162 which I am hoping to land soon.
@fareesh

arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
)

- Update the emulator versions and expose cipd. (flutter#6025
- Enable alternitive billing only available check, add test and code to handle service unavilable in getBillingConfig
- Enable alternative billing only during client creation and tests covering fallback path
- ShowAlternativeBillingDialog android native method added
- Add tests for null activity behavior
- Remove not needed lines of code
- Add showAlternativeBillingOnlyInformationDialog and isAlternativeBillingOnlyAvailable to android platform addition and billing client wrapper.
- test showAlternativeBillingOnlyInformationDialog and isAlternativeBillingOnlyAvailable in platfrom addition and billing_client

Fixes flutter/flutter/issues/142618

Still left TODO: 
* [x] incorporate new apis into example app 
* [x] expose alternative billing only [dart api](https://github.com/flutter/packages/pull/6056/files/d4c445422f2cd3f0627f575d85b59b559e0e9f69#r1480455450)
* [x] Expose alternative billing reporting details
* [ ] Configure end to end working example with playstore
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: in_app_purchase platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[in_app_purchase] Support Alternative billing apis
5 participants