Skip to content

Commit 7dc0461

Browse files
committed
Redesign the flows
1 parent a229a1a commit 7dc0461

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

superwall/src/main/java/com/superwall/sdk/identity/IdentityManagerActor.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ data class IdentityState(
6060
) : Reducer<IdentityState> {
6161
data class Identify(
6262
val userId: String,
63+
val restoreAssignments: Boolean,
6364
) : Updates({ state ->
6465
val sanitized = IdentityLogic.sanitize(userId)
6566
if (sanitized.isNullOrEmpty() || sanitized == state.appUserId) {
@@ -88,8 +89,10 @@ data class IdentityState(
8889
base.copy(
8990
appUserId = sanitized,
9091
userAttributes = merged,
91-
pending =
92-
setOf(Pending.Seed, Pending.Assignments),
92+
pending = buildSet {
93+
add(Pending.Seed)
94+
if (restoreAssignments) add(Pending.Assignments)
95+
},
9396
isReady = false,
9497
)
9598
}
@@ -211,7 +214,7 @@ data class IdentityState(
211214
}
212215

213216
// Update state (pure) — persistence handled by interceptor
214-
update(Updates.Identify(sanitized))
217+
update(Updates.Identify(sanitized, options?.restorePaywallAssignments == true))
215218

216219
val newState = state.value
217220
immediate(

0 commit comments

Comments
 (0)