Skip to content

Commit d44fe4a

Browse files
authored
fix: suppress back release from reader settings screens
* fix: suppress back release from reader settings screens * fix: avoid stale back suppression after font errors
1 parent 4699ea7 commit d44fe4a

9 files changed

Lines changed: 31 additions & 8 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Long-press reader shortcuts that open another screen no longer close or confirm it again when releasing the shortcut button.
1111
- RoundedRaff's header battery icon and percentage now sit lower to avoid clipping at the top edge.
1212
- Lyra Carousel now redraws the Home header when restoring cached carousel frames so battery percentage and clock values stay current while navigating between books.
13+
- Reader-launched settings screens no longer jump back two screens after pressing Back.
1314

1415
## [v1.3.3] - 2026-06-13
1516

src/activities/Activity.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ void Activity::startActivityForResult(std::unique_ptr<Activity>&& activity, Acti
2121

2222
void Activity::setResult(ActivityResult&& result) { this->result = std::move(result); }
2323

24+
void Activity::finishAfterBackPress() {
25+
mappedInput.suppressNextBackRelease();
26+
finish();
27+
}
28+
2429
void Activity::finish() { activityManager.popActivity(); }

src/activities/Activity.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class Activity {
2424
ActivityResultHandler resultHandler;
2525
ActivityResult result;
2626

27+
// Use when a screen exits on Back press instead of Back release so the
28+
// parent screen does not also receive the held button's release.
29+
void finishAfterBackPress();
30+
2731
public:
2832
explicit Activity(std::string name, GfxRenderer& renderer, MappedInputManager& mappedInput)
2933
: name(std::move(name)), renderer(renderer), mappedInput(mappedInput) {}

src/activities/network/WifiSelectionActivity.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ void WifiSelectionActivity::loop() {
542542
sConnectionAttemptLoggingActive = false;
543543
#endif
544544
WiFi.disconnect();
545+
mappedInput.suppressNextBackRelease();
545546
onComplete(false);
546547
return;
547548
}
@@ -588,6 +589,7 @@ void WifiSelectionActivity::loop() {
588589
onComplete(true);
589590
} else if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
590591
// Skip saving, complete anyway
592+
mappedInput.suppressNextBackRelease();
591593
onComplete(true);
592594
}
593595
return;
@@ -629,8 +631,13 @@ void WifiSelectionActivity::loop() {
629631
}
630632

631633
if (state == WifiSelectionState::CONNECTED) {
632-
if (mappedInput.wasPressed(MappedInputManager::Button::Back) ||
633-
mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
634+
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
635+
mappedInput.suppressNextBackRelease();
636+
onComplete(true);
637+
return;
638+
}
639+
640+
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
634641
onComplete(true);
635642
}
636643
return;
@@ -659,6 +666,7 @@ void WifiSelectionActivity::loop() {
659666
if (state == WifiSelectionState::NETWORK_LIST) {
660667
// Check for Back button to exit (cancel)
661668
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
669+
mappedInput.suppressNextBackRelease();
662670
onComplete(false);
663671
return;
664672
}

src/activities/settings/FontDownloadActivity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ bool FontDownloadActivity::isSelectedFamilyDeletable() const {
770770
void FontDownloadActivity::loop() {
771771
if (state_ == FAMILY_LIST) {
772772
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
773-
finish();
773+
finishAfterBackPress();
774774
return;
775775
}
776776

@@ -850,7 +850,7 @@ void FontDownloadActivity::loop() {
850850
errorMessage_.clear();
851851
errorHint_.clear();
852852
if (families_.empty()) {
853-
finish();
853+
finishAfterBackPress();
854854
} else {
855855
RenderLock lock(*this);
856856
state_ = FAMILY_LIST;

src/activities/settings/KOReaderAuthActivity.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,12 @@ void KOReaderAuthActivity::render(RenderLock&&) {
103103

104104
void KOReaderAuthActivity::loop() {
105105
if (state == SUCCESS || state == FAILED) {
106-
if (mappedInput.wasPressed(MappedInputManager::Button::Back) ||
107-
mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
106+
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
107+
finishAfterBackPress();
108+
return;
109+
}
110+
111+
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
108112
finish();
109113
}
110114
}

src/activities/settings/KOReaderSettingsActivity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void KOReaderSettingsActivity::onExit() { Activity::onExit(); }
2929

3030
void KOReaderSettingsActivity::loop() {
3131
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
32-
finish();
32+
finishAfterBackPress();
3333
return;
3434
}
3535

src/activities/settings/StatusBarSettingsActivity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void StatusBarSettingsActivity::onExit() { Activity::onExit(); }
216216

217217
void StatusBarSettingsActivity::loop() {
218218
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
219-
finish();
219+
finishAfterBackPress();
220220
return;
221221
}
222222

src/activities/util/KeyboardEntryActivity.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ void KeyboardEntryActivity::loop() {
351351
}
352352

353353
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
354+
mappedInput.suppressNextBackRelease();
354355
onCancel();
355356
}
356357

0 commit comments

Comments
 (0)