Skip to content

refactor(input): clarify modal precedence and typed UI action contract - #72

Merged
susamn merged 1 commit into
mainfrom
refactor/input-precedence
Oct 27, 2026
Merged

susamn merged 1 commit into
mainfrom
refactor/input-precedence

Conversation

@susamn

@susamn susamn commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Resolves #69.

Summary

  • Replaced loosely typed UI-to-app command strings with strongly typed ui.Action and ui.ActionKind in internal/ui/action.go:
    • ActionToggle, ActionStop, ActionNext, ActionSeekForward, ActionSeekBackward, ActionSetTheme, ActionCycleCountry.
    • Updated newShell (internal/app/controls.go) to handle actions via a clean typed switch without prefix string parsing.
  • Refactored handleKey into an explicit 4-layer modal precedence architecture:
    1. Layer 1 (tryModalKey): Application modals and text inputs (URL viewer, chapters, onboarding, confirmation, add feed URL, search modal) consume keystrokes exclusively, preventing accidental playback mutations.
    2. Layer 2 (Model.Busy()): UI presentation modals (column filter, settings theme picker, help popup, message viewer) consume their keys via delegation.
    3. Layer 3 (handleActionKey): Application contextual and transport actions (volume, seek, play/pause, queue, subscribe, details).
    4. Layer 4 (delegate): Default UI panel and list navigation.
  • Added comprehensive table-driven test suite internal/app/modal_precedence_test.go verifying input isolation, modal precedence, quit delegation, and episode identity retention across all modals.
  • Updated docs/code-flow.md documenting the input precedence layers and typed action contract.

@susamn
susamn merged commit 721a6eb into main Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(input): clarify modal precedence and ownership of UI actions

1 participant