updating: do not update update_check date when we couldn't do it (#9038)

* updating: do not update update_check date when we couldn't do it

- improve general settings page "Last Checked" feature
This commit is contained in:
Andrey Nekrasov
2021-01-12 18:34:02 +03:00
committed by GitHub
parent 7bcf4b7894
commit 1364f78b30
9 changed files with 110 additions and 56 deletions

View File

@@ -4,6 +4,7 @@
#include <string>
#include <future>
#include <filesystem>
#include <variant>
#include <winrt/Windows.Foundation.h>
#include <expected.hpp>
@@ -13,6 +14,9 @@
namespace updating
{
using winrt::Windows::Foundation::Uri;
struct version_up_to_date {};
using github_version_info = std::variant<new_version_download_info, version_up_to_date>;
struct new_version_download_info
{
Uri release_page_uri = nullptr;
@@ -21,10 +25,11 @@ namespace updating
std::wstring installer_filename;
};
std::future<void> try_autoupdate(const bool download_updates_automatically, const notifications::strings&);
// Returns whether the update check has succeeded
std::future<bool> try_autoupdate(const bool download_updates_automatically, const notifications::strings&);
std::filesystem::path get_pending_updates_path();
std::future<std::wstring> download_update(const notifications::strings&);
std::future<nonstd::expected<new_version_download_info, std::wstring>> get_new_github_version_info_async(const notifications::strings& strings, const bool prerelease = false);
std::future<nonstd::expected<github_version_info, std::wstring>> get_github_version_info_async(const notifications::strings& strings, const bool prerelease = false);
// non-localized
constexpr inline std::wstring_view INSTALLER_FILENAME_PATTERN = L"powertoyssetup";