-
Notifications
You must be signed in to change notification settings - Fork 319
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
CAT-1726: Support Deferring Win-Back StoreKit Messages #4343
CAT-1726: Support Deferring Win-Back StoreKit Messages #4343
Conversation
@@ -40,6 +47,14 @@ extension Message.Reason { | |||
case .priceIncreaseConsent: return .priceIncreaseConsent | |||
case .generic: return .generic | |||
default: | |||
// winBackOffer message reason was added in iOS 18.0, but it's not recognized by xcode versions <16.0. | |||
// https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3-release-notes | |||
#if swift(>=6.0) |
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.
See the PR description for more details on why this is necessary
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.
the swift
compilation condition defines the swift mode, whereas compiler
refers to the swift compiler version.
A lot of people will compile in Swift 5.X mode while using Xcode. Since what we actually want to do is detect the Xcode version, and Xcode 16 comes with the Swift 6.0 compiler, it's better to use the compiler
condition instead of swift
, as we know if ties directly the Xcode version.
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.
Woah, TIL! Will switch to using the compiler
condition. Thank you!!
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.
Switched in to using the compiler
condition in 086dce6 😎
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.
LGTM!
Motivation
iOS 18 introduces win-back offers to allow developers to extend offers to churned subscribers. In iOS 18+, StoreKit sends apps a StoreKit Message when a subscriber is eligible to redeem a win-back offer. We currently support showing this message automatically if the
showStoreMessagesAutomatically
configuration option istrue
, but don't yet support deferring displaying the message.Description
This PR adds win-back offers to the
StoreMessageType
enum so that we can support deferring StoreKit Messages where the reason iswinBackOffer
.Xcode Compatibility Issues
StoreKit.Message.Reason.winBackOffer
is available on iOS 18.0+ and wasn't back ported to be available in Xcode versions <16.0. Thus, if we referenceStoreKit.Message.Reason.winBackOffer
without checking for the Xcode version, we'll break compilation on all versions of Xcode less than 16.0:Since Swift doesn't provide a way to do conditional compilation based on Xcode version, our next best option is to check the Swift compiler version, since the Swift compiler version is tied to Xcode versions. Since the Swift 6 compiler shipped with Xcode 16, this PR makes our handling of deferred win-back offer messages dependent on the Swift compiler version being >=6.0.
Testing