File tree Expand file tree Collapse file tree
ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,6 +211,10 @@ internal class PaywallViewModelImpl(
211211
212212 // Shared across all screens of a workflow presentation so state-driven values survive screen navigation.
213213 private var currentWorkflowStateStore: PaywallStateStore ? = null
214+
215+ // Reused across full state refreshes (e.g. color changes) of a standalone paywall so its state-driven values
216+ // are not lost. Tied to this ViewModel's lifetime, so it resets when the paywall is presented again.
217+ private var standaloneStateStore: PaywallStateStore ? = null
214218 private var preWarmJob: Job ? = null
215219 private var transitionIdCounter: Int = 0
216220
@@ -910,11 +914,14 @@ internal class PaywallViewModelImpl(
910914 " You do not have a current offering configured in the RevenueCat dashboard." ,
911915 )
912916 } else {
917+ val stateStore = standaloneStateStore
918+ ? : PaywallStateStore (emptyMap()).also { standaloneStateStore = it }
913919 _state .value = calculateState(
914920 currentOffering,
915921 _colorScheme .value,
916922 purchases.storefrontCountryCode,
917923 options.mode,
924+ stateStore = stateStore,
918925 )
919926 }
920927 }
You can’t perform that action at this time.
0 commit comments