2020-04-21 10:30:12 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <future>
|
|
|
|
|
#include <filesystem>
|
2021-01-12 18:34:02 +03:00
|
|
|
#include <variant>
|
2020-04-21 10:30:12 +03:00
|
|
|
#include <winrt/Windows.Foundation.h>
|
2020-12-10 19:05:43 +03:00
|
|
|
#include <expected.hpp>
|
2020-04-21 10:30:12 +03:00
|
|
|
|
2020-12-15 15:16:09 +03:00
|
|
|
#include <common/version/helper.h>
|
2020-07-27 19:53:29 +03:00
|
|
|
|
2020-04-21 10:30:12 +03:00
|
|
|
namespace updating
|
|
|
|
|
{
|
2020-12-10 19:05:43 +03:00
|
|
|
using winrt::Windows::Foundation::Uri;
|
2021-05-21 13:32:34 +03:00
|
|
|
struct version_up_to_date
|
|
|
|
|
{
|
|
|
|
|
};
|
2020-04-21 10:30:12 +03:00
|
|
|
struct new_version_download_info
|
|
|
|
|
{
|
2020-12-10 19:05:43 +03:00
|
|
|
Uri release_page_uri = nullptr;
|
|
|
|
|
VersionHelper version{ 0, 0, 0 };
|
|
|
|
|
Uri installer_download_url = nullptr;
|
2020-06-18 13:43:09 +03:00
|
|
|
std::wstring installer_filename;
|
2020-04-21 10:30:12 +03:00
|
|
|
};
|
2021-05-21 13:32:34 +03:00
|
|
|
using github_version_info = std::variant<new_version_download_info, version_up_to_date>;
|
2020-04-21 10:30:12 +03:00
|
|
|
|
2021-05-21 13:32:34 +03:00
|
|
|
std::future<std::optional<std::filesystem::path>> download_new_version(const new_version_download_info& new_version);
|
2020-04-21 10:30:12 +03:00
|
|
|
std::filesystem::path get_pending_updates_path();
|
2021-06-14 12:55:59 +03:00
|
|
|
std::future<nonstd::expected<github_version_info, std::wstring>> get_github_version_info_async(const bool prerelease = false);
|
2020-06-23 15:53:02 +03:00
|
|
|
|
2020-07-27 19:53:29 +03:00
|
|
|
// non-localized
|
|
|
|
|
constexpr inline std::wstring_view INSTALLER_FILENAME_PATTERN = L"powertoyssetup";
|
2020-12-10 19:05:43 +03:00
|
|
|
}
|