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

visionOS: support for Xcode 15 beta 6 #2989

Merged
merged 5 commits into from
Aug 9, 2023
Merged

visionOS: support for Xcode 15 beta 6 #2989

merged 5 commits into from
Aug 9, 2023

Conversation

NachoSoto
Copy link
Contributor

@NachoSoto NachoSoto commented Aug 8, 2023

Context:

#if os(iOS) no longer evaluates to true when compiling for visionOS
Which means we need || os(xrOS).
But to support older Xcode we need #if swift(>=5.9) && os(xrOS).
But, fun fact, short-circuiting doesn’t work in Xcode 13.
And we still need that to run iOS <15 tests (FB12223404 / FB12805891)

💩

This works around that by defining our own VISION_OS flag.

Changes:

  • Added VISION_OS compile time flag to determine SDK
  • Replaced #if os(xrOS) with #if VISION_OS
  • Added flag to Package.swift (thanks @neonichu for helping with this)

@NachoSoto NachoSoto requested a review from a team August 8, 2023 21:14
@NachoSoto NachoSoto closed this Aug 8, 2023
@NachoSoto NachoSoto reopened this Aug 8, 2023
@NachoSoto NachoSoto marked this pull request as ready for review August 8, 2023 22:45
@NachoSoto NachoSoto changed the title visionOS: support for Xcode 15 beta 6 visionOS: support for Xcode 15 beta 6 Aug 8, 2023
@NachoSoto NachoSoto force-pushed the visionos-beta-3 branch 3 times, most recently from 735f9b1 to bee593d Compare August 9, 2023 00:28
Copy link
Member

@MarkVillacampa MarkVillacampa left a comment

Choose a reason for hiding this comment

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

Nice one!

@NachoSoto NachoSoto enabled auto-merge (squash) August 9, 2023 16:28
@NachoSoto NachoSoto disabled auto-merge August 9, 2023 16:33
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #2989 (5f381cd) into main (def42cc) will increase coverage by 0.14%.
Report is 2 commits behind head on main.
The diff coverage is 72.72%.

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

@@            Coverage Diff             @@
##             main    #2989      +/-   ##
==========================================
+ Coverage   86.56%   86.70%   +0.14%     
==========================================
  Files         218      218              
  Lines       15623    15617       -6     
==========================================
+ Hits        13524    13541      +17     
+ Misses       2099     2076      -23     
Files Changed Coverage Δ
...ndationExtensions/UIApplication+RCExtensions.swift 93.33% <ø> (ø)
Sources/Misc/Concurrency/Purchases+async.swift 10.52% <ø> (ø)
...ces/Purchasing/StoreKit1/PaymentQueueWrapper.swift 41.66% <ø> (ø)
...ources/Purchasing/StoreKit1/StoreKit1Wrapper.swift 84.96% <ø> (ø)
...hasing/StoreKit2/SK2BeginRefundRequestHelper.swift 31.94% <ø> (ø)
Sources/Support/DebugUI/DebugContentViews.swift 38.05% <ø> (ø)
Sources/Support/DebugUI/DebugView.swift 0.00% <0.00%> (ø)
Sources/Support/DebugUI/DebugViewController.swift 0.00% <ø> (ø)
Sources/Support/DebugUI/DebugViewModel.swift 35.93% <ø> (ø)
...s/Support/DebugUI/DebugViewSheetPresentation.swift 0.00% <ø> (ø)
... and 5 more

... and 4 files with indirect coverage changes

@NachoSoto NachoSoto enabled auto-merge (squash) August 9, 2023 17:00
@NachoSoto NachoSoto disabled auto-merge August 9, 2023 17:02
@NachoSoto NachoSoto enabled auto-merge (squash) August 9, 2023 17:14
@NachoSoto NachoSoto merged commit dab5035 into main Aug 9, 2023
12 checks passed
@NachoSoto NachoSoto deleted the visionos-beta-3 branch August 9, 2023 18:19
NachoSoto added a commit that referenced this pull request Aug 9, 2023
_This release is compatible with Xcode 15 beta 6 and visionOS beta 3_

