Commit bd9484a
fix(hykb): tear down session on async account switch
After login the SDK may raise its own dialog (real-name / anti-addiction
gate) offering "switch account". Picking it fires onSwitchUser, which the
native side forwards as hykbLoginCallback(0, newUid, ...) — but with no
login in flight HYKB_TX is empty, so the code==0 callback fell through the
2005 arm and was silently dropped. The SDK ended up on the new account
while the in-game session still belonged to the old one, leaving Phira's
identity out of sync with the SDK.
Handle the request-less code==0 callback: record the switched uid (off the
JNI thread, since DATA is unsynchronized) and, on the game thread in
the_main, drop the session when it no longer matches the current
me.hykb_uid. HomePage's per-frame login.force then re-runs the login flow
as the new account. The SDK is left signed into the new account, so no
hykb_logout re-entry. The uid comparison also ignores the startup
onLoginSucceed auto-login, which arrives as the same code==0.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent bbf9db0 commit bd9484a
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
244 | 258 | | |
245 | 259 | | |
246 | 260 | | |
| |||
428 | 442 | | |
429 | 443 | | |
430 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
431 | 452 | | |
432 | 453 | | |
433 | 454 | | |
| |||
539 | 560 | | |
540 | 561 | | |
541 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
542 | 574 | | |
543 | 575 | | |
544 | 576 | | |
| |||
0 commit comments