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 Storefront.countryCode() and AppStore.sync() #8900

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

LouiseHsu
Copy link
Contributor

@LouiseHsu LouiseHsu commented Mar 26, 2025

Fixes flutter/flutter#159631 and fixes flutter/flutter#165659

Adds iap support for accessing store front country code and manual transaction syncing.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] 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 I have commented below to indicate which [version change exemption] this PR falls under[^1].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style], or I have commented below to indicate which [CHANGELOG exemption] this PR falls under[^1].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

@LouiseHsu LouiseHsu changed the title bonk adds appstore.sync, appstore.countrycode Mar 26, 2025
@LouiseHsu LouiseHsu changed the title adds appstore.sync, appstore.countrycode [in_app_purchase] add Storefront.countryCode() and AppStore.sync() Apr 1, 2025
@LouiseHsu LouiseHsu requested a review from hellohuanlin April 1, 2025 23:14
@LouiseHsu LouiseHsu marked this pull request as ready for review April 1, 2025 23:14
let error = PigeonError(
code: "storekit2_failed_to_fetch_country_code",
message: "Storekit has failed to fetch the country code.",
details: "Storekit has failed to fetch the country code.")
Copy link
Contributor

Choose a reason for hiding this comment

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

is details optional? can we pass nil?

details: "Storekit has failed to fetch the country code.")
return completion(.failure(error))
}
return completion(.success(currentStorefront.countryCode))
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 a weird way to write it - it's returning whatever to be returned from completion closure, which is Void.

do {
try await AppStore.sync()
} catch {
fatalError("Failed to sync to the AppStore: \(error)")
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it complete with error rather than crash?

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