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
This commit is contained in:
@@ -50,6 +50,12 @@ void wifiOff() {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void KOReaderSyncActivity::deferFinish(bool success) {
|
||||
RenderLock lock(*this);
|
||||
pendingFinishSuccess = success;
|
||||
pendingFinish = true;
|
||||
}
|
||||
|
||||
void KOReaderSyncActivity::onWifiSelectionComplete(const bool success) {
|
||||
if (!success) {
|
||||
LOG_DBG("KOSync", "WiFi connection failed, exiting");
|
||||
@@ -89,6 +95,10 @@ void KOReaderSyncActivity::performSync() {
|
||||
documentHash = KOReaderDocumentId::calculate(epubPath);
|
||||
}
|
||||
if (documentHash.empty()) {
|
||||
if (syncMode == SyncMode::PUSH_ONLY) {
|
||||
deferFinish(false);
|
||||
return;
|
||||
}
|
||||
{
|
||||
RenderLock lock(*this);
|
||||
state = SYNC_FAILED;
|
||||
@@ -106,11 +116,16 @@ void KOReaderSyncActivity::performSync() {
|
||||
}
|
||||
requestUpdateAndWait();
|
||||
|
||||
if (syncMode == SyncMode::PUSH_ONLY) {
|
||||
// Skip fetching remote progress entirely -- just upload local position
|
||||
performUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch remote progress
|
||||
const auto result = KOReaderSyncClient::getProgress(documentHash, remoteProgress);
|
||||
|
||||
if (result == KOReaderSyncClient::NOT_FOUND) {
|
||||
// No remote progress - offer to upload
|
||||
{
|
||||
RenderLock lock(*this);
|
||||
state = NO_REMOTE_PROGRESS;
|
||||
@@ -174,6 +189,11 @@ void KOReaderSyncActivity::performUpload() {
|
||||
|
||||
if (result != KOReaderSyncClient::OK) {
|
||||
wifiOff();
|
||||
if (syncMode == SyncMode::PUSH_ONLY) {
|
||||
LOG_DBG("KOSync", "PUSH_ONLY upload failed: %s", KOReaderSyncClient::errorString(result));
|
||||
deferFinish(false);
|
||||
return;
|
||||
}
|
||||
{
|
||||
RenderLock lock(*this);
|
||||
state = SYNC_FAILED;
|
||||
@@ -184,6 +204,11 @@ void KOReaderSyncActivity::performUpload() {
|
||||
}
|
||||
|
||||
wifiOff();
|
||||
if (syncMode == SyncMode::PUSH_ONLY) {
|
||||
LOG_DBG("KOSync", "PUSH_ONLY upload succeeded");
|
||||
deferFinish(true);
|
||||
return;
|
||||
}
|
||||
{
|
||||
RenderLock lock(*this);
|
||||
state = UPLOAD_COMPLETE;
|
||||
@@ -196,6 +221,11 @@ void KOReaderSyncActivity::onEnter() {
|
||||
|
||||
// Check for credentials first
|
||||
if (!KOREADER_STORE.hasCredentials()) {
|
||||
if (syncMode == SyncMode::PUSH_ONLY) {
|
||||
LOG_DBG("KOSync", "PUSH_ONLY: no credentials, finishing silently");
|
||||
deferFinish(false);
|
||||
return;
|
||||
}
|
||||
state = NO_CREDENTIALS;
|
||||
requestUpdate();
|
||||
return;
|
||||
@@ -335,6 +365,15 @@ void KOReaderSyncActivity::render(RenderLock&&) {
|
||||
}
|
||||
|
||||
void KOReaderSyncActivity::loop() {
|
||||
if (pendingFinish) {
|
||||
pendingFinish = false;
|
||||
ActivityResult result;
|
||||
result.isCancelled = !pendingFinishSuccess;
|
||||
setResult(std::move(result));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == NO_CREDENTIALS || state == SYNC_FAILED || state == UPLOAD_COMPLETE) {
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
|
||||
ActivityResult result;
|
||||
|
||||
Reference in New Issue
Block a user