14enum class UpdateCheckState
33 static AutoUpdater*
Get();
39 void CheckForUpdates(
bool showUIOnNoUpdate =
false);
54 void LaunchInstaller();
64 UpdateCheckState GetState()
const {
return mState.load(); }
69 const ReleaseInfo& GetLatestRelease()
const {
return mLatestRelease; }
74 const std::string& GetErrorMessage()
const {
return mErrorMessage; }
79 float GetDownloadProgress()
const;
84 size_t GetDownloadedBytes()
const {
return mDownloadedBytes.load(); }
89 size_t GetTotalBytes()
const {
return mTotalBytes.load(); }
99 void SkipThisVersion();
104 bool ShouldShowWindow()
const {
return mShowWindow; }
109 void SetShowWindow(
bool show) { mShowWindow = show; }
115 void CheckThreadFunc();
116 void DownloadThreadFunc();
117 bool ParseReleaseJson(
const std::string& json);
120 static AutoUpdater* sInstance;
123 std::thread mCheckThread;
124 std::thread mDownloadThread;
127 std::atomic<bool> mRunning{
false};
128 std::atomic<bool> mCancelRequested{
false};
129 std::atomic<UpdateCheckState> mState{UpdateCheckState::Idle};
132 std::atomic<size_t> mDownloadedBytes{0};
133 std::atomic<size_t> mTotalBytes{0};
136 std::mutex mResultMutex;
137 ReleaseInfo mLatestRelease;
138 std::string mErrorMessage;
139 std::string mDownloadedInstallerPath;
142 bool mShowUIOnNoUpdate =
false;
143 bool mShowWindow =
false;
144 bool mCheckCompleteThisFrame =
false;
145 bool mDownloadCompleteThisFrame =
false;
148 static constexpr const char* kGitHubApiUrl =
"https://api.github.com/repos/polyphase-labs/polyphase-engine/releases/latest";
149 static constexpr const char* kGitHubApiAllReleasesUrl =
"https://api.github.com/repos/polyphase-labs/polyphase-engine/releases";
bool Update()
Definition Engine.cpp:710