updating: add support for prereleases (#8296)

This commit is contained in:
Andrey Nekrasov
2020-12-10 19:05:43 +03:00
committed by GitHub
parent 8a7824924a
commit 84932eb9da
9 changed files with 114 additions and 64 deletions

View File

@@ -81,13 +81,14 @@ std::optional<std::wstring> dispatch_json_action_to_module(const json::JsonObjec
}
else if (action == L"check_for_updates")
{
std::wstring latestVersion = check_for_updates();
VersionHelper current_version(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
bool isRunningLatest = latestVersion.compare(current_version.toWstring()) == 0;
auto new_version_info = check_for_updates();
const VersionHelper latestVersion =
new_version_info ? new_version_info->version :
VersionHelper{ VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION };
json::JsonObject json;
json.SetNamedValue(L"version", json::JsonValue::CreateStringValue(latestVersion));
json.SetNamedValue(L"isVersionLatest", json::JsonValue::CreateBooleanValue(isRunningLatest));
json.SetNamedValue(L"version", json::JsonValue::CreateStringValue(latestVersion.toWstring()));
json.SetNamedValue(L"isVersionLatest", json::JsonValue::CreateBooleanValue(!new_version_info));
result.emplace(json.Stringify());
}