### Bugfixes
* `visionOS`: support for `Xcode 15 beta 6` (#2989) via NachoSoto
(@NachoSoto)
* `CachingProductsManager`: avoid crash when caching different products
with same identifier (#2979) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: disambiguate transactions from the queue
(#2890) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit2TransactionListener`: handle transactions asynchronously
(#2910) via NachoSoto (@NachoSoto)
### Other Changes
* `Atomic`: avoid race conditions modifying dictionaries (#2981) via
NachoSoto (@NachoSoto)
* `Logging`: avoid logging "updating offerings" when request is cached
(#2904) via NachoSoto (@NachoSoto)
* `StoreKit2TransactionListener`: converted into an `actor` (#2909) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added more observer mode tests (#2905) via
NachoSoto (@NachoSoto)
* Created `PostedTransactionCache` (#2911) via NachoSoto (@NachoSoto)
* `IntroEligibility`: changed products to `Set<String>` (#2976) via
NachoSoto (@NachoSoto)
* `AdServices`: Rename `postAdServicesTokenIfNeeded()` to
`postAdServicesTokenOncePerInstallIfNeeded()` (#2968) via Josh Holtz
(@joshdholtz)
* `SK1StoreProduct`: changed `productType` warning to debug (#2957) via
NachoSoto (@NachoSoto)
* `PrivacyInfo.xcprivacy`: added `UserDefaults` to access API types
(#2913) via NachoSoto (@NachoSoto)
* `Integration Tests`: new test to verify that SK1 purchases don't leave
SK2 unfinished transactions (#2906) via NachoSoto (@NachoSoto)
* `Logging`: log entire cache key with verbose logs (#2888) via
NachoSoto (@NachoSoto)
* `StoreProduct`: added test covering warning log (#2897) via NachoSoto
(@NachoSoto)
* `CustomEntitlementComputation`: use custom API key (#2879) via Toni
Rico (@tonidero)
* `CachingProductsManager`: removed duplicate log and added tests
(#2898) via NachoSoto (@NachoSoto)
* `Xcode 15 beta 5`: fixed test compilation (#2885) via NachoSoto
(@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
NachoSoto added a commit that referenced this pull request Aug 10, 2023
This is a small follow-up to #2989. Thanks @bcapps for reporting this.
NachoSoto added a commit that referenced this pull request Aug 11, 2023
This is a small follow-up to #2989. Thanks @bcapps for reporting this.
NachoSoto added a commit that referenced this pull request Aug 11, 2023
…3005)

Fixes #2998. See #2989 for why this is needed in the first place.
This is now fixed in SPM:
swiftlang/swift-package-manager#6794, but we need a
workaround for now.

Since `.custom` doesn't work properly (it gets evaluated in Xcode even
outside of that platform), this splits `Package.swift` based on Xcode
version.

Thanks @neonichu for helping with this.
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
### Context:

`#if os(iOS)` no longer evaluates to `true` when compiling for
`visionOS`
Which means we need `|| os(xrOS)`.
But to support older Xcode we need `#if swift(>=5.9) && os(xrOS)`.
But, fun fact, short-circuiting doesn’t work in `Xcode 13`.
And we still need that to run iOS <15 tests (`FB12223404` /
`FB12805891`)

💩 

This works around that by defining our own `VISION_OS` flag.

### Changes:
- Added `VISION_OS` compile time flag to determine SDK
- Replaced `#if os(xrOS)` with `#if VISION_OS`
- Added flag to `Package.swift` (thanks @neonichu for helping with this)
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
_This release is compatible with Xcode 15 beta 6 and visionOS beta 3_

### Bugfixes
* `visionOS`: support for `Xcode 15 beta 6` (#2989) via NachoSoto
(@NachoSoto)
* `CachingProductsManager`: avoid crash when caching different products
with same identifier (#2979) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: disambiguate transactions from the queue
(#2890) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit2TransactionListener`: handle transactions asynchronously
(#2910) via NachoSoto (@NachoSoto)
### Other Changes
* `Atomic`: avoid race conditions modifying dictionaries (#2981) via
NachoSoto (@NachoSoto)
* `Logging`: avoid logging "updating offerings" when request is cached
(#2904) via NachoSoto (@NachoSoto)
* `StoreKit2TransactionListener`: converted into an `actor` (#2909) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added more observer mode tests (#2905) via
NachoSoto (@NachoSoto)
* Created `PostedTransactionCache` (#2911) via NachoSoto (@NachoSoto)
* `IntroEligibility`: changed products to `Set<String>` (#2976) via
NachoSoto (@NachoSoto)
* `AdServices`: Rename `postAdServicesTokenIfNeeded()` to
`postAdServicesTokenOncePerInstallIfNeeded()` (#2968) via Josh Holtz
(@joshdholtz)
* `SK1StoreProduct`: changed `productType` warning to debug (#2957) via
NachoSoto (@NachoSoto)
* `PrivacyInfo.xcprivacy`: added `UserDefaults` to access API types
(#2913) via NachoSoto (@NachoSoto)
* `Integration Tests`: new test to verify that SK1 purchases don't leave
SK2 unfinished transactions (#2906) via NachoSoto (@NachoSoto)
* `Logging`: log entire cache key with verbose logs (#2888) via
NachoSoto (@NachoSoto)
* `StoreProduct`: added test covering warning log (#2897) via NachoSoto
(@NachoSoto)
* `CustomEntitlementComputation`: use custom API key (#2879) via Toni
Rico (@tonidero)
* `CachingProductsManager`: removed duplicate log and added tests
(#2898) via NachoSoto (@NachoSoto)
* `Xcode 15 beta 5`: fixed test compilation (#2885) via NachoSoto
(@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
This is a small follow-up to #2989. Thanks @bcapps for reporting this.
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
…3005)

Fixes #2998. See #2989 for why this is needed in the first place.
This is now fixed in SPM:
swiftlang/swift-package-manager#6794, but we need a
workaround for now.

Since `.custom` doesn't work properly (it gets evaluated in Xcode even
outside of that platform), this splits `Package.swift` based on Xcode
version.

Thanks @neonichu for helping with this.
NachoSoto added a commit that referenced this pull request Jan 30, 2024
### Changes:
- Added `visionOS` to list of deployment targets in `Podspec`
- ~~Updated `Swift` version to 5.7 (see https://swiftversion.net), Xcode
14.0 is required, and that's Swift 5.7. We no longer support 5.5~~ (done
in a previous PR already)
- Added `visionOS` CocoaPods lint check to `build_visionos`
- Added `VISION_OS` to Podspec (see #2989)
- ~~Changed `visionOS` CI job to use `Xcode 15 beta 8` (see
https://discuss.circleci.com/t/xcode-15-rc-released-important-notice-for-visionos-sdk-users/49278)~~
(no longer needed)

Fixes
https://community.revenuecat.com/sdks-51/how-to-support-visionos-via-cocoapods-3499
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

2 participants