From b4a12aae327934eb33eae7bb74616af55ccf0bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Wed, 19 Jun 2024 12:15:44 +0200 Subject: [PATCH] Simplify Startup.json parsing slightly The lambdas were originally there to allow for different ways to determine whether the version offered by the website is indeed an update. The lambdas became identical in a9cbd784f756 however, which is when this change should have been made. --- src/client/http/StartupRequest.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/client/http/StartupRequest.cpp b/src/client/http/StartupRequest.cpp index 5dd620ba3..319c8bc66 100644 --- a/src/client/http/StartupRequest.cpp +++ b/src/client/http/StartupRequest.cpp @@ -46,7 +46,7 @@ namespace http if constexpr (!IGNORE_UPDATES) { auto &versions = document["Updates"]; - auto parseUpdate = [this, &versions, &startupInfo](ByteString key, UpdateInfo::Channel channel, std::function updateAvailableFunc) { + auto parseUpdate = [this, &versions, &startupInfo](ByteString key, UpdateInfo::Channel channel) { if (!versions.isMember(key)) { return; @@ -64,7 +64,7 @@ namespace http return info[key].asInt(); }; auto build = getOr(key == "Snapshot" ? "Snapshot" : "Build", 0); - if (!updateAvailableFunc(build)) + if (size_t(build) <= APP_VERSION.build) { return; } @@ -79,20 +79,14 @@ namespace http }; if constexpr (SNAPSHOT || MOD) { - parseUpdate("Snapshot", UpdateInfo::channelSnapshot, [](int build) -> bool { - return size_t(build) > APP_VERSION.build; - }); + parseUpdate("Snapshot", UpdateInfo::channelSnapshot); } else { - parseUpdate("Stable", UpdateInfo::channelStable, [](int build) -> bool { - return size_t(build) > APP_VERSION.build; - }); + parseUpdate("Stable", UpdateInfo::channelStable); if (!startupInfo.updateInfo.has_value()) { - parseUpdate("Beta", UpdateInfo::channelBeta, [](int build) -> bool { - return size_t(build) > APP_VERSION.build; - }); + parseUpdate("Beta", UpdateInfo::channelBeta); } } }