feat: long-press Confirm launches KOReader sync from EPUB (#1808)
## Summary - Hold the menu (Confirm) button for ≥1s while reading an EPUB to launch the existing `KOReaderSyncActivity` directly — replaces the three-step path (open reader menu → scroll to Sync → confirm) with a single gesture. - Reuses `ReaderUtils::GO_HOME_MS` (same 1s threshold used by long-press Back) and the existing `KOREADER_STORE.hasCredentials()` guard. - Adds a Controls picker **"Long-press Menu"** (`longPressMenuFunction`, default **Bookmark**) that **cycles through the available functions** bound to the long-press gesture: `KOSync → Disabled → Bookmark`. The field name and `LONG_PRESS_MENU_FUNCTION` enum are intentionally general so future actions (dictionary lookup, table of contents, etc.) can be appended without another schema migration. The setting is **not** a binary toggle. - Existing menu Sync entry still works — both call sites share one extracted helper (`launchKOReaderSync`); no logic duplication. - Short-press Confirm release is gated on duration so the reader menu does not also open after a long press that *acts*, mirroring the existing long-press Back pattern. - **No-credentials fall-through:** `launchKOReaderSync()` now returns whether it acted. When the function is set to KOSync but no KOReader credentials are stored, the long-press is a no-op that **falls through to open the reader menu** — so the menu stays reachable instead of the hold silently swallowing the gesture. The release is only suppressed when sync actually launched or surfaced a save error. ## Test plan - [x] `pio run` succeeds clean for the `default` ESP32-C3 environment. - [x] On-device, value **KOSync**, valid KOReader credentials: long-press Confirm ≥1s → sync screen launches; get + update progress return HTTP 200; release does **not** also open the reader menu; returns to the same page. - [x] On-device, value **KOSync**, **no** credentials: long-press Confirm falls through and **opens the reader menu** (regression fix); short-press also opens the menu. - [x] On-device: menu → Sync still launches the same screen (shared helper) and syncs (200/200). - [x] On-device, value **Bookmark**: long-press drops a bookmark and does **not** also open the menu. - [x] On-device, value **Disabled**: long-press Confirm opens the menu on release; no sync, no bookmark. - [x] On-device: long-press Back still goes to the file browser (unchanged path). - [x] Heap: epub is released before the TLS handshake (frees ~16 KB); min free heap stayed ~84 KB during sync, well above the safe floor. No panics/OOM across the session. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
54d5a788a5
commit
d4069aeae5
@@ -78,6 +78,7 @@ STR_LONG_PRESS_BEHAVIOR: "Long-press button behavior"
|
||||
STR_LONG_PRESS_BEHAVIOR_OFF: "OFF"
|
||||
STR_LONG_PRESS_BEHAVIOR_SKIP: "Chapter skip"
|
||||
STR_LONG_PRESS_BEHAVIOR_ORIENTATION: "Orientation change"
|
||||
STR_LONG_PRESS_MENU: "Long-press Menu"
|
||||
STR_FONT_FAMILY: "Reader Font Family"
|
||||
STR_FONT_SIZE: "Reader Font Size"
|
||||
STR_LINE_SPACING: "Reader Line Spacing"
|
||||
@@ -140,6 +141,8 @@ STR_INVERTED: "Inverted"
|
||||
STR_LANDSCAPE_CCW: "Landscape CCW"
|
||||
STR_PREV_NEXT: "Prev/Next"
|
||||
STR_NEXT_PREV: "Next/Prev"
|
||||
STR_KOSYNC: "KOSync"
|
||||
STR_BOOKMARK_OPTION: "Bookmark"
|
||||
STR_DISABLED: "Disabled"
|
||||
STR_NOTO_SERIF: "Noto Serif"
|
||||
STR_NOTO_SANS: "Noto Sans"
|
||||
|
||||
Reference in New Issue
Block a user