| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <string> |
| 7 |
#include <string_view> |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class AutoUpdateChecker |
| 14 |
{ |
| 15 |
public: |
| 16 |
enum class CheckType |
| 17 |
{ |
| 18 |
Automatic, |
| 19 |
Manual, |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
void CheckForUpdate(std::string_view update_track, std::string_view hash_override, |
| 24 |
CheckType check_type); |
| 25 |
|
| 26 |
static bool SystemSupportsAutoUpdates(); |
| 27 |
|
| 28 |
struct NewVersionInformation |
| 29 |
{ |
| 30 |
|
| 31 |
std::string new_shortrev; |
| 32 |
std::string new_hash; |
| 33 |
|
| 34 |
|
| 35 |
std::string changelog_html; |
| 36 |
|
| 37 |
|
| 38 |
std::string this_manifest_url; |
| 39 |
std::string next_manifest_url; |
| 40 |
std::string content_store_url; |
| 41 |
}; |
| 42 |
|
| 43 |
|
| 44 |
enum class RestartMode |
| 45 |
{ |
| 46 |
NO_RESTART_AFTER_UPDATE = 0, |
| 47 |
RESTART_AFTER_UPDATE, |
| 48 |
}; |
| 49 |
void TriggerUpdate(const NewVersionInformation& info, RestartMode restart_mode); |
| 50 |
|
| 51 |
protected: |
| 52 |
virtual void OnUpdateAvailable(const NewVersionInformation& info) = 0; |
| 53 |
}; |