It does so by introducing back-flow logic into the PromotionalOfferView where presenting views can take actions based off of the result of the user visiting the PromotionalOfferView.
It introduces a new PromotionalOfferViewAction that tells presenters of the PromotionalOfferView what caused the PromotionalOfferView to be dismissed:
enum PromotionalOfferViewAction {
/// The user clicked the "No Thanks" button and declined the offer
case declinePromotionalOffer
/// The user successfully redeemed the promotional offer
case successfullyRedeemedPromotionalOffer(PurchaseResultData)
// Promotional code redemption failed. Either the user attempted to redeem the promotional offer, and it failed,
// or the promotional offer was not loaded successfully.
case promotionalCodeRedemptionFailed(Error)
}
Changes
Refund Flow
Makes it so that successfully redeeming a promotional off on the promotional offer view dismisses the refund flow and goes back to the main customer center screen
Fixes a bug where an error in the promotional offer flow causes a blank sheet to be presented to the user. Instead, an error will return back to the normal refund flow.
Cancel/Survey Flow
Fixed a bug where tapping an option always immediately calls isPresented = false, causing the feedback view screen to always dismiss, which then caused the promotional offer view to dismiss
Makes it so that successfully redeeming a promotional off on the promotional offer view dismisses the cancel flow and goes back to the main customer center screen
Misc
Abstracts out our calls to the Purchases SDK when purchasing a promotional offer
Description
This PR addresses https://github.com/RevenueCat/purchases-ios/issues/4456 by automatically dismissing the promotional offer sheet after successfully purchasing a promotional offer.
It does so by introducing back-flow logic into the
PromotionalOfferView
where presenting views can take actions based off of the result of the user visiting thePromotionalOfferView
.It introduces a new
PromotionalOfferViewAction
that tells presenters of thePromotionalOfferView
what caused thePromotionalOfferView
to be dismissed:Changes
Refund Flow
Cancel/Survey Flow
isPresented = false
, causing the feedback view screen to always dismiss, which then caused the promotional offer view to dismissMisc
Testing
Manually tested changes
Videos
Redeeming Promo Offer Through Refund Flow
https://github.com/user-attachments/assets/840898af-8136-407d-99eb-d5168bbff303
Redeeming Promo Offer Through Cancel/Survey Flow
https://github.com/user-attachments/assets/401c0fe3-37dd-425d-9334-4772f369c9e3