mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-03 16:05:12 +00:00
Auto-updating: add text for "Last checked" (#8645)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "general_settings.h"
|
||||
#include <common/themes/windows_colors.h>
|
||||
#include "restart_elevated.h"
|
||||
#include "update_state.h"
|
||||
#include "update_utils.h"
|
||||
#include "centralized_kb_hook.h"
|
||||
|
||||
@@ -19,9 +20,10 @@
|
||||
#include <common/version/helper.h>
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/utils/elevation.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
#include <common/utils/process_path.h>
|
||||
#include <common/utils/os-detect.h>
|
||||
#include <common/utils/process_path.h>
|
||||
#include <common/utils/timeutil.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
@@ -92,6 +94,22 @@ std::optional<std::wstring> dispatch_json_action_to_module(const json::JsonObjec
|
||||
json.SetNamedValue(L"version", json::JsonValue::CreateStringValue(latestVersion.toWstring()));
|
||||
json.SetNamedValue(L"isVersionLatest", json::JsonValue::CreateBooleanValue(!new_version_info));
|
||||
|
||||
result.emplace(json.Stringify());
|
||||
UpdateState::store([](UpdateState& state) {
|
||||
state.github_update_last_checked_date.emplace(timeutil::now());
|
||||
});
|
||||
}
|
||||
else if (action == L"request_update_state_date")
|
||||
{
|
||||
json::JsonObject json;
|
||||
|
||||
auto update_state = UpdateState::read();
|
||||
if (update_state.github_update_last_checked_date)
|
||||
{
|
||||
const time_t date = *update_state.github_update_last_checked_date;
|
||||
json.SetNamedValue(L"updateStateDate", json::JsonValue::CreateStringValue(std::to_wstring(date)));
|
||||
}
|
||||
|
||||
result.emplace(json.Stringify());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user