feat: wakeup target detection (#731)
## Summary * If going to sleep was from the Reader view, wake up to the same book. Otherwise, wakeup to the Home view
This commit is contained in:
committed by
GitHub
parent
5b90b68e99
commit
1caad578fc
@@ -194,6 +194,8 @@ void waitForPowerRelease() {
|
||||
|
||||
// Enter deep sleep mode
|
||||
void enterDeepSleep() {
|
||||
APP_STATE.lastSleepFromReader = currentActivity && currentActivity->isReaderActivity();
|
||||
APP_STATE.saveToFile();
|
||||
exitActivity();
|
||||
enterNewActivity(new SleepActivity(renderer, mappedInputManager));
|
||||
|
||||
@@ -331,9 +333,10 @@ void setup() {
|
||||
APP_STATE.loadFromFile();
|
||||
RECENT_BOOKS.loadFromFile();
|
||||
|
||||
// Boot to home screen directly when back button is held or when reader activity crashes 3 times
|
||||
if (APP_STATE.openEpubPath.empty() || mappedInputManager.isPressed(MappedInputManager::Button::Back) ||
|
||||
APP_STATE.readerActivityLoadCount > 0) {
|
||||
// Boot to home screen if no book is open, last sleep was not from reader, back button is held, or reader activity
|
||||
// crashed (indicated by readerActivityLoadCount > 0)
|
||||
if (APP_STATE.openEpubPath.empty() || !APP_STATE.lastSleepFromReader ||
|
||||
mappedInputManager.isPressed(MappedInputManager::Button::Back) || APP_STATE.readerActivityLoadCount > 0) {
|
||||
onGoHome();
|
||||
} else {
|
||||
// Clear app state to avoid getting into a boot loop if the epub doesn't load
|
||||
|
||||
Reference in New Issue
Block a user