Files
MaaAssistantArknights/MeoAssistance/include/Updater.h
2021-07-24 17:51:47 +08:00

39 lines
825 B
C++

#pragma once
#include <string>
#include <optional>
#include <mutex>
namespace asst {
struct __declspec(dllexport) VersionInfo {
std::string tag_name;
std::string html_url;
std::string down_url;
std::string author_name;
std::string created_time;
std::string body;
};
class __declspec(dllexport) Updater
{
static const std::string GithubReleaseLastestApiUrl;
static const std::string GithubReleaseApiUrl;
public:
~Updater() = default;
Updater(const Updater&) = delete;
Updater(Updater&&) = delete;
static Updater& get_instance();
bool has_new_version();
const VersionInfo & get_version_info() const noexcept;
private:
Updater() = default;
std::optional<std::string> request_github_api();
bool m_has_new_version = false;
VersionInfo m_lastest_version;
std::mutex m_mutex;
};
}