Files
crosspoint-reader-mod/chat-summaries/2026-03-07_19-00-summary.md
cottongin 9464df1727 mod: restore missing mod features from resync audit
Re-add KOReaderSyncActivity PUSH_ONLY mode (PR #1090):
- SyncMode enum with INTERACTIVE/PUSH_ONLY, deferFinish pattern
- Push & Sleep menu action in EpubReaderMenuActivity
- ActivityManager::requestSleep() for activity-initiated sleep
- main.cpp checks isSleepRequested() each loop iteration

Wire EndOfBookMenuActivity into EpubReaderActivity:
- pendingEndOfBookMenu deferred flag avoids render-lock deadlock
- Handles all 6 actions: ARCHIVE, DELETE, TABLE_OF_CONTENTS,
  BACK_TO_BEGINNING, CLOSE_BOOK, CLOSE_MENU

Add book management to reader menu:
- ARCHIVE_BOOK, DELETE_BOOK, REINDEX_BOOK actions with handlers

Port silent next-chapter pre-indexing:
- silentIndexNextChapterIfNeeded() proactively indexes next chapter
  when user is near end of current one, eliminating load screens

Add per-book letterbox fill toggle in reader menu:
- LETTERBOX_FILL cycles Default/Dithered/Solid/None
- Loads/saves per-book override via BookSettings
- bookCachePath constructor param added to EpubReaderMenuActivity

Made-with: Cursor
2026-03-07 16:53:17 -05:00

2.2 KiB

KOReaderSyncActivity PUSH_ONLY Mode Re-addition

Date: 2026-03-07 Branch: mod/master-resync

Task

Re-add the PUSH_ONLY sync mode to KOReaderSyncActivity that was lost during the upstream resync/ActivityManager migration (originally from PR #1090). This mode allows the reader to silently push local progress to the KOReader sync server and then enter deep sleep — no interactive UI.

Changes

src/activities/reader/KOReaderSyncActivity.h

  • Added enum class SyncMode { INTERACTIVE, PUSH_ONLY } to the class
  • Added syncMode constructor parameter (defaults to INTERACTIVE)
  • Added deferFinish(bool success), pendingFinish, pendingFinishSuccess for safe async finish from blocking calls

src/activities/reader/KOReaderSyncActivity.cpp

  • Implemented deferFinish() — sets a flag that loop() picks up to call setResult()/finish()
  • onEnter(): In PUSH_ONLY mode, silently finish if no credentials (no error UI)
  • performSync(): In PUSH_ONLY mode, skip remote fetch entirely and go straight to performUpload()
  • performUpload(): In PUSH_ONLY mode, use deferFinish() instead of setting UI state on success/failure
  • loop(): Check pendingFinish first and perform deferred finish if set

src/activities/ActivityManager.h

  • Added requestSleep() / isSleepRequested() — allows activities to signal that the device should enter deep sleep. Checked by the main loop.

src/main.cpp

  • Added activityManager.isSleepRequested() check in the main loop, before the auto-sleep timeout check

src/activities/reader/EpubReaderMenuActivity.h / .cpp

  • Added PUSH_AND_SLEEP to the MenuAction enum
  • Added menu item {PUSH_AND_SLEEP, STR_PUSH_AND_SLEEP} between SYNC and CLOSE_BOOK

src/activities/reader/EpubReaderActivity.cpp

  • Added #include "activities/ActivityManager.h"
  • Added PUSH_AND_SLEEP case in onReaderMenuConfirm: launches KOReaderSyncActivity in PUSH_ONLY mode, then calls activityManager.requestSleep() on completion (regardless of success/failure)

lib/I18n/translations/english.yaml / lib/I18n/I18nKeys.h

  • Added STR_PUSH_AND_SLEEP: "Push & Sleep" and regenerated I18n keys

Follow-up Items

  • None