From 346db1466e9614835233d6df3a6e10427b976c83 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 24 Feb 2024 14:19:25 +0100 Subject: [PATCH] Fix the update notification --- src/Hints.cpp | 2 +- src/UpdaterCheck.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Hints.cpp b/src/Hints.cpp index 39fe5d3..4641d9c 100644 --- a/src/Hints.cpp +++ b/src/Hints.cpp @@ -33,7 +33,7 @@ void ShowHints() { const char *tmp_file = "fs:/vol/external01/wiiu/write_lock"; int fd = -1; if ((fd = open(tmp_file, O_CREAT | O_TRUNC | O_RDWR)) < 0) { - DEBUG_FUNCTION_LINE_VERBOSE("SD Card mounted but not writable"); + DEBUG_FUNCTION_LINE_WARN("SD Card mounted but not writable. errno: %d", errno); NotificationModuleStatus err; NMColor red = {237, 28, 36, 255}; NotificationModuleHandle outHandle; diff --git a/src/UpdaterCheck.cpp b/src/UpdaterCheck.cpp index 277a7dd..6e31073 100644 --- a/src/UpdaterCheck.cpp +++ b/src/UpdaterCheck.cpp @@ -57,7 +57,7 @@ bool saveLatestUpdateHash(const std::string &hash) { } if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) { - DEBUG_FUNCTION_LINE_ERR("Failed to save strorage"); + DEBUG_FUNCTION_LINE_ERR("Failed to save storage"); return false; } @@ -88,7 +88,11 @@ void UpdateCheckThreadEntry() { AromaUpdater::LatestVersion data = nlohmann::json::parse(outBuffer); gUpdateChecked = true; - if (gLastHash == data.getHash()) { + if (gLastHash.empty()) { // don't show update warning on first boot + gLastHash = data.getHash(); + } else if (gLastHash != data.getHash()) { + ShowUpdateNotification(); + } else if (gLastHash == data.getHash()) { DEBUG_FUNCTION_LINE_VERBOSE("We don't need to update the hash"); return; } @@ -96,10 +100,6 @@ void UpdateCheckThreadEntry() { // Update hash gLastHash = data.getHash(); - if (!gLastHash.empty()) { // don't show update warning on first boot - ShowUpdateNotification(); - } - saveLatestUpdateHash(gLastHash); } catch (std::exception &e) { DEBUG_FUNCTION_LINE_WARN("Failed to parse AromaUpdater::LatestVersion");