43 lines
2.2 KiB
Markdown
43 lines
2.2 KiB
Markdown
|
|
# 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
|