add option to restart sphaira upon installing an update
This commit is contained in:
@@ -42,6 +42,7 @@ public:
|
||||
void Loop();
|
||||
|
||||
static void Exit();
|
||||
static void ExitRestart();
|
||||
static auto GetVg() -> NVGcontext*;
|
||||
static void Push(std::shared_ptr<ui::Widget>);
|
||||
|
||||
@@ -89,9 +90,6 @@ public:
|
||||
void Update();
|
||||
void Poll();
|
||||
|
||||
void DrawBackground();
|
||||
void DrawTouch();
|
||||
|
||||
// void DrawElement(float x, float y, float w, float h, ui::ThemeEntryID id);
|
||||
auto LoadElementImage(std::string_view value) -> ElementEntry;
|
||||
auto LoadElementColour(std::string_view value) -> ElementEntry;
|
||||
|
||||
@@ -505,6 +505,11 @@ void App::Exit() {
|
||||
g_app->m_quit = true;
|
||||
}
|
||||
|
||||
void App::ExitRestart() {
|
||||
nro_launch(GetExePath());
|
||||
Exit();
|
||||
}
|
||||
|
||||
void App::Poll() {
|
||||
m_controller.Reset();
|
||||
|
||||
|
||||
@@ -205,7 +205,6 @@ MainMenu::MainMenu() {
|
||||
auto options = std::make_shared<Sidebar>("Menu Options"_i18n, "v" APP_VERSION_HASH, Sidebar::Side::LEFT);
|
||||
ON_SCOPE_EXIT(App::Push(options));
|
||||
|
||||
|
||||
SidebarEntryArray::Items language_items;
|
||||
language_items.push_back("Auto"_i18n);
|
||||
language_items.push_back("English"_i18n);
|
||||
@@ -261,6 +260,15 @@ MainMenu::MainMenu() {
|
||||
}, [this](bool success){
|
||||
if (success) {
|
||||
m_update_state = UpdateState::None;
|
||||
App::Notify("Updated to "_i18n + m_update_version);
|
||||
App::Push(std::make_shared<OptionBox>(
|
||||
"Restart Sphaira?"_i18n,
|
||||
"Back"_i18n, "Restart"_i18n, 1, [this](auto op_index){
|
||||
if (op_index && *op_index) {
|
||||
App::ExitRestart();
|
||||
}
|
||||
}
|
||||
));
|
||||
} else {
|
||||
App::Push(std::make_shared<ui::ErrorBox>(MAKERESULT(351, 1), "Failed to download update"_i18n));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user