Skip to content

refactor: remove object environment dependencies#614

Merged
everpcpc merged 1 commit intomainfrom
codex/refactor-reader-auth-deps
Mar 6, 2026
Merged

refactor: remove object environment dependencies#614
everpcpc merged 1 commit intomainfrom
codex/refactor-reader-auth-deps

Conversation

@everpcpc
Copy link
Copy Markdown
Owner

@everpcpc everpcpc commented Mar 6, 2026

Background

  • KMReader still had non-optional object-style environment lookups across app shells, navigation roots, sheets/covers, and the macOS reader window path.
  • In this codebase those dependencies are fragile during snapshot, rotation, scene transitions, and hosting boundaries, which matches the SwiftUI environment-missing crash family we were chasing on iPad.
  • Auth and reader state were also spread across multiple injection paths and duplicated reader window state, which made the control flow harder to reason about and easier to break.

Summary

  • remove non-optional object-style environment dependencies from the app shell and navigation roots, and pass auth and reader dependencies explicitly through AppViewContext, tab roots, split roots, and onboarding flows
  • keep auth session facts in Current and AppStorage, keep AuthViewModel focused on bootstrap and auth flows, and make root readiness depend on explicit bootstrap state instead of implicit environment wiring
  • replace ReaderWindowManager and BookReaderState with a single ReaderSession source inside ReaderPresentationManager, so iOS/tvOS overlays and the macOS reader window all read the same session state
  • introduce ReaderActions for leaf reader entry points so book cards, book actions, and series actions depend on explicit read actions instead of the whole presentation coordinator
  • tighten AGENTS.md guidance to ban non-optional object-style environment dependencies in app code

Testing

  • make format
  • make build

Pass auth and reader dependencies explicitly through root context and navigation entry points.

Replace the separate reader window state with a single ReaderSession source, introduce ReaderActions for leaf reader entry points, and update AGENTS guidance to ban non-optional object-style environment dependencies.
@everpcpc everpcpc merged commit 9522025 into main Mar 6, 2026
3 checks passed
@everpcpc everpcpc deleted the codex/refactor-reader-auth-deps branch March 6, 2026 11:00
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.

1 participant