mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-28 20:32:06 +00:00
fixed crash in airplane mode
This commit is contained in:
parent
25dffbf611
commit
4a0f8318d7
4 changed files with 14 additions and 8 deletions
|
@ -46,4 +46,5 @@ namespace util {
|
||||||
bool isApplet();
|
bool isApplet();
|
||||||
std::string getContentsPath();
|
std::string getContentsPath();
|
||||||
bool getBoolValue(const nlohmann::json& jsonFile, const std::string& key);
|
bool getBoolValue(const nlohmann::json& jsonFile, const std::string& key);
|
||||||
|
const nlohmann::ordered_json getValueFromKey(const nlohmann::ordered_json& jsonFile, const std::string& key);
|
||||||
} // namespace util
|
} // namespace util
|
|
@ -18,13 +18,13 @@ using namespace i18n::literals;
|
||||||
AmsTab::AmsTab(const nlohmann::json& nxlinks, const bool erista, const bool hideStandardEntries) : brls::List()
|
AmsTab::AmsTab(const nlohmann::json& nxlinks, const bool erista, const bool hideStandardEntries) : brls::List()
|
||||||
{
|
{
|
||||||
this->erista = erista;
|
this->erista = erista;
|
||||||
this->hekate = nxlinks["hekate"];
|
this->hekate = util::getValueFromKey(nxlinks, "hekate");
|
||||||
auto cfws = nxlinks["cfws"];
|
auto cfws = util::getValueFromKey(nxlinks, "cfws");
|
||||||
|
|
||||||
if (!hideStandardEntries) {
|
if (!hideStandardEntries) {
|
||||||
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "menus/main/ams_text"_i18n + (CurrentCfw::running_cfw == CFW::ams ? "\n" + "menus/ams_update/current_ams"_i18n + CurrentCfw::getAmsInfo() : "") + (erista ? "\n" + "menus/ams_update/erista_rev"_i18n : "\n" + "menus/ams_update/mariko_rev"_i18n), true);
|
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "menus/main/ams_text"_i18n + (CurrentCfw::running_cfw == CFW::ams ? "\n" + "menus/ams_update/current_ams"_i18n + CurrentCfw::getAmsInfo() : "") + (erista ? "\n" + "menus/ams_update/erista_rev"_i18n : "\n" + "menus/ams_update/mariko_rev"_i18n), true);
|
||||||
this->addView(description);
|
this->addView(description);
|
||||||
CreateDownloadItems(cfws.find("Atmosphere") != cfws.end() ? (nlohmann::ordered_json) cfws.at("Atmosphere") : nlohmann::ordered_json::object());
|
CreateDownloadItems(util::getValueFromKey(cfws, "Atmosphere"));
|
||||||
|
|
||||||
description = new brls::Label(
|
description = new brls::Label(
|
||||||
brls::LabelStyle::DESCRIPTION,
|
brls::LabelStyle::DESCRIPTION,
|
||||||
|
@ -41,7 +41,7 @@ AmsTab::AmsTab(const nlohmann::json& nxlinks, const bool erista, const bool hide
|
||||||
});
|
});
|
||||||
this->addView(listItem);
|
this->addView(listItem);
|
||||||
|
|
||||||
CreateDownloadItems(cfws.find("DeepSea") != cfws.end() ? (nlohmann::ordered_json) cfws.at("DeepSea") : nlohmann::ordered_json::object());
|
CreateDownloadItems(util::getValueFromKey(cfws, "DeepSea"));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto custom_pack = fs::parseJsonFile(CUSTOM_PACKS_PATH);
|
auto custom_pack = fs::parseJsonFile(CUSTOM_PACKS_PATH);
|
||||||
|
|
|
@ -44,19 +44,19 @@ MainFrame::MainFrame() : TabFrame()
|
||||||
this->addTab("menus/main/update_ams"_i18n, new AmsTab(nxlinks, erista, util::getBoolValue(hideStatus, "atmosphereentries")));
|
this->addTab("menus/main/update_ams"_i18n, new AmsTab(nxlinks, erista, util::getBoolValue(hideStatus, "atmosphereentries")));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "cfw"))
|
if (!util::getBoolValue(hideStatus, "cfw"))
|
||||||
this->addTab("menus/main/update_bootloaders"_i18n, new ListDownloadTab(archiveType::bootloaders, nxlinks["bootloaders"]));
|
this->addTab("menus/main/update_bootloaders"_i18n, new ListDownloadTab(archiveType::bootloaders, util::getValueFromKey(nxlinks, "bootloaders")));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "sigpatches"))
|
if (!util::getBoolValue(hideStatus, "sigpatches"))
|
||||||
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(archiveType::sigpatches, nxlinks["sigpatches"]));
|
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(archiveType::sigpatches, util::getValueFromKey(nxlinks, "sigpatches")));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "firmwares"))
|
if (!util::getBoolValue(hideStatus, "firmwares"))
|
||||||
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(archiveType::fw, nxlinks["firmwares"]));
|
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(archiveType::fw, util::getValueFromKey(nxlinks, "firmwares")));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "cheats"))
|
if (!util::getBoolValue(hideStatus, "cheats"))
|
||||||
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(archiveType::cheats));
|
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(archiveType::cheats));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "tools"))
|
if (!util::getBoolValue(hideStatus, "tools"))
|
||||||
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, nxlinks["payloads"], erista, hideStatus));
|
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, util::getValueFromKey(nxlinks, "payloads"), erista, hideStatus));
|
||||||
|
|
||||||
this->registerAction("", brls::Key::B, [this] { return true; });
|
this->registerAction("", brls::Key::B, [this] { return true; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,4 +355,9 @@ namespace util {
|
||||||
return (jsonFile.find(key) != jsonFile.end()) ? jsonFile.at(key).get<bool>() : false;
|
return (jsonFile.find(key) != jsonFile.end()) ? jsonFile.at(key).get<bool>() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nlohmann::ordered_json getValueFromKey(const nlohmann::ordered_json& jsonFile, const std::string& key)
|
||||||
|
{
|
||||||
|
return (jsonFile.find(key) != jsonFile.end()) ? jsonFile.at(key) : nlohmann::ordered_json::object();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
Loading…
Reference in a new issue