Skip to content

[in_app_purchase] add storefront in skpaymentqueuewrapper #5348

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
merged 5 commits into from
Nov 15, 2023

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Nov 7, 2023

Add Future<SKStorefrontWrapper?> storefront() method in SKPaymentQueue wrapper

fixes flutter/flutter#137560

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 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, 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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

update changelog

fix test version check
@@ -21,6 +21,8 @@ typedef void (^UpdatedDownloads)(NSArray<SKDownload *> *downloads);

@property(NS_NONATOMIC_IOSONLY, weak, nullable) id<SKPaymentQueueDelegate> delegate API_AVAILABLE(
ios(13.0), macos(10.15), watchos(6.2));
@property(NS_NONATOMIC_IOSONLY, readonly, nullable)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we only want this to be nonatomic on iOS? Surely we don't have different threading semantics for macOS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The storefront property in SKPaymentQueue is nonatomic on iOS. I tried to keep it the sam way but yeah we don't need it. Will revert to nonatomic for all.

}
result([FIAObjectTranslator getMapFromSKStorefront:storefront]);
return;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: no need to wrap code after an early return in else.

@@ -139,6 +141,22 @@ - (void)getPendingTransactions:(FlutterResult)result {
result(transactionMaps);
}

- (void)getStorefront:(FlutterResult)result {
if (@available(iOS 13.0, *)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should include macOS 10.15+ here too.

result([FIAObjectTranslator getMapFromSKStorefront:storefront]);
return;
} else {
NSLog(@"storefront is not avaialbe in iOS below 13.0.");
Copy link
Contributor

Choose a reason for hiding this comment

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

And this should mention both iOS and macOS.

@@ -419,6 +419,71 @@ - (void)testGetPendingTransactions {
XCTAssertEqualObjects(resultArray, @[ transactionMap ]);
}

- (void)testPaymentQueueStorefront {
if (@available(iOS 13, *)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Or macOS 10.15

@cyanglaz
Copy link
Contributor Author

@stuartmorgan Updated as per your comments. PTAL!

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

@@ -419,6 +419,71 @@ - (void)testGetPendingTransactions {
XCTAssertEqualObjects(resultArray, @[ transactionMap ]);
}

- (void)testPaymentQueueStorefront {
if (@available(iOS 13, macOS 10.15, *)) {
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: These should be two separate test methods, rather than sub-blocks of the same test. Unit tests should each test as few things as is feasible.

@@ -41,6 +41,17 @@ class SKPaymentQueueWrapper {
SKPaymentQueueDelegateWrapper? _paymentQueueDelegate;
SKTransactionObserverWrapper? _observer;

/// Calls [`[SKPaymentQueue storefront]`](https://developer.apple.com/documentation/storekit/skpaymentqueue/3182430-storefront?language=objc)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is missing a period.

@@ -41,6 +41,17 @@ class SKPaymentQueueWrapper {
SKPaymentQueueDelegateWrapper? _paymentQueueDelegate;
SKTransactionObserverWrapper? _observer;

/// Calls [`[SKPaymentQueue storefront]`](https://developer.apple.com/documentation/storekit/skpaymentqueue/3182430-storefront?language=objc)
/// Returns `null` if the user's device is below iOS 13.0 or macOS 10.15.
Copy link
Contributor

Choose a reason for hiding this comment

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

And a blank comment line before this one, per Effective Dart.

@cyanglaz cyanglaz added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 15, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 15, 2023
Copy link
Contributor

auto-submit bot commented Nov 15, 2023

auto label is removed for flutter/packages/5348, due to - The status or check suite Linux repo_checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@cyanglaz cyanglaz added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 15, 2023
@auto-submit auto-submit bot merged commit 8175f76 into flutter:main Nov 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 16, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 16, 2023
flutter/packages@0cd2378...07b4b29

2023-11-16 kevmoo@users.noreply.github.com [script] use dart:io support for forwarding stdout/stderr (flutter/packages#5410)
2023-11-15 engine-flutter-autoroll@skia.org Manual roll Flutter (stable) from d211f42 to db7ef5b (1539 revisions) (flutter/packages#5409)
2023-11-15 ychris@google.com [in_app_purchase] add storefront in skpaymentqueuewrapper (flutter/packages#5348)

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 flutter-ecosystem@google.com,rmistry@google.com 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
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
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-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[in_app_purchase][iOS] No way to get SKStorefrontWrapper
2 participants