-
Notifications
You must be signed in to change notification settings - Fork 25
Add presentationMode option to control paywall modal presentation style #1726
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
Merged
facumenzella
merged 6 commits into
main
from
facundo/fix-ipad-paywall-presentation-style
Jul 22, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f77931
Add presentationMode option to control paywall modal presentation style
facumenzella fe51192
chore: re-run CI with pr:feat label
facumenzella c7b016a
Merge branch 'main' into facundo/fix-ipad-paywall-presentation-style
facumenzella 65cf4f9
Merge branch 'main' into facundo/fix-ipad-paywall-presentation-style
facumenzella 73de660
test: cover resolveModalPresentationStyle for presentationMode option
facumenzella 3e500af
Merge branch 'main' into facundo/fix-ipad-paywall-presentation-style
facumenzella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
ios/PurchasesHybridCommon/PurchasesHybridCommonTests/PaywallPresentationStyleTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // | ||
| // PaywallPresentationStyleTests.swift | ||
| // PurchasesHybridCommonTests | ||
| // | ||
| // Copyright © 2026 RevenueCat. All rights reserved. | ||
| // | ||
|
|
||
| #if !os(macOS) && !os(tvOS) && !os(watchOS) | ||
|
|
||
| import Quick | ||
| import Nimble | ||
| import UIKit | ||
| @testable import PurchasesHybridCommonUI | ||
|
|
||
| @available(iOS 15.0, *) | ||
| class PaywallPresentationStyleTests: QuickSpec { | ||
|
|
||
| override func spec() { | ||
|
|
||
| func resolve(_ options: [String: Any]) -> UIModalPresentationStyle { | ||
| PaywallProxy.PaywallPresentationParams.resolveModalPresentationStyle(from: options) | ||
| } | ||
|
|
||
| let presentationMode = PaywallProxy.PaywallOptionsKeys.presentationMode | ||
| let useFullScreenPresentation = PaywallProxy.PaywallOptionsKeys.useFullScreenPresentation | ||
|
|
||
| describe("resolveModalPresentationStyle") { | ||
|
|
||
| context("when presentationMode is provided") { | ||
| it("maps recognized tokens to the matching style") { | ||
| expect(resolve([presentationMode: "fullScreen"])) == .fullScreen | ||
| expect(resolve([presentationMode: "formSheet"])) == .formSheet | ||
| expect(resolve([presentationMode: "automatic"])) == .automatic | ||
| expect(resolve([presentationMode: "pageSheet"])) == .pageSheet | ||
| } | ||
|
|
||
| it("is case-insensitive") { | ||
| expect(resolve([presentationMode: "FULLSCREEN"])) == .fullScreen | ||
| expect(resolve([presentationMode: "FormSheet"])) == .formSheet | ||
| } | ||
|
|
||
| it("accepts \"sheet\" as an alias for pageSheet") { | ||
| expect(resolve([presentationMode: "sheet"])) == .pageSheet | ||
| } | ||
|
|
||
| it("takes precedence over the legacy useFullScreenPresentation flag") { | ||
| expect(resolve([presentationMode: "formSheet", | ||
| useFullScreenPresentation: true])) == .formSheet | ||
| } | ||
|
|
||
| context("when the value is unrecognized") { | ||
| it("falls back to the legacy flag") { | ||
| expect(resolve([presentationMode: "banana", | ||
| useFullScreenPresentation: true])) == .fullScreen | ||
| } | ||
|
|
||
| it("defaults to pageSheet when no legacy flag is set") { | ||
| expect(resolve([presentationMode: "banana"])) == .pageSheet | ||
| } | ||
| } | ||
|
|
||
| context("when the value is not a String") { | ||
| it("falls back to the legacy flag") { | ||
| expect(resolve([presentationMode: 42])) == .pageSheet | ||
| } | ||
| } | ||
| } | ||
|
|
||
| context("when presentationMode is absent") { | ||
| it("uses fullScreen when useFullScreenPresentation is true") { | ||
| expect(resolve([useFullScreenPresentation: true])) == .fullScreen | ||
| } | ||
|
|
||
| it("uses pageSheet when useFullScreenPresentation is false") { | ||
| expect(resolve([useFullScreenPresentation: false])) == .pageSheet | ||
| } | ||
|
|
||
| it("defaults to pageSheet when neither key is present (backwards compatibility)") { | ||
| expect(resolve([:])) == .pageSheet | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.