mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
[Auto-update] Turn off on Windows < 1903 (#10240)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "installer.h"
|
||||
#include <common/version/version.h>
|
||||
#include <common/notifications/notifications.h>
|
||||
#include <common/utils/os-detect.h>
|
||||
#include "utils/winapi_error.h"
|
||||
|
||||
namespace // Strings in this namespace should not be localized
|
||||
@@ -192,4 +193,8 @@ namespace updating
|
||||
co_return false;
|
||||
}
|
||||
|
||||
bool is_old_windows_version()
|
||||
{
|
||||
return !Is19H1OrHigher();
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,6 @@ namespace updating
|
||||
|
||||
std::optional<VersionHelper> get_installed_powertoys_version();
|
||||
std::future<bool> uninstall_previous_msix_version_async();
|
||||
|
||||
bool is_old_windows_version();
|
||||
}
|
||||
@@ -7,9 +7,10 @@
|
||||
#include "notifications.h"
|
||||
#include "updating.h"
|
||||
|
||||
#include <common/utils/json.h>
|
||||
#include <common/SettingsAPI/settings_helpers.h>
|
||||
#include <common/notifications/notifications.h>
|
||||
#include <common/SettingsAPI/settings_helpers.h>
|
||||
#include <common/utils/json.h>
|
||||
#include <common/utils/os-detect.h>
|
||||
|
||||
namespace // Strings in this namespace should not be localized
|
||||
{
|
||||
@@ -68,12 +69,17 @@ namespace updating
|
||||
{
|
||||
co_return nonstd::make_unexpected(strings.GITHUB_NEW_VERSION_USING_LOCAL_BUILD_ERROR);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
http::HttpClient client;
|
||||
json::JsonObject release_object;
|
||||
const VersionHelper current_version(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
|
||||
VersionHelper github_version = current_version;
|
||||
|
||||
// On a <1903 system, block updates to 0.36+
|
||||
const bool blockNonPatchReleases = current_version.major == 0 && current_version.minor == 35 && !Is19H1OrHigher();
|
||||
|
||||
if (prerelease)
|
||||
{
|
||||
const auto body = co_await client.request(Uri{ ALL_RELEASES_ENDPOINT });
|
||||
@@ -102,6 +108,11 @@ namespace updating
|
||||
}
|
||||
}
|
||||
|
||||
if (blockNonPatchReleases && github_version >= VersionHelper{ 0, 36, 0 })
|
||||
{
|
||||
co_return version_up_to_date{};
|
||||
}
|
||||
|
||||
if (github_version <= current_version)
|
||||
{
|
||||
co_return version_up_to_date{};
|
||||
|
||||
Reference in New Issue
Block a user