feat(demo): explain the public demo's refusals and show its strip on Home #61
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/demo-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 4 of
docs/website/DEMO_MODE.md§10 (RunicGateway/website#222). Both build questions were answered by the org lead: DM19 (one snackbar, plus fixing the lines that blame the role) and DM20 (the banner only, no logins on the app's sign-in screen).The refusal (DM19)
DemoLockInterceptoron the main OkHttp client peeks every403body (up to 8 KiB). Oncode: "DEMO_LOCKED"it reports the server's sentence toDemoNotices. The shell (RunicApp) shows it as one snackbar, the app's counterpart of the web'sDemoToast, and a newer refusal replaces the one showing. Every API rides this client, so screens added later get it without doing anything. A module's own wording, such as a refused console command, is shown as sent.ApiResult.HttpErrorgainscode.safeApiCallreads it only on a403, and peeks so the body is not consumed.isDemoLocked()checks it.ErrorKind.DEMO_LOCKEDis checked ahead of the status intoUiStateandtoShardUiState. Without that, a403on a shard read would read as "not published here". It gets no Retry button, likeFEATURE_UNAVAILABLE.Lines that blamed the role now say the demo sentence:
demo-admin;Every other screen keeps its own failure line, with the snackbar underneath.
The strip (DM20)
SettingsDto.demois kept raw, liketheme, so a value of an unexpected shape cannot fail the whole settings decode.DemoInfo.fromreads it field by field: a bad time or a malformed login drops that part, never the strip.demo.runicgateway.com/account/login) instead of listing them.demoblock, so it draws nothing.Tests
./gradlew testDebugUnitTest lintDebug assembleDebug(the CI line) passes, with 783 unit tests.DemoLockedTest: body parsing, the code onHttpError, and that only a 403 body is read.DemoLockInterceptorTest: a real OkHttp client; the refusal is reported and the body still reaches the caller; other answers are not reported.DemoInfoTest: shape, forgiving parse, UTC time, the sign-in page label.DEMO_LOCKEDmapping inUiStateTest.Checked on an emulator
Against
websitemain(69998ec) withDEMO_MODE=trueandnpm run seed:demoon a scratch database (dropped afterwards):demo-player, Account → Change username: the server logged[demo] refused PATCH /auth/me/account/username. The screen showed "Couldn't change your username." and the snackbar "This is turned off on the demo site."demo-admin, Dashboard → Switch to maintenance: refused atPUT /admin/site-mode. The line read "This is turned off on the demo site." in place of "You don't have permission for that action.", with the snackbar underneath.Docs: RunicGateway/docs (DEMO_MODE.md DM19/DM20, §3.1, §6 and §10 step 4; android/PLAN.md §7).
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY