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
@@ -5,7 +5,7 @@
|
||||
#include <Serialization.h>
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t STATE_FILE_VERSION = 3;
|
||||
constexpr uint8_t STATE_FILE_VERSION = 4;
|
||||
constexpr char STATE_FILE[] = "/.crosspoint/state.bin";
|
||||
} // namespace
|
||||
|
||||
@@ -21,6 +21,7 @@ bool CrossPointState::saveToFile() const {
|
||||
serialization::writeString(outputFile, openEpubPath);
|
||||
serialization::writePod(outputFile, lastSleepImage);
|
||||
serialization::writePod(outputFile, readerActivityLoadCount);
|
||||
serialization::writePod(outputFile, lastSleepFromReader);
|
||||
outputFile.close();
|
||||
return true;
|
||||
}
|
||||
@@ -50,6 +51,12 @@ bool CrossPointState::loadFromFile() {
|
||||
serialization::readPod(inputFile, readerActivityLoadCount);
|
||||
}
|
||||
|
||||
if (version >= 4) {
|
||||
serialization::readPod(inputFile, lastSleepFromReader);
|
||||
} else {
|
||||
lastSleepFromReader = false;
|
||||
}
|
||||
|
||||
inputFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user