Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
## [Unreleased]

### Added
- Added more detailed WiFi connection debug logs for scans, selected networks, connection status changes, disconnect reasons, and timeouts.
- Added a Recent Books long-press menu in both List and Grid views with delete, cache delete, completion, and remove-from-recents actions.
- Added a Minimal sleep screen option that shows the current book cover and reading progress on a dark background.
- Added an in-reader confirmation message when a shortcut turns tilt-to-turn on or off.
- Added a 9pt `Itty Bitty` reader font size, plus build flags for omitting Itty Bitty and Large reader font assets in size-constrained firmware variants.
- Added Back/Cancel support while downloading books from OPDS catalogs.

### Fixed
- Fixed OPDS feed retry actions so the loading screen is shown before the network request starts.
- Fixed the in-reader Customise Status Bar screen in landscape so the list no longer extends under the button labels.
- Fixed manual WiFi connections from Settings returning immediately to the settings list after a saved-password or open-network connection succeeded, so the connected status and IP address are shown first.
- Fixed missing Vietnamese labels for the sleep timeout resume settings.
Expand Down
57 changes: 32 additions & 25 deletions src/activities/browser/OpdsBookBrowserActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ void OpdsBookBrowserActivity::loop() {
if (state == BrowserState::ERROR) {
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
if (WiFi.status() == WL_CONNECTED && WiFi.localIP() != IPAddress(0, 0, 0, 0)) {
state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
requestUpdate();
showLoadingBeforeFetch();
fetchFeed(currentPath);
} else {
launchWifiSelection();
Expand Down Expand Up @@ -212,6 +210,15 @@ void OpdsBookBrowserActivity::render(RenderLock&&) {
renderer.displayBuffer();
}

void OpdsBookBrowserActivity::showLoadingBeforeFetch() {
state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
if (requestUpdateAndWait() != RequestUpdateResult::Rendered) {
LOG_ERR("OPDS", "Loading screen could not be rendered before feed fetch");
requestUpdate(true);
}
}

void OpdsBookBrowserActivity::fetchFeed(const std::string& path) {
if (!ensureEntryBuffer()) {
state = BrowserState::ERROR;
Expand Down Expand Up @@ -296,11 +303,9 @@ void OpdsBookBrowserActivity::navigateToEntry(const OpdsEntry& entry) {
const std::string feedUrl = UrlUtils::buildUrl(server.url, currentPath);
currentPath = UrlUtils::buildUrl(feedUrl, entry.href);

state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
clearEntries();
selectorIndex = 0;
requestUpdate(true);
showLoadingBeforeFetch();
fetchFeed(currentPath);
}

Expand All @@ -310,11 +315,9 @@ void OpdsBookBrowserActivity::navigateBack() {
} else {
currentPath = navigationHistory.back();
navigationHistory.pop_back();
state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
clearEntries();
selectorIndex = 0;
requestUpdate();
showLoadingBeforeFetch();
fetchFeed(currentPath);
}
}
Expand All @@ -333,19 +336,29 @@ void OpdsBookBrowserActivity::downloadBook(const OpdsEntry& book) {
LOG_DBG("OPDS", "Downloading: %s -> %s", downloadUrl.c_str(), filename.c_str());

bool cancelRequested = false;
auto pollCancel = [this, &cancelRequested] {
if (cancelRequested) {
return true;
}
mappedInput.update();
if (mappedInput.isPressed(MappedInputManager::Button::Back) ||
mappedInput.wasPressed(MappedInputManager::Button::Back) ||
mappedInput.wasReleased(MappedInputManager::Button::Back)) {
cancelRequested = true;
}
return cancelRequested;
};
HttpDownloader::DownloadOptions downloadOptions;
downloadOptions.shouldCancel = pollCancel;

const auto result = HttpDownloader::downloadToFile(
downloadUrl, filename,
[this, &cancelRequested](const size_t downloaded, const size_t total) {
[this](const size_t downloaded, const size_t total) {
downloadProgress = downloaded;
downloadTotal = total;
mappedInput.update();
if (mappedInput.isPressed(MappedInputManager::Button::Back) ||
mappedInput.wasPressed(MappedInputManager::Button::Back)) {
cancelRequested = true;
}
requestUpdate(true);
},
&cancelRequested, server.username, server.password);
&cancelRequested, server.username, server.password, downloadOptions);

if (result == HttpDownloader::OK) {
clearBookCache(filename);
Expand Down Expand Up @@ -407,17 +420,13 @@ void OpdsBookBrowserActivity::performSearch(const std::string& query) {
navigationHistory.push_back(currentPath); // <-- add this
currentPath = url; // <-- add this

state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
requestUpdate(true);
showLoadingBeforeFetch();
fetchFeed(url);
}

void OpdsBookBrowserActivity::checkAndConnectWifi() {
if (WiFi.status() == WL_CONNECTED && WiFi.localIP() != IPAddress(0, 0, 0, 0)) {
state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
requestUpdate();
showLoadingBeforeFetch();
fetchFeed(currentPath);
return;
}
Expand All @@ -434,9 +443,7 @@ void OpdsBookBrowserActivity::launchWifiSelection() {

void OpdsBookBrowserActivity::onWifiSelectionComplete(const bool connected) {
if (connected) {
state = BrowserState::LOADING;
statusMessage = tr(STR_LOADING);
requestUpdate(true);
showLoadingBeforeFetch();
fetchFeed(currentPath);
} else {
// Leave WiFi up; onExit's silent reboot handles teardown without fragmenting.
Expand Down
1 change: 1 addition & 0 deletions src/activities/browser/OpdsBookBrowserActivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class OpdsBookBrowserActivity final : public Activity {
void checkAndConnectWifi();
void launchWifiSelection();
void onWifiSelectionComplete(bool connected);
void showLoadingBeforeFetch();
void fetchFeed(const std::string& path);
bool ensureEntryBuffer();
void clearEntries();
Expand Down
Loading
Loading