# 040 — UI in Kodi (A07)

Created: 2026-11-06
Updated: 2026-11-07

Decisions: S2, S5, S11, S12, S19, S24, S26 (WEB `01-decisions.md`). Texts cs/sk/en; new string ids in the addon's
`strings.po` (or the skin's for the skin menu), never reusing removed ids.

## 1. Onboarding step `account`

`wcs/onboarding/state.py` `STEPS = ('welcome', 'account', 'tmdb', 'webshare', 'ai', 'genres', 'movies', 'series')`.
Window `resources/skins/Default/1080i/onboarding/DialogMilionarOnboarding.xml` gets the account layout (generated or
hand-written as the file is today — check):

- Kicker "Účet Milionář", title "Přihlas se svým účtem", text: *„Máš účet webu Milionář? Naskenuj QR kód telefonem a
  potvrď přihlášení. Účet je jen na pozvánku a už v něm máš TMDb klíč i ostatní účty, takže je nebudeš zadávat.“*
  (final wording reviewed with Standa's style; sk/en translations).
- The QR image (`qr_url`), the code `ABCD-EFGH` large, the short URL, a countdown of validity; status line with the
  spinner while waiting; "Pokračovat bez účtu" button (focused); after expiry "Nový kód".
- Polling runs in a background thread started by the window's own thread; results reach the window as properties set
  from the window's thread pattern already used by the guide (`self.setProperty` in its own handlers) — never from the
  polling thread directly if the guide's rule forbids it (follow `wizard.py`).
- Approved → the switch (030) runs with the guide's status line; then §2.
- Declined → `tmdb` as today (classic path, TMDb key required).

## 2. After sign-in (S11, S12)

- The account's onboarding `done` → the guide closes, `state.remember(DONE)`, Home on Pro tebe (snapshot from staging).
- Not done → the next steps, each shown only when needed: `tmdb` (account without a TMDb key — e.g. a revoked shared
  key): "doplň klíč na webu" + QR to the web's accounts page **and** the existing entry, saved with
  `PUT api/sync/secrets/tmdb`; `webshare`, `ai`: the same pattern; `genres`, `movies`, `series`: as today, every
  choice also recorded for the account (`onboarding_set`, feedback `pick`, `list_set` through the store hooks).
- The guide's first Pro tebe build during the picks stays local (T12); after the guide, the service asks the server.

## 3. Settings and the skin menu (S19, S24)

- `resources/settings.xml`: new first category "Účet Milionář" with `account_status` (text, disabled: "Přihlášen:
  <jméno> (<e-mail>)" or "Nepřihlášen"), `account_login_button` (`RunPlugin(...?action=account_login)`),
  `account_logout_button` (`...?action=account_logout`); hidden `account_token`, `account_device_id`,
  `account_name`, `account_email`, `account_server`.
- Skin menu `Custom_1108_MilionarSettingsMenu.xml`: an item whose label is `$INFO[Window(Home).Property(milionar.account.label)]`
  ("Účet: Standa" / "Přihlásit účet"), action like the other items (`NotifyAll(...run:RunPlugin(...action=account))`
  when the service runs, else `RunPlugin`). The service sets the property at start and after every switch.
- `action=account`: signed out → the guide in `single='account'` mode; signed in → a small dialog: name, e-mail,
  server, "Odhlásit" (confirmation: *„Odhlásit účet <jméno>? Toto zařízení se vrátí ke svým datům z doby před
  přihlášením.“*).

## 4. Key management locked (S5)

Every key action checks `state.signed_in()` first: `tmdb_login_button`, `tmdb_delete_account_button`,
`webshare_login_button`, `webshare_delete_account_button`, `ai_delete_*_button`, `vinyl_login`, `vinyl_logout`,
TTS key entries, the guide's `single` key windows (except inside the onboarding steps of §2). Signed in, they show
*„Klíče a účty spravuješ na webu Milionář.“* with the QR to the web's accounts page and do nothing else. Status texts
(`tmdb_status`, `webshare_status`, `*_status`, `vinyl_status`) say "Spravováno účtem <jméno>" plus the existing state
(VIP days etc.). No dialog ever shows a key value.

## 5. Reset of the history (S26)

`reset.confirm_and_reset` signed in: dialog 1 (warning, red heading if the dialog style allows): *„Smažeš historii
sledování účtu <jméno> na VŠECH zařízeních i na webu: rozkoukané filmy a díly, zhlédnuté, Naposledy přehrané a
postup v MyTV a MyCinema. Nejde to vrátit.“* → dialog 2: *„Opravdu smazat historii účtu <jméno>?“* with "Zrušit"
focused. Then op `reset_watch` (pushed at once), the local reset comes back from the pull. Signed out: today's dialog.

## 6. Notifications

"Přihlášeno jako <jméno>", "Odhlášeno — data zařízení jsou zpět", "Server Milionáře neodpovídá — nic se nezměnilo",
"Aktualizuj doplněk Milionář (účet)" (426), "Účet nemá TMDb klíč — doplň ho na webu", "Odhlášení z webu proběhne po
skončení přehrávání". All via `xbmc.executebuiltin('Notification(...)')` from non-GUI threads.

## Result

2026-11-06: onboarding step "Účet Milionář" first (QR + code, `/link` on the web), skip of the onboarding for an
account that finished it (S11), key steps saved into the account (S12) with the "doplň na webu" hint, settings
category and menu 1108 item with the account name (S19, S24), key windows locked while signed in (S5), reset with
two warnings (S26), strings 36000–36034 cs/sk/en. Verified in a fresh isolated Kodi and on the Mac Kodi.

2026-11-07 (S30, ADDON onboarding §2c D27–D33): the account step is now a step of the guide window itself
(`wcs/onboarding/account_step.py`, QR card in `DialogMilionarOnboarding.xml`), chosen on Vítej („Přihlásit účtem
Milionář“ / „Pokračovat bez účtu“); the merge offer (S28) shows in that step. The pairing is shared with the menu's
window (`wcs/account/pairing.py`). The guide opens after a sign-out and after a menu sign-in to an account whose guide is
open (`launch.when_due`).
