Yokan / rebuild
Course 1 8624561

READER_PROCESSING.md

docs/features/READER_PROCESSING.md

documentation / design asset101 lines
1# Reader processing and navigation23Parity stage 7 (Animetail diff rows R2, R3, R5, R6, R7, R8, R11, R12). All policies4live in shared code; preferences are stored in `DbSettings.features.reader`5(`DbReaderPreferences`) so the `DbSettings` constructor and the Room schema are6unchanged. Defaults keep the previous reader behavior.78## Paged and continuous preferences (R6)910`DbReaderModePreferences` exists twice: `paged` (LTR, RTL, vertical pager) and11`webtoon` (vertical continuous, webtoon, horizontal continuous). Each holds crop12borders, page-transition animation, tap zones, tap-zone layout, wide-page split13and wide-page rotation. A group is `null` until first changed; while `null` it is14derived from the legacy global fields (`cropBorders`, `animatePageTransitions`,15`usePageTapZones`, `readerNavigationLayout`), so existing settings carry into both16groups without a migration step and old backups restore unchanged. Settings →17Reader shows both groups; the in-reader sheet and the bottom-bar crop toggle edit18the group of the current mode.1920## Split and rotate wide pages (R2, R3)2122Page shapes come from the reader's existing Coil prefetch sampling. When splitting23is on for the current mode, `splitWidePagesInStream` replaces each landscape page24(`width > height`) in the reader stream with two halves (`ReaderPageHalf.First`,25`Second`) and maps the current position onto the same half; turning the option26off collapses halves back. Halves share the source page index, so progress,27history, page slider, colorized overrides and chapter page lists are unchanged,28and halves never pair into a double-page spread. A split page stays split when29its sampled shape is evicted, so positions do not shift underneath the reader.3031The first half follows reading direction (left for LTR, right for RTL); *Invert32split order* swaps it. Rotation turns landscape bitmaps a quarter turn33(clockwise, counter-clockwise when inverted) and yields to splitting. Both run as34Coil transformations inside the existing decode pipeline next to border cropping35(Android `Bitmap`, Skia on desktop/iOS/web) with separate memory-cache keys.36Each half has its own zoom state.3738## Chapter navigation (R7, R8)3940- *Skip filtered chapters* (default on, the previous behavior) applies the title's41  chapter filters to previous/next chapter. Off uses every chapter, still honoring42  the duplicate-release preference.43- *Skip read chapters* (default off) removes read chapters after release selection,44  so a read chapter never falls back to an unread alternate release. The open45  chapter always stays in the sequence.46- *Always show chapter transition* (default on, the previous behavior). Off joins47  the next chapter's pages directly; like Mihon, the card still appears when48  chapter numbers skip ahead and at the last chapter.4950## Image export (R11, R12)5152The page actions sheet adds *Copy image*. When the long-pressed page is shown in a53two-page spread, *Save/Share/Copy both pages* merge the spread: both pages are54scaled to the taller height, placed in displayed order (mirrored for RTL) and55encoded as JPEG (quality 90). Merging reuses the tall-image splitter limits:56inputs up to 32 MiB, still images only, upright EXIF orientation, at most 2457million output pixels.5859| Platform | Clipboard | Per-title save folder |60| --- | --- | --- |61| Android | `ClipboardManager` with a `FileProvider` content URI (readers get a temporary grant) | `Pictures/Yokan/<title>` via MediaStore `RELATIVE_PATH` (API 29+) |62| Desktop | AWT system clipboard (`imageFlavor`); Skia normalizes WebP/AVIF to PNG first | `~/Pictures/Yokan/<title>` |63| iOS | `UIPasteboard.general.image` | Photos album named after the title (requests read-write library access) |64| Web | Async Clipboard API with a PNG `ClipboardItem` | Not applicable (see blockers) |6566Folder names keep Unicode but replace path separators, reserved characters and67control characters.6869## Volume keys (R5)7071*Volume keys turn pages* (default off): volume down is next page, volume up is72previous; *Invert volume keys* swaps them. Both key edges are consumed so the73system volume does not change. Implemented in the shared reader key handler.7475## Platform blockers7677- **iOS volume buttons:** iOS has no public API delivering hardware volume-button78  presses to a reading app. `AVCaptureEventInteraction` only works with an active79  camera capture session, and observing `AVAudioSession.outputVolume` changes the80  user's system volume, shows the volume HUD and cannot detect presses at the volume81  limits. The preference has no effect on iOS.82- **Desktop and web volume keys:** not applicable; the OS consumes media and83  volume keys before they reach the window.84- **Web save folder:** browsers choose the download location and strip directory85  components from download names, so the title folder cannot be created. Saved86  file names already start with the title.87- **Android 8–9 save folder:** MediaStore has no relative path before API 29;88  images are saved to the default Pictures collection as before.89- **Web clipboard:** requires a secure context and a browser that supports90  `ClipboardItem` image writes; failures show *Copy failed*.9192## Verification9394Tests: `ReaderProcessingTest` (common: split stream, half side/rotation choice,95pairing, hidden transitions, skip-read, legacy fallback and serialization, volume96keys, folder names, spread layout), `ReaderPageProcessingSkiaTest` (Skia half,97rotation and spread merge), `ImageSharingDesktopTest` (per-title folder).98Desktop, Android, iOS simulator ARM64 and Wasm compile. Focused desktop run99(reader, image sharing, feature preferences, chapter sequence, settings search,100routes, backup): 212 passed. Wasm browser run (reader processing, Skia101processing, reader runtime, chapter sequence, border crop): 35 passed.102

Search chapters, reference and source filenames.