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

Fix issue #339 #359

Closed
wants to merge 21 commits into from
Closed

Conversation

valterh4ck3r
Copy link
Contributor

No description provided.

Copy link
Contributor

@offline-first offline-first left a comment

Choose a reason for hiding this comment

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

Async issue still exist. This Solution is working, just replace the getPurchaseHistory method with this part:

Future<List<PurchasedItem>?> getPurchaseHistory() async {
    if (_platform.isAndroid) {
      final dynamic getInappPurchaseHistory = await _channel.invokeMethod(
        'getPurchaseHistoryByType',
        <String, dynamic>{
          'type': describeEnum(_TypeInApp.inapp),
        },
      );

      final dynamic getSubsPurchaseHistory = await _channel.invokeMethod(
        'getPurchaseHistoryByType',
        <String, dynamic>{
          'type': describeEnum(_TypeInApp.subs),
        },
      );

      return extractPurchased(getInappPurchaseHistory)! + extractPurchased(getSubsPurchaseHistory)!;
    } else if (_platform.isIOS) {
      dynamic result = await _channel.invokeMethod('getAvailableItems');

      return extractPurchased(json.encode(result));
    }
    throw PlatformException(
        code: _platform.operatingSystem, message: "platform not supported");
  }

@hyochan hyochan added the bugfix label May 16, 2022
Looks like `getAvailableItemsByType` does not handle `inapp`?
Comment on lines 204 to 218
dynamic result1 = await _channel.invokeMethod(
'getAvailableItemsByType',
<String, dynamic>{
'type': describeEnum(_TypeInApp.inapp),
},
);

dynamic result2 = await _channel.invokeMethod(
'getAvailableItemsByType',
<String, dynamic>{
'type': describeEnum(_TypeInApp.subs),
},
);

return extractPurchased(result1)! + extractPurchased(result2)!;
Copy link
Member

Choose a reason for hiding this comment

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

Why remove these lines?

Copy link
Member

Choose a reason for hiding this comment

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

I've made the fix in eb3dc95. This resolves previous tests from failing.

Hope you people can review this before merging 🙏
@offline-first @valterh4ck3r

@codecov
Copy link

codecov bot commented May 16, 2022

Codecov Report

Merging #359 (eb3dc95) into master (5988a56) will decrease coverage by 0.22%.
The diff coverage is 100.00%.

❗ Current head eb3dc95 differs from pull request most recent head e90e3e2. Consider uploading reports for the commit e90e3e2 to get more accurate results

@@            Coverage Diff             @@
##           master     #359      +/-   ##
==========================================
- Coverage   45.97%   45.74%   -0.23%     
==========================================
  Files           3        3              
  Lines         435      435              
==========================================
- Hits          200      199       -1     
- Misses        235      236       +1     
Impacted Files Coverage Δ
lib/flutter_inapp_purchase.dart 54.03% <100.00%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5988a56...e90e3e2. Read the comment docs.

@hyochan hyochan mentioned this pull request May 16, 2022
hyochan added a commit that referenced this pull request May 16, 2022
PR came from #359. The credit goes to @offline-first @valterh4ck3r.
Fixes #356

Co-authored-by: offline-first <info@offlinefirst.net>
Co-authored-by: valterh4ck3r <valterh4ck3r@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants