-
Notifications
You must be signed in to change notification settings - Fork 3k
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_storekit] Add Swift Package Manager compatibility #8469
base: main
Are you sure you want to change the base?
Conversation
.../in_app_purchase_storekit/darwin/in_app_purchase_storekit/Sources/storekit_objc/messages.g.m
Outdated
Show resolved
Hide resolved
A number of the automated tests are not buildable in this PR. If you click into the failing CI tasks, click |
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Show resolved
Hide resolved
I will fix tree issue tmr |
b71a757
to
99a1132
Compare
Hmm, I am not sure why the tree status is failing. I though it was because of the main merge in my branch. |
|
I see, thank you. |
…packages into feat/in-app-purchase-add-swift-package-manager-support
99a1132
to
f415bf0
Compare
#if __has_include(<in_app_purchase_storekit/in_app_purchase_storekit.h>) | ||
@import in_app_purchase_storekit; | ||
#else | ||
@import storekit_objc; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to avoid changing this file but I couldn't find a way.
Hey @loic-sharma, whenever you have a chance, could you review these changes, please? Thanks! |
@alejandro-all-win-software Per our contributor docs, you should expect a review within two weeks, not 24 hours; please don't ping people just because they haven't immediately reviewed a PR. |
packages/in_app_purchase/in_app_purchase_storekit/darwin/in_app_purchase_storekit/Package.swift
Outdated
Show resolved
Hide resolved
...t/darwin/in_app_purchase_storekit/Sources/storekit_objc/Protocols/FLTMethodChannelProtocol.m
Outdated
Show resolved
Hide resolved
...t/darwin/in_app_purchase_storekit/Sources/storekit_objc/Protocols/FLTMethodChannelProtocol.m
Outdated
Show resolved
Hide resolved
…in-app-purchase-add-swift-package-manager-support
...t/darwin/in_app_purchase_storekit/Sources/in_app_purchase_storekit_objc/FIAPReceiptManager.m
Show resolved
Hide resolved
@@ -2,6 +2,8 @@ | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE file. | |||
|
|||
#include <TargetConditionals.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? If I remove this line, I can still build fine locally using both SwiftPM and CocoaPods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...ces/in_app_purchase_storekit_objc/include/in_app_purchase_storekit_objc/FIAPReceiptManager.h
Outdated
Show resolved
Hide resolved
@@ -2,11 +2,14 @@ | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE file. | |||
|
|||
#include <TargetConditionals.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? If I remove this line, I can still build fine locally using both SwiftPM and CocoaPods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2,7 +2,9 @@ | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE file. | |||
|
|||
#include <TargetConditionals.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? If I remove this line, I can still build fine locally using both SwiftPM and CocoaPods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really weird but I'm able to reproduce this on my machine as well... This seems harmless I guess 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add the missing Foundation
import (this header uses NSArray
for instance), this probably won't be necessary. Usually this header doesn't have to be explicitly imported because the core frameworks all use it in their headers. (Arguably it should be included anyway for IWYU, but it's kind of a grey area since it's so core.)
#include <TargetConditionals.h> | ||
|
||
#if TARGET_OS_OSX | ||
#import <FlutterMacOS/FlutterMacOS.h> | ||
#else | ||
#import <Flutter/Flutter.h> | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Flutter or FlutterMacOS necessary here? The only type from the Flutter framework in this file, FlutterError
, is forward declared. With this change, I can still build fine locally using both SwiftPM and CocoaPods on both the macOS and iOS apps.
#include <TargetConditionals.h> | |
#if TARGET_OS_OSX | |
#import <FlutterMacOS/FlutterMacOS.h> | |
#else | |
#import <Flutter/Flutter.h> | |
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included it as I believed it was necessary, but if it’s not required, I’m happy to remove it 👍.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's odd that we have a forward declaration in this header in the first place; generally we follow https://google.github.io/styleguide/cppguide.html#Forward_Declarations for Obj-C code as well.
…in-app-purchase-add-swift-package-manager-support
Makes
in_app_purchase_storekit
available as a Swift Package to FlutterCloses #146905
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.