Files
PowerToys/src/common/updating/updateState.h
Laszlo Nemeth 2f130bcc62 [Runner]Fix network errors when checking for updates (#26742)
* General: re-implementing network error handling

* Remove unreferenced dead code

* Minor modification in the update procedure. Removing the code part which updates the UI before the real check on new version. UI will be updated after the real check is done.
2023-06-14 10:55:55 +01:00

26 lines
707 B
C++

#pragma once
#include <ctime>
#include <optional>
#include <functional>
// All fields must be default-initialized
struct UpdateState
{
enum State
{
upToDate = 0,
errorDownloading = 1,
readyToDownload = 2,
readyToInstall = 3,
networkError = 4
} state = upToDate;
std::wstring releasePageUrl;
std::optional<std::time_t> githubUpdateLastCheckedDate;
std::wstring downloadedInstallerFilename;
// To prevent concurrent modification of the file, we enforce this interface, which locks the file while
// the state_modifier is active.
static void store(std::function<void(UpdateState&)> stateModifier);
static UpdateState read();
};