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
2.2 KiB
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
syncModeconstructor parameter (defaults toINTERACTIVE) - Added
deferFinish(bool success),pendingFinish,pendingFinishSuccessfor safe async finish from blocking calls
src/activities/reader/KOReaderSyncActivity.cpp
- Implemented
deferFinish()— sets a flag thatloop()picks up to callsetResult()/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 toperformUpload()performUpload(): In PUSH_ONLY mode, usedeferFinish()instead of setting UI state on success/failureloop(): CheckpendingFinishfirst 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_SLEEPto theMenuActionenum - 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_SLEEPcase inonReaderMenuConfirm: launchesKOReaderSyncActivityinPUSH_ONLYmode, then callsactivityManager.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