TestMode

class TestMode(storage: Storage, isTestEnvironment: Boolean = Companion.isTestEnvironment, getSuperwallProducts: suspend () -> Either<SuperwallProductsResponse, NetworkError> = { Either.Failure(NetworkError.Unknown()) }, entitlements: Entitlements? = null, activityProvider: () -> ActivityProvider? = { null }, activityTracker: () -> CurrentActivityTracker? = { null }, hasExternalPurchaseController: () -> Boolean = { false }, apiKey: () -> String = { "" }, dashboardBaseUrl: () -> String = { "" }, track: suspend (InternalSuperwallEvent) -> Unit = { })(source)

The single test-mode surface: holds the activation state (products, entitlement selections, settings persistence) AND runs the activation UI flow (activate → refresh products → present modal).

Not exactly a "manager" — the UI flow pieces (activity lookup, subscription products fetch, modal presentation) are injected as thin lambdas so this class stays testable and config-slice-free.

Constructors

Link copied to clipboard
constructor(storage: Storage, isTestEnvironment: Boolean = Companion.isTestEnvironment, getSuperwallProducts: suspend () -> Either<SuperwallProductsResponse, NetworkError> = { Either.Failure(NetworkError.Unknown()) }, entitlements: Entitlements? = null, activityProvider: () -> ActivityProvider? = { null }, activityTracker: () -> CurrentActivityTracker? = { null }, hasExternalPurchaseController: () -> Boolean = { false }, apiKey: () -> String = { "" }, dashboardBaseUrl: () -> String = { "" }, track: suspend (InternalSuperwallEvent) -> Unit = { })

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun activate(config: Config, justActivated: Boolean)

Refresh the test product catalog and (when justActivated is true) present the test-mode modal. Must be called off the actor queue — presentModal blocks on user interaction.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun evaluateTestMode(config: Config, bundleId: String, appUserId: String?, aliasId: String?, testModeBehavior: TestModeBehavior = TestModeBehavior.AUTOMATIC)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setTestProducts(productsByFullId: Map<String, StoreProduct>)
Link copied to clipboard
fun shouldShowFreeTrial(hasFreeTrial: Boolean): Boolean