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

Subscription Support #11

Merged
merged 2 commits into from
Aug 25, 2018
Merged

Subscription Support #11

merged 2 commits into from
Aug 25, 2018

Conversation

zackLore
Copy link
Contributor

@zackLore zackLore commented Aug 4, 2018

I added some changes to add subscription support for Android. I built a test app and have tested the subscriptions successfully.

pubspec.yaml Outdated
@@ -1,6 +1,7 @@
name: flutter_billing
description: A flutter plugin to communicate with billing on iOS and Android.
version: 0.2.3
version: 0.2.4
Copy link
Owner

Choose a reason for hiding this comment

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

There is release.md once merged in I will do release update. Please exclude this change from this commit.

@@ -37,6 +39,9 @@ class BillingProduct {
/// Price in 100s. e.g. $2.49 equals 249.
final int amount;

// Type of product. e.g. SUBS or INAPP
final String type;
Copy link
Owner

Choose a reason for hiding this comment

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

Prefer to use enum instead

final List<Map<String, Object>> products = new ArrayList<>();

for (SkuDetails details : skuDetailsList) {
final Map<String, Object> product = new HashMap<>();
Copy link
Owner

Choose a reason for hiding this comment

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

This section seems to be duplicated code, let's have some private function that maps details to a HashMap and use it here and in original function for products fetching

final Purchase.PurchasesResult subscriptionResult = billingClient.queryPurchases(SkuType.SUBS);
final int subscriptionResponseCode = subscriptionResult.getResponseCode();

if (productResponseCode == BillingResponse.OK) {
Copy link
Owner

Choose a reason for hiding this comment

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

Consider error case, there should be single if condition checking BillingResponse.OK for both products and subscriptions, otherwise error.

@lykhonis
Copy link
Owner

Thank you for your contribution!

@lykhonis
Copy link
Owner

LGTM! Can you please squash your commits into single final one with description and I will merge. Thank you.

@zackLore
Copy link
Contributor Author

zackLore commented Aug 16, 2018 via email

@lykhonis
Copy link
Owner

lykhonis commented Aug 16, 2018 via email

@zackLore
Copy link
Contributor Author

zackLore commented Aug 16, 2018 via email

@lykhonis
Copy link
Owner

Need to resolve conflicts before I can merge

@zackLore
Copy link
Contributor Author

zackLore commented Aug 18, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants