diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 1a19ac6..18ca0e9 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -1248,8 +1248,12 @@ and the Connect stream and runtime API POSTs are never precached nor intercepted never served stale. This satisfies Chromium's installability requirement (a registered SW, needed for install on Android) and powers the opt-in **offline mode** (in progress): a deliberate, device-scoped Settings toggle — distinct from the transient gateway-reachability signal — that tints the header blue with -an *Offline* chip and confines play to on-device `vs_ai` games. To have data ready before the -switch, the **Profile advertises the current dictionary version per variant** (`dict_versions`, +an *Offline* chip and confines play to on-device `vs_ai` games. The **offline lobby lists only those +device-local games** (reconstructed by replaying the IndexedDB move journal) and its New-vs-AI entry +creates one through the in-browser engine — the same game screen then drives it, the robot replying +locally; online-only affordances (the Stats tab, the friend/random options in New Game) are disabled +or hidden. To have data ready before the switch, the **Profile advertises the current dictionary +version per variant** (`dict_versions`, filled from the registry on the existing cold-start profile request — no extra round-trip), and an eligible installed PWA (standalone web + confirmed email) **background-preloads** those dictionaries — on lobby entry and on a variant-preference change — through the same three-tier loader, retried diff --git a/docs/FUNCTIONAL.md b/docs/FUNCTIONAL.md index 39ffc2b..ec05603 100644 --- a/docs/FUNCTIONAL.md +++ b/docs/FUNCTIONAL.md @@ -256,6 +256,18 @@ the same occasional move against its plan that fades out by the endgame), and ch add-friend are off. AI games are **practice** — they never count toward a player's statistics. +### Offline mode +An installed web PWA signed in with a confirmed email can switch to a deliberate **offline mode** +(Settings → Play mode). Offline, the app never touches the network: the header turns blue with an +*Offline* chip, the lobby lists only the games stored on the device, and online-only surfaces are +disabled or hidden (the Stats tab; the *with friends* and *random opponent* options in New Game). +Only **vs_ai** games are playable — New Game creates a device-local game against the robot, which +plays entirely in the browser with no backend. Local games are kept on the device, visible only in +offline mode, and never sync to the account. So a game can be created and played with no connection, +the app quietly preloads the dictionaries for the player's enabled variants while still online, and +(once installed) launches from a precached shell even with no network. The mode is device-scoped and +sticky across launches. + ### Social: friends, block, chat, nudge Become friends in two ways: redeem a **one-time code** the other player issues (six digits, valid for twelve hours), or send a **request to someone you have played diff --git a/docs/FUNCTIONAL_ru.md b/docs/FUNCTIONAL_ru.md index 1c6700e..32d198a 100644 --- a/docs/FUNCTIONAL_ru.md +++ b/docs/FUNCTIONAL_ru.md @@ -261,6 +261,18 @@ e-mail) либо ввод фразы. Активные игры форфейтя паузы), сохраняет ту же силу (по-прежнему играет на победу лишь примерно в 40% партий, с теми же редкими ходами вопреки плану, затухающими к эндшпилю), а чат, nudge и «добавить в друзья» выключены. Партии с ИИ — это **тренировка**: они не идут в статистику игрока. +### Офлайн-режим +Установленный веб-PWA со входом по подтверждённой почте может переключиться в осознанный +**офлайн-режим** (Настройки → Режим игры). В офлайне приложение не обращается к сети: шапка синеет с +меткой *Офлайн*, лобби показывает только сохранённые на устройстве игры, а сетевые поверхности +отключены или скрыты (вкладка Статистика; варианты «с другом» и «случайный соперник» в Новой игре). +Играть можно только в **vs_ai** — Новая игра создаёт локальную игру против робота, который ходит +целиком в браузере без бэкенда. Локальные игры хранятся на устройстве, видны только в офлайн-режиме и +никогда не синхронизируются с аккаунтом. Чтобы игру можно было создать и сыграть без связи, приложение +заранее, пока ещё онлайн, подгружает словари включённых игроком вариантов и (после установки) +запускается из прекешированного шелла даже без сети. Режим привязан к устройству и сохраняется между +запусками. + ### Социальное: друзья, блок, чат, nudge Подружиться можно двумя способами: погасить **одноразовый код**, который выпускает другой игрок (шесть цифр, действует двенадцать часов), либо отправить **заявку diff --git a/ui/src/game/CheckScreen.svelte b/ui/src/game/CheckScreen.svelte index 67a5a2a..b16d471 100644 --- a/ui/src/game/CheckScreen.svelte +++ b/ui/src/game/CheckScreen.svelte @@ -1,6 +1,7 @@