Commit fc0197e
fix(iv): reorder switchUserIv to avoid unsubscribing the OLD user
Setting isDisabledInternally = true on the OLD push sub model BEFORE
createAndSwitchToNewUser fires a NORMAL-tagged change that propagates
through SubscriptionModelStoreListener.getUpdateOperation. The listener
reads the still-current OLD identity (alice / OS-A) and enqueues an
UpdateSubscriptionOperation(externalId = "alice", enabled = false,
status = UNSUBSCRIBE) — which then dispatches with alice's still-valid
JWT and unsubscribes the just-departed user server-side.
Reorder so the user-switch happens first (suppressBackendOperation = true
so the new model's add doesn't fire), then set the flag on the NEW push
sub with NO_PROPOGATE so the listener filters it. The new push sub
reuses the old id, so configModel.pushSubscriptionId after the switch
points at the new model.
Also fixes the secondary issue from the same review: previously the new
SubscriptionModel was created without isDisabledInternally, so the flag
never landed on the post-logout anonymous user. With the new ordering,
the flag is set directly on the new model.
Add tests for the ordering and the Phase 3 short-circuit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6e2eac7 commit fc0197e
2 files changed
Lines changed: 70 additions & 6 deletions
File tree
- OneSignalSDK/onesignal/core/src
- main/java/com/onesignal/user/internal
- test/java/com/onesignal/user/internal
Lines changed: 20 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| |||
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
| 45 | + | |
35 | 46 | | |
36 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | | - | |
39 | 53 | | |
40 | 54 | | |
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
192 | 195 | | |
193 | 196 | | |
194 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
195 | 245 | | |
0 commit comments