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

Add uiPreviewMode to DangerousSettings #4714

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Sources/Misc/DangerousSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ import Foundation
*/
@objc public let autoSyncPurchases: Bool

/**
* if `true`, the SDK will return a set of mock products instead of the
* products obtained from StoreKit. This is useful for testing or preview purposes.
*/
@_spi(Internal) public let uiPreviewMode: Bool

Comment on lines +61 to +66
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can add the API tests to go along with it in this same PR? Those serve to also showcase the usage

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in f406e82

/**
* A property meant for apps that do their own entitlements computation, separated from RevenueCat.
* It:
Expand Down Expand Up @@ -101,13 +107,24 @@ import Foundation

}

/// Designated initializer
/**
* Only use a Dangerous Setting if suggested by RevenueCat support team.
*
* - Parameter uiPreviewMode: if `true`, the SDK will return a set of mock products instead of the
* products obtained from StoreKit. This is useful for testing or preview purposes.
*/
@_spi(Internal) public convenience init(uiPreviewMode: Bool) {
self.init(autoSyncPurchases: false, internalSettings: Internal.default, uiPreviewMode: uiPreviewMode)
}

internal init(autoSyncPurchases: Bool,
customEntitlementComputation: Bool = false,
internalSettings: InternalDangerousSettingsType) {
internalSettings: InternalDangerousSettingsType,
uiPreviewMode: Bool = false) {
self.autoSyncPurchases = autoSyncPurchases
self.internalSettings = internalSettings
self.customEntitlementComputation = customEntitlementComputation
self.uiPreviewMode = uiPreviewMode
}

}
Expand Down