Commit 71ed3a2
committed
refactor(iv): drop jwt-invalidated buffer/replay; pure pub/sub matches iOS
The buffer-and-consume design (pendingJwtInvalidatedExternalId +
jwtInvalidatedLock + consume-on-first-subscribe replay) was added to
handle cold-start 401s when no listener was subscribed yet. iOS doesn't
do this — it fires only to currently-subscribed listeners, late
subscribers miss earlier events. Match iOS: drop the buffer entirely.
Reverts the structure introduced by d137481 ("align jwt-invalidated
replay with #2613 buffer-and-consume"). The simpler design here matches
reference branch #2599.
Side effects:
- onModelReplaced becomes a no-op (no buffer to clear). Kept the
override since ISingletonModelStoreChangeHandler requires it.
- fireJwtInvalidated now uses OneSignalDispatchers.launchOnDefault per
maintainer request (#3184062053) instead of a custom
CoroutineScope(SupervisorJob() + Dispatchers.Default).
- KDoc on IOneSignal.addUserJwtInvalidatedListener and the OneSignal.kt
facade now spell out the pure-pub/sub semantics: "Subscribe early
(e.g. in Application.onCreate) to avoid missing cold-start 401s."
Test changes: drop the 4 buffer/replay-specific tests
(listener-replay-buffered-event, consume-on-first-subscribe,
fire-with-subscribers-no-buffer, onModelReplaced-clears-buffer).
Replace with one test that confirms late subscribers don't receive
earlier events.1 parent ee27ce4 commit 71ed3a2
4 files changed
Lines changed: 21 additions & 140 deletions
File tree
- OneSignalSDK/onesignal/core/src
- main/java/com/onesignal
- user/internal
- test/java/com/onesignal/user/internal
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 154 | + | |
| 155 | + | |
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 367 | + | |
| 368 | + | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
Lines changed: 11 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
| |||
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 55 | | |
75 | 56 | | |
76 | 57 | | |
| |||
91 | 72 | | |
92 | 73 | | |
93 | 74 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 75 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 76 | + | |
113 | 77 | | |
114 | 78 | | |
115 | 79 | | |
116 | 80 | | |
117 | 81 | | |
118 | 82 | | |
119 | 83 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
123 | 88 | | |
124 | 89 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
135 | 94 | | |
136 | 95 | | |
137 | 96 | | |
| |||
342 | 301 | | |
343 | 302 | | |
344 | 303 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 304 | + | |
352 | 305 | | |
353 | 306 | | |
354 | 307 | | |
| |||
Lines changed: 6 additions & 76 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| |||
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
242 | | - | |
243 | | - | |
244 | 243 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 244 | + | |
291 | 245 | | |
292 | 246 | | |
293 | 247 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 248 | + | |
320 | 249 | | |
321 | 250 | | |
| 251 | + | |
322 | 252 | | |
323 | 253 | | |
324 | 254 | | |
| |||
0 commit comments