[OOBE] Out of box experience window (#9973)

This commit is contained in:
Seraphima Zykova
2021-03-02 20:56:37 +03:00
committed by GitHub
parent a12350274b
commit 078aa3d89b
81 changed files with 2460 additions and 78 deletions

View File

@@ -5,6 +5,7 @@ namespace PTSettingsHelper
{
constexpr inline const wchar_t* settings_filename = L"\\settings.json";
constexpr inline const wchar_t* log_settings_filename = L"log_settings.json";
constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json";
std::wstring get_root_save_folder_location()
{
@@ -77,4 +78,34 @@ namespace PTSettingsHelper
result = result.append(log_settings_filename);
return result.wstring();
}
bool get_oobe_opened_state()
{
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
oobePath = oobePath.append(oobe_filename);
if (std::filesystem::exists(oobePath))
{
auto saved_settings = json::from_file(oobePath.c_str());
if (!saved_settings.has_value())
{
return false;
}
bool opened = saved_settings->GetNamedBoolean(L"openedAtFirstLaunch", false);
return opened;
}
return false;
}
void save_oobe_opened_state()
{
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
oobePath = oobePath.append(oobe_filename);
json::JsonObject obj;
obj.SetNamedValue(L"openedAtFirstLaunch", json::value(true));
json::to_file(oobePath.c_str(), obj);
}
}