M image/assets/lang/English.json => image/assets/lang/English.json +1 -0
@@ 403,6 403,7 @@
"app_settings_security": "Security",
"app_settings_language": "Language",
"app_settings_factory_reset": "Factory reset",
+ "app_settings_display_factory_reset_confirmation": "Your phone needs to turn off \nto perform factory reset.\n Restart now?",
"app_settings_about_your_pure": "About your Pure",
"app_settings_technical_information": "Technical Information",
"app_settings_tech_info_model": "Model",
M module-apps/application-settings-new/ApplicationSettings.cpp => module-apps/application-settings-new/ApplicationSettings.cpp +3 -0
@@ 447,6 447,9 @@ namespace app
windowsFactory.attach(gui::window::name::about_your_pure, [](Application *app, const std::string &name) {
return std::make_unique<gui::AboutYourPureWindow>(app);
});
+ windowsFactory.attach(gui::window::name::factory_reset, [](Application *app, const std::string &name) {
+ return std::make_unique<gui::DialogYesNo>(app, name);
+ });
windowsFactory.attach(gui::window::name::certification, [](Application *app, const std::string &name) {
return std::make_unique<gui::CertificationWindow>(app);
});
M module-apps/application-settings-new/windows/SystemMainWindow.cpp => module-apps/application-settings-new/windows/SystemMainWindow.cpp +28 -1
@@ 4,6 4,9 @@
#include "application-settings-new/ApplicationSettings.hpp"
#include "OptionSetting.hpp"
#include "SystemMainWindow.hpp"
+#include "DialogMetadataMessage.hpp"
+#include <service-desktop/DesktopMessages.hpp>
+#include <service-desktop/ServiceDesktop.hpp>
namespace gui
{
@@ 26,10 29,34 @@ namespace gui
option::SettingRightItem::ArrowWhite));
};
+ auto addFactoryResetOption = [&](UTF8 name, const std::string &window) {
+ optionList.emplace_back(std::make_unique<option::OptionSettings>(
+ utils::translateI18(name),
+ [=](Item &item) {
+ auto metaData = std::make_unique<gui::DialogMetadataMessage>(
+ gui::DialogMetadata{utils::localize.get("app_settings_factory_reset"),
+ "info_big_circle_W_G",
+ utils::localize.get("app_settings_display_factory_reset_confirmation"),
+ "",
+ [this]() {
+ auto msg = std::make_shared<sdesktop::FactoryMessage>();
+ application->bus.sendUnicast(msg, service::name::service_desktop);
+ application->returnToPreviousWindow(2);
+ return true;
+ }});
+ LOG_INFO("switching to %s page", window.c_str());
+ application->switchWindow(window, gui::ShowMode::GUI_SHOW_INIT, std::move(metaData));
+ return true;
+ },
+ nullptr,
+ this,
+ option::SettingRightItem::Disabled));
+ };
+
addOption("app_settings_language", gui::window::name::languages);
addOption("app_settings_date_and_time", gui::window::name::date_and_time);
- addOption("app_settings_factory_reset", gui::window::name::factory_reset);
addOption("app_settings_about_your_pure", gui::window::name::about_your_pure);
+ addFactoryResetOption("app_settings_factory_reset", gui::window::name::factory_reset);
return optionList;
}