[in_app_purchase] add Storefront.countryCode() and AppStore.sync()#8900
[in_app_purchase] add Storefront.countryCode() and AppStore.sync()#8900auto-submit[bot] merged 17 commits intoflutter:mainfrom
Conversation
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Outdated
Show resolved
Hide resolved
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Outdated
Show resolved
Hide resolved
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Outdated
Show resolved
Hide resolved
| code: "storekit2_failed_to_fetch_country_code", | ||
| message: "Storekit has failed to fetch the country code.", | ||
| details: "Storefront.current returned nil.") | ||
| return completion(.failure(error)) |
There was a problem hiding this comment.
nit:
completion(.failure(error))
return
There was a problem hiding this comment.
i changed it but whats the difference in practice?
There was a problem hiding this comment.
Let's say we have a function that doesn't return:
func print(stuff: String) {
...
}
When we call it, we simply do:
if wannaPrint {
print(stuff: "abc")
}
And if we want to early return, just do:
if wannaPrint {
print(stuff: "abc")
return
}
Now, what you were trying to do was:
if wannaPrint {
return print(stuff: "abc")
}
For most languages, this code won't even compile. However, it compiles fine here in Swift, because Void is an actual type in Swift. So the above code is equivalent to:
if wannaPrint {
let answer = print(stuff: "abc")
return answer
}
Here the answer is of type Void, and of value Void(). While it's perfectly valid to write return Void(), I have never seen anyone writing it. People just do return for a function that returns void.
A fun fact, do you know thatVoid is a typealias of an empty tuple?
public typealias Void = ()
There was a problem hiding this comment.
I see, that makes sense.
| func sync(completion: @escaping (Result<Void, Error>) -> Void) { | ||
| Task { | ||
| do { | ||
| try await AppStore.sync() |
There was a problem hiding this comment.
missing completion on success.
| /// (https://developer.apple.com/documentation/storekit/storefront/countrycode) | ||
| Future<String> countryCode() async { | ||
| final String code = await _hostApi.countryCode(); | ||
| return code; |
There was a problem hiding this comment.
can it just be return _hostApi.countryCode()?
| Task { | ||
| do { | ||
| try await AppStore.sync() | ||
| completion(.success(Void())) |
flutter/packages@2fcc403...ac21f53 2025-04-20 engine-flutter-autoroll@skia.org Roll Flutter from 3ed38e2 to cfb887c (17 revisions) (flutter/packages#9118) 2025-04-19 stuartmorgan@google.com [various] Scrubs pre-SDK-21 Android code (flutter/packages#9112) 2025-04-18 engine-flutter-autoroll@skia.org Roll Flutter from ecabb1a to 3ed38e2 (23 revisions) (flutter/packages#9114) 2025-04-18 ricardodalarme@outlook.com [flutter_svg] feat: Expose the `colorMapper` property in `SvgPicture` (flutter/packages#9043) 2025-04-18 stuartmorgan@google.com [tool] Add initial file-based command skipping (flutter/packages#8928) 2025-04-18 stuartmorgan@google.com [pigeon] Convert test plugins to SPM (flutter/packages#9105) 2025-04-18 10687576+bparrishMines@users.noreply.github.com [webview_flutter] Adds support to control overscrolling (flutter/packages#8451) 2025-04-17 louisehsu@google.com [in_app_purchase] add Storefront.countryCode() and AppStore.sync() (flutter/packages#8900) 2025-04-17 145144088+camfrandsen@users.noreply.github.com [webview_flutter_wkwebview] Expose the allowsLinkPreview property in WKWebView for iOS (flutter/packages#5029) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations to set over-scroll mode (flutter/packages#9101) 2025-04-17 1063596+reidbaker@users.noreply.github.com [shared_preferences] Update AGP to 8.9.1 (flutter/packages#9106) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [pigeon] Adds Kotlin lint tests to example code and fix lints (flutter/packages#9034) 2025-04-17 30872003+misos1@users.noreply.github.com [video_player_avfoundation] enable more than 30 fps (flutter/packages#7466) 2025-04-17 engine-flutter-autoroll@skia.org Roll Flutter from aef4718 to ecabb1a (25 revisions) (flutter/packages#9104) 2025-04-16 stuartmorgan@google.com [pigeon] Unify iOS and macOS test plugins (flutter/packages#9100) 2025-04-16 engine-flutter-autoroll@skia.org Roll Flutter from db68c95 to aef4718 (7 revisions) (flutter/packages#9098) 2025-04-16 10687576+bparrishMines@users.noreply.github.com [webview_flutter_platform_interface] Adds method to set overscroll mode (flutter/packages#9099) 2025-04-16 matanlurey@users.noreply.github.com Update `CODEOWNERS` (flutter/packages#8984) 2025-04-16 stuartmorgan@google.com [google_sign_is] Update iOS SDK to 8.0 (flutter/packages#9081) 2025-04-16 robert.odrowaz@leancode.pl [camera_avfoundation] Implementation swift migration (flutter/packages#8988) 2025-04-16 32538273+ValentinVignal@users.noreply.github.com [go_router] Adds `caseSensitive` to `GoRoute` (flutter/packages#8992) 2025-04-16 engine-flutter-autoroll@skia.org Manual roll Flutter from 30e53b0 to db68c95 (98 revisions) (flutter/packages#9092) 2025-04-15 stuartmorgan@google.com [tool] Run config-only build for iOS/macOS native-test (flutter/packages#9080) 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 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
flutter/packages@2fcc403...ac21f53 2025-04-20 engine-flutter-autoroll@skia.org Roll Flutter from 409a8ac to cd51fa3 (17 revisions) (flutter/packages#9118) 2025-04-19 stuartmorgan@google.com [various] Scrubs pre-SDK-21 Android code (flutter/packages#9112) 2025-04-18 engine-flutter-autoroll@skia.org Roll Flutter from d0741df to 409a8ac (23 revisions) (flutter/packages#9114) 2025-04-18 ricardodalarme@outlook.com [flutter_svg] feat: Expose the `colorMapper` property in `SvgPicture` (flutter/packages#9043) 2025-04-18 stuartmorgan@google.com [tool] Add initial file-based command skipping (flutter/packages#8928) 2025-04-18 stuartmorgan@google.com [pigeon] Convert test plugins to SPM (flutter/packages#9105) 2025-04-18 10687576+bparrishMines@users.noreply.github.com [webview_flutter] Adds support to control overscrolling (flutter/packages#8451) 2025-04-17 louisehsu@google.com [in_app_purchase] add Storefront.countryCode() and AppStore.sync() (flutter/packages#8900) 2025-04-17 145144088+camfrandsen@users.noreply.github.com [webview_flutter_wkwebview] Expose the allowsLinkPreview property in WKWebView for iOS (flutter/packages#5029) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations to set over-scroll mode (flutter/packages#9101) 2025-04-17 1063596+reidbaker@users.noreply.github.com [shared_preferences] Update AGP to 8.9.1 (flutter/packages#9106) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [pigeon] Adds Kotlin lint tests to example code and fix lints (flutter/packages#9034) 2025-04-17 30872003+misos1@users.noreply.github.com [video_player_avfoundation] enable more than 30 fps (flutter/packages#7466) 2025-04-17 engine-flutter-autoroll@skia.org Roll Flutter from 9616f9c to d0741df (25 revisions) (flutter/packages#9104) 2025-04-16 stuartmorgan@google.com [pigeon] Unify iOS and macOS test plugins (flutter/packages#9100) 2025-04-16 engine-flutter-autoroll@skia.org Roll Flutter from a7ce7ff to 9616f9c (7 revisions) (flutter/packages#9098) 2025-04-16 10687576+bparrishMines@users.noreply.github.com [webview_flutter_platform_interface] Adds method to set overscroll mode (flutter/packages#9099) 2025-04-16 matanlurey@users.noreply.github.com Update `CODEOWNERS` (flutter/packages#8984) 2025-04-16 stuartmorgan@google.com [google_sign_is] Update iOS SDK to 8.0 (flutter/packages#9081) 2025-04-16 robert.odrowaz@leancode.pl [camera_avfoundation] Implementation swift migration (flutter/packages#8988) 2025-04-16 32538273+ValentinVignal@users.noreply.github.com [go_router] Adds `caseSensitive` to `GoRoute` (flutter/packages#8992) 2025-04-16 engine-flutter-autoroll@skia.org Manual roll Flutter from f2d54fd to a7ce7ff (98 revisions) (flutter/packages#9092) 2025-04-15 stuartmorgan@google.com [tool] Run config-only build for iOS/macOS native-test (flutter/packages#9080) 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 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
…lutter#8900) 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
…lutter#8900) 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
…lutter#8900) 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
flutter/packages@2fcc403...ac21f53 2025-04-20 engine-flutter-autoroll@skia.org Roll Flutter from 3ed38e2 to cfb887c (17 revisions) (flutter/packages#9118) 2025-04-19 stuartmorgan@google.com [various] Scrubs pre-SDK-21 Android code (flutter/packages#9112) 2025-04-18 engine-flutter-autoroll@skia.org Roll Flutter from ecabb1a to 3ed38e2 (23 revisions) (flutter/packages#9114) 2025-04-18 ricardodalarme@outlook.com [flutter_svg] feat: Expose the `colorMapper` property in `SvgPicture` (flutter/packages#9043) 2025-04-18 stuartmorgan@google.com [tool] Add initial file-based command skipping (flutter/packages#8928) 2025-04-18 stuartmorgan@google.com [pigeon] Convert test plugins to SPM (flutter/packages#9105) 2025-04-18 10687576+bparrishMines@users.noreply.github.com [webview_flutter] Adds support to control overscrolling (flutter/packages#8451) 2025-04-17 louisehsu@google.com [in_app_purchase] add Storefront.countryCode() and AppStore.sync() (flutter/packages#8900) 2025-04-17 145144088+camfrandsen@users.noreply.github.com [webview_flutter_wkwebview] Expose the allowsLinkPreview property in WKWebView for iOS (flutter/packages#5029) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations to set over-scroll mode (flutter/packages#9101) 2025-04-17 1063596+reidbaker@users.noreply.github.com [shared_preferences] Update AGP to 8.9.1 (flutter/packages#9106) 2025-04-17 10687576+bparrishMines@users.noreply.github.com [pigeon] Adds Kotlin lint tests to example code and fix lints (flutter/packages#9034) 2025-04-17 30872003+misos1@users.noreply.github.com [video_player_avfoundation] enable more than 30 fps (flutter/packages#7466) 2025-04-17 engine-flutter-autoroll@skia.org Roll Flutter from aef4718 to ecabb1a (25 revisions) (flutter/packages#9104) 2025-04-16 stuartmorgan@google.com [pigeon] Unify iOS and macOS test plugins (flutter/packages#9100) 2025-04-16 engine-flutter-autoroll@skia.org Roll Flutter from db68c95 to aef4718 (7 revisions) (flutter/packages#9098) 2025-04-16 10687576+bparrishMines@users.noreply.github.com [webview_flutter_platform_interface] Adds method to set overscroll mode (flutter/packages#9099) 2025-04-16 matanlurey@users.noreply.github.com Update `CODEOWNERS` (flutter/packages#8984) 2025-04-16 stuartmorgan@google.com [google_sign_is] Update iOS SDK to 8.0 (flutter/packages#9081) 2025-04-16 robert.odrowaz@leancode.pl [camera_avfoundation] Implementation swift migration (flutter/packages#8988) 2025-04-16 32538273+ValentinVignal@users.noreply.github.com [go_router] Adds `caseSensitive` to `GoRoute` (flutter/packages#8992) 2025-04-16 engine-flutter-autoroll@skia.org Manual roll Flutter from 30e53b0 to db68c95 (98 revisions) (flutter/packages#9092) 2025-04-15 stuartmorgan@google.com [tool] Run config-only build for iOS/macOS native-test (flutter/packages#9080) 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 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
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
dart format.)[shared_preferences]pubspec.yamlwith 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].CHANGELOG.mdto 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].///).