~aleteoryx/muditaos

59efb79001d28228ddf1989e4c20598ca8a3339c — Dawid Wojtas 2 years ago 9ba4d8c
[BH-1731] Factory reset removes user files

Performing the factory reset removes user files
and settings. After powering on the device
will run the onboarding.
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 17,6 17,7 @@
* Disabled Address Sanitizer for the Linux simulator
* Changed misleading factory reset translations in Polish
* Time setting updated
* Factory reset removes user files 

## [2.2.3 2023-11-30]


M image/system_a/data/lang/Deutsch.json => image/system_a/data/lang/Deutsch.json +3 -1
@@ 92,7 92,9 @@
    "app_bell_settings_bedtime_settings_tone": "Klang",
    "app_bell_settings_bedtime_settings_volume": "<text>Lautst\u00e4rke</text>",
    "app_bell_settings_bedtime_tone": "Schlafens-Klang",
    "app_bell_settings_display_factory_reset_confirmation": "Zur\u00fccksetzen?",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Factory reset will delete all<br />users files and return<br />Harmony to factory settings</text>",
    "app_bell_settings_factory_reset_option_reset": "Reset",
    "app_bell_settings_factory_reset_option_back": "Back",
    "app_bell_settings_factory_reset": "Zur\u00fccksetzen",
    "app_bell_settings_frontlight": "Frontlicht",
    "app_bell_settings_frontlight_mode_auto": "automatisch",

M image/system_a/data/lang/English.json => image/system_a/data/lang/English.json +3 -1
@@ 126,7 126,9 @@
    "app_bell_settings_bedtime_settings_tone": "Bedtime tone",
    "app_bell_settings_bedtime_settings_volume": "<text>Bedtime tone<br />volume</text>",
    "app_bell_settings_bedtime_tone": "Bedtime tone",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Reset to factory<br></br>settings ?</text>",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Factory reset will delete all<br />users files and return<br />Harmony to factory settings</text>",
    "app_bell_settings_factory_reset_option_reset": "Reset",
    "app_bell_settings_factory_reset_option_back": "Back",
    "app_bell_settings_factory_reset": "Factory reset",
    "app_bell_settings_frontlight": "Frontlight",
    "app_bell_settings_frontlight_mode_auto": "auto",

M image/system_a/data/lang/Espanol.json => image/system_a/data/lang/Espanol.json +3 -1
@@ 91,7 91,9 @@
    "app_bell_settings_bedtime_settings_tone": "Hora de dormir",
    "app_bell_settings_bedtime_settings_volume": "Volumen",
    "app_bell_settings_bedtime_tone": "Hora de dormir",
    "app_bell_settings_display_factory_reset_confirmation": "<text>\u00bfRestablecer la configuraci\u00f3n?</text>",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Factory reset will delete all<br />users files and return<br />Harmony to factory settings</text>",
    "app_bell_settings_factory_reset_option_reset": "Reset",
    "app_bell_settings_factory_reset_option_back": "Back",
    "app_bell_settings_factory_reset": "Restablecer",
    "app_bell_settings_frontlight": "Luz frontal",
    "app_bell_settings_frontlight_mode_auto": "autom\u00e1tico",

M image/system_a/data/lang/Francais.json => image/system_a/data/lang/Francais.json +3 -1
@@ 93,7 93,9 @@
    "app_bell_settings_bedtime_settings_tone": "M\u00e9lodie de l'heure du coucher",
    "app_bell_settings_bedtime_settings_volume": "Volume",
    "app_bell_settings_bedtime_tone": "Heure du coucher",
    "app_bell_settings_display_factory_reset_confirmation": "<text>R\u00e9tablir<br></br>la configuration ?</text>",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Factory reset will delete all<br />users files and return<br />Harmony to factory settings</text>",
    "app_bell_settings_factory_reset_option_reset": "Reset",
    "app_bell_settings_factory_reset_option_back": "Back",
    "app_bell_settings_factory_reset": "R\u00e9initialisation",
    "app_bell_settings_frontlight": "Lumi\u00e8re",
    "app_bell_settings_frontlight_mode_auto": "automatique",

M image/system_a/data/lang/Polski.json => image/system_a/data/lang/Polski.json +3 -1
@@ 92,7 92,9 @@
    "app_bell_settings_bedtime_settings_tone": "D\u017awi\u0119k",
    "app_bell_settings_bedtime_settings_volume": "G\u0142o\u015bno\u015b\u0107",
    "app_bell_settings_bedtime_tone": "Pora snu",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Przywrócić ustawienia fabryczne?</text>",
    "app_bell_settings_display_factory_reset_confirmation": "<text>Factory reset will delete all<br />users files and return<br />Harmony to factory settings</text>",
    "app_bell_settings_factory_reset_option_reset": "Reset",
    "app_bell_settings_factory_reset_option_back": "Back",
    "app_bell_settings_factory_reset": "Ustaw. fabryczne",
    "app_bell_settings_frontlight": "Pod\u015bwietlenie",
    "app_bell_settings_frontlight_mode_auto": "automatyczny",

M module-apps/apps-common/options/OptionsList.cpp => module-apps/apps-common/options/OptionsList.cpp +4 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "OptionsList.hpp"


@@ 60,4 60,7 @@ namespace gui
        optionsModel->clearData();
    }

    template class OptionsList<ListView>;
    template class OptionsList<ListViewWithArrows>;

} // namespace gui

M module-apps/apps-common/options/OptionsList.hpp => module-apps/apps-common/options/OptionsList.hpp +1 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 29,7 29,4 @@ namespace gui
        void refreshOptions(std::list<Option> &&optionList);
        void refreshOptions(std::list<Option> &&optionList, unsigned int pageIndex);
    };

    template class OptionsList<ListView>;
    template class OptionsList<ListViewWithArrows>;
} // namespace gui

M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +2 -1
@@ 17,6 17,7 @@
#include <common/models/LayoutModel.hpp>
#include <common/windows/BellWelcomeWindow.hpp>
#include <common/windows/BellFactoryReset.hpp>
#include <common/BellFactoryResetPresenter.hpp>
#include <service-db/DBNotificationMessage.hpp>
#include <windows/Dialog.hpp>
#include <appmgr/messages/ChangeHomescreenLayoutMessage.hpp>


@@ 144,7 145,7 @@ namespace app
                              });

        windowsFactory.attach(gui::BellFactoryReset::name, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::BellFactoryReset>(app, std::make_unique<gui::BellPowerOffPresenter>(app));
            return std::make_unique<gui::BellFactoryReset>(app, std::make_unique<gui::BellFactoryResetPresenter>(app));
        });

        windowsFactory.attach(gui::BellBatteryStatusWindow::name, [](ApplicationCommon *app, const std::string &name) {

M products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp => products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +7 -6
@@ 21,6 21,7 @@
#include "windows/BellSettingsLanguageWindow.hpp"
#include "windows/BellSettingsLayoutWindow.hpp"
#include "windows/BellSettingsFrontlightWindow.hpp"
#include "windows/BellSettingsFactoryResetWindow.hpp"
#include "windows/alarm_settings/BellSettingsAlarmSettingsMenuWindow.hpp"
#include "windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.hpp"
#include "windows/alarm_settings/BellSettingsAlarmSettingsWindow.hpp"


@@ 29,7 30,6 @@
#include "windows/BellSettingsHomeViewWindow.hpp"
#include "windows/BellSettingsTimeUnitsWindow.hpp"
#include "windows/BellSettingsWindow.hpp"
#include "widgets/DialogYesNo.hpp"

#include <Paths.hpp>
#include <apps-common/windows/Dialog.hpp>


@@ 39,6 39,7 @@
#include <common/windows/BellFinishedWindow.hpp>
#include <common/windows/BellTurnOffWindow.hpp>
#include <common/windows/ShortcutsWindow.hpp>
#include <common/windows/BellFactoryReset.hpp>
#include <common/popups/BellTurnOffOptionWindow.hpp>
#include <common/models/AudioModel.hpp>
#include <common/models/TimeModel.hpp>


@@ 153,6 154,11 @@ namespace app
            return std::make_unique<gui::BellTurnOffWindow>(app, std::make_unique<gui::BellPowerOffPresenter>(app));
        });

        windowsFactory.attach(gui::BellSettingsFactoryResetWindow::defaultName,
                              [](ApplicationCommon *app, const std::string &name) {
                                  return std::make_unique<gui::BellSettingsFactoryResetWindow>(app);
                              });

        windowsFactory.attach(
            gui::BellSettingsPrewakeUpWindow::name, [this](ApplicationCommon *app, const std::string &name) {
                auto prewakeUpChimeDurationModel = std::make_unique<bell_settings::PrewakeUpChimeDurationModel>(this);


@@ 237,11 243,6 @@ namespace app
                return std::make_unique<gui::AboutYourBellWindow>(app, std::move(aboutYourBellPresenter));
            });

        windowsFactory.attach(gui::window::name::bellSettingsFactoryReset,
                              [](ApplicationCommon *app, const std::string &name) {
                                  return std::make_unique<gui::BellDialogYesNo>(app, name);
                              });

        windowsFactory.attach(gui::window::name::bellSettingsShortcuts,
                              [&](ApplicationCommon *app, const std::string &name) {
                                  auto presenter = std::make_unique<bell_settings::ShortcutsWindowPresenter>(this);

M products/BellHybrid/apps/application-bell-settings/CMakeLists.txt => products/BellHybrid/apps/application-bell-settings/CMakeLists.txt +1 -0
@@ 64,6 64,7 @@ target_sources(application-bell-settings
        windows/BellSettingsLanguageWindow.cpp
        windows/BellSettingsLayoutWindow.cpp
        windows/BellSettingsFrontlightWindow.cpp
        windows/BellSettingsFactoryResetWindow.cpp
        windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.cpp
        windows/alarm_settings/BellSettingsAlarmSettingsMenuWindow.cpp
        windows/alarm_settings/BellSettingsAlarmSettingsWindow.cpp

M products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp => products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp +0 -1
@@ 19,7 19,6 @@ namespace gui::window::name
    inline constexpr auto bellSettingsLanguage     = "BellSettingsLanguage";
    inline constexpr auto bellSettingsLayout       = "BellSettingsLayout";
    inline constexpr auto bellSettingsBedtimeTone  = "BellSettingsBedtimeTone";
    inline constexpr auto bellSettingsFactoryReset = "BellSettingsFactoryReset";
    inline constexpr auto bellSettingsShortcuts    = "BellSettingsShortcuts";
} // namespace gui::window::name


A products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFactoryResetWindow.cpp => products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFactoryResetWindow.cpp +52 -0
@@ 0,0 1,52 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BellSettingsFactoryResetWindow.hpp"

#include <application-bell-main/ApplicationBellMain.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>
#include <apps-common/ApplicationCommon.hpp>
#include <common/data/StyleCommon.hpp>
#include <common/windows/BellFactoryReset.hpp>
#include <i18n/i18n.hpp>
#include <common/options/OptionBellMenu.hpp>
#include <service-appmgr/ServiceApplicationManagerName.hpp>
#include <service-appmgr/messages/SwitchRequest.hpp>

namespace gui
{
    BellSettingsFactoryResetWindow::BellSettingsFactoryResetWindow(app::ApplicationCommon *app, const std::string &name)
        : BellOptionWithDescriptionWindow(app, name), resetStr{utils::translate(
                                                          "app_bell_settings_factory_reset_option_reset")},
          backStr{utils::translate("app_bell_settings_factory_reset_option_back")}
    {
        addOptions(settingsOptionsList());
        setListTitle(utils::translate("app_bell_settings_factory_reset"));
        setListDescription(utils::translate("app_bell_settings_display_factory_reset_confirmation"));
    }

    std::list<Option> BellSettingsFactoryResetWindow::settingsOptionsList()
    {
        std::list<gui::Option> settingsOptionList;
        auto addWinSettings = [&](const UTF8 &name, std::function<bool(Item &)> activatedCallback) {
            settingsOptionList.emplace_back(std::make_unique<gui::option::OptionBellMenu>(
                name, activatedCallback, [=](gui::Item &) { return true; }, this));
        };

        addWinSettings(backStr, [this](auto &) {
            application->returnToPreviousWindow();
            return true;
        });
        addWinSettings(resetStr, [this](auto &) {
            auto switchRequest = std::make_unique<app::manager::SwitchRequest>(
                service::name::appmgr, app::applicationBellName, gui::BellFactoryReset::name, nullptr);
            application->bus.sendUnicast(std::move(switchRequest), service::name::appmgr);
            return true;
        });

        return settingsOptionList;
    }

    void BellSettingsFactoryResetWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {}
} /* namespace gui */

A products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFactoryResetWindow.hpp => products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFactoryResetWindow.hpp +22 -0
@@ 0,0 1,22 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <common/options/BellOptionWithDescriptionWindow.hpp>

namespace gui
{
    class BellSettingsFactoryResetWindow : public BellOptionWithDescriptionWindow
    {
      public:
        static constexpr auto defaultName = "BellSettingsFactoryResetWindow";
        explicit BellSettingsFactoryResetWindow(app::ApplicationCommon *app, const std::string &name = defaultName);
        void onBeforeShow(ShowMode mode, SwitchData *data) override;

      private:
        std::list<Option> settingsOptionsList();
        const UTF8 resetStr;
        const UTF8 backStr;
    };
} /* namespace gui */

M products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp => products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp +3 -22
@@ 3,6 3,7 @@

#include "AboutYourBellWindow.hpp"
#include "BellSettingsFrontlightWindow.hpp"
#include "BellSettingsFactoryResetWindow.hpp"
#include "BellSettingsWindow.hpp"
#include "alarm_settings/BellSettingsAlarmSettingsMenuWindow.hpp"



@@ 43,26 44,6 @@ namespace gui
            };
        };

        auto factoryResetCallback = [this](const std::string &window) {
            auto actionCallback = [this]() {
                auto switchRequest = std::make_unique<app::manager::SwitchRequest>(
                    service::name::appmgr, app::applicationBellName, gui::BellFactoryReset::name, nullptr);
                application->bus.sendUnicast(std::move(switchRequest), service::name::appmgr);
                return true;
            };

            return [this, actionCallback, window](gui::Item &) {
                auto metaData = std::make_unique<gui::DialogMetadataMessage>(
                    gui::DialogMetadata{utils::translate("app_bell_settings_factory_reset"),
                                        "",
                                        utils::translate("app_bell_settings_display_factory_reset_confirmation"),
                                        "",
                                        actionCallback});
                application->switchWindow(window, gui::ShowMode::GUI_SHOW_INIT, std::move(metaData));
                return true;
            };
        };

        std::list<gui::Option> settingsOptionList;
        auto addWinSettings = [&](const UTF8 &name, const std::string &window, Callback &&callback) {
            settingsOptionList.emplace_back(std::make_unique<gui::option::OptionBellMenu>(


@@ 95,8 76,8 @@ namespace gui
        addWinSettings(
            utils::translate("app_bell_settings_turn_off"), BellTurnOffOptionWindow::defaultName, defaultCallback);
        addWinSettings(utils::translate("app_bell_settings_factory_reset"),
                       gui::window::name::bellSettingsFactoryReset,
                       factoryResetCallback);
                       gui::BellSettingsFactoryResetWindow::defaultName,
                       defaultCallback);

        return settingsOptionList;
    }

M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +3 -0
@@ 13,6 13,7 @@ target_include_directories(application-bell-common
target_sources(application-bell-common
    PRIVATE
        src/BellPowerOffPresenter.cpp
        src/BellFactoryResetPresenter.cpp
        src/AlarmModel.cpp
        src/AudioModel.cpp
        src/LanguageUtils.cpp


@@ 53,6 54,7 @@ target_sources(application-bell-common

        src/options/BellOptionWindow.cpp
        src/options/BellShortOptionWindow.cpp
        src/options/BellOptionWithDescriptionWindow.cpp
        src/options/OptionBellMenu.cpp
        src/options/BellOptionsNavigation.cpp



@@ 74,6 76,7 @@ target_sources(application-bell-common
        include/common/LanguageUtils.hpp
        include/common/SoundsRepository.hpp
        include/common/BellPowerOffPresenter.hpp
        include/common/BellFactoryResetPresenter.hpp
        include/common/windows/BellFactoryReset.hpp
        include/common/windows/BellFinishedWindow.hpp
        include/common/windows/BellTurnOffWindow.hpp

A products/BellHybrid/apps/common/include/common/BellFactoryResetPresenter.hpp => products/BellHybrid/apps/common/include/common/BellFactoryResetPresenter.hpp +20 -0
@@ 0,0 1,20 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <apps-common/popups/presenter/PowerOffPresenter.hpp>

namespace gui
{
    class BellFactoryResetPresenter : public gui::AbstractPowerOffPresenter
    {
      public:
        explicit BellFactoryResetPresenter(app::ApplicationCommon *app);
        void powerOff(sys::CloseReason reason) override;
        void reboot() override;

      private:
        app::ApplicationCommon *application;
    };
} // namespace gui

A products/BellHybrid/apps/common/include/common/options/BellOptionWithDescriptionWindow.hpp => products/BellHybrid/apps/common/include/common/options/BellOptionWithDescriptionWindow.hpp +28 -0
@@ 0,0 1,28 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <ApplicationCommon.hpp>
#include <AppWindow.hpp>
#include <OptionsList.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>

namespace gui
{
    class BellOptionWithDescriptionWindow : public AppWindow, protected OptionsList<ListView>
    {
      protected:
        BellBaseLayout *body{};

      public:
        BellOptionWithDescriptionWindow(app::ApplicationCommon *app, const std::string &name);
        void setListTitle(const std::string &title);
        void setListDescription(const std::string &title);

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void onClose(CloseReason reason) override;
        void rebuild() override;
        void buildInterface() override;
    };
}; // namespace gui

A products/BellHybrid/apps/common/src/BellFactoryResetPresenter.cpp => products/BellHybrid/apps/common/src/BellFactoryResetPresenter.cpp +23 -0
@@ 0,0 1,23 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BellFactoryResetPresenter.hpp"

#include <service-appmgr/messages/OnboardingPowerDownRequest.hpp>
#include <SystemManager/SystemManagerCommon.hpp>

namespace gui
{
    BellFactoryResetPresenter::BellFactoryResetPresenter(app::ApplicationCommon *app) : application(app)
    {}

    void BellFactoryResetPresenter::powerOff([[maybe_unused]] sys::CloseReason reason)
    {
        sys::SystemManagerCommon::FactoryReset(application);
    }
    void BellFactoryResetPresenter::reboot()
    {
        sys::SystemManagerCommon::Reboot(application);
    }

} // namespace gui

A products/BellHybrid/apps/common/src/options/BellOptionWithDescriptionWindow.cpp => products/BellHybrid/apps/common/src/options/BellOptionWithDescriptionWindow.cpp +114 -0
@@ 0,0 1,114 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "common/options/BellOptionWithDescriptionWindow.hpp"
#include "common/options/OptionBellMenu.hpp"
#include "common/options/BellOptionsNavigation.hpp"

#include <messages/OptionsWindow.hpp>
#include <TextFixedSize.hpp>

namespace gui
{
    namespace
    {
        constexpr auto one_option_height      = style::bell_options::h + 2U * style::bell_options::option_margin;
        constexpr auto option_layout_height   = 2U * one_option_height;
        constexpr auto description_height     = 175U;
        constexpr auto max_description_height = description_height + 16U;
        constexpr auto top_center_margin      = -8;
    } // namespace

    BellOptionWithDescriptionWindow::BellOptionWithDescriptionWindow(app::ApplicationCommon *app,
                                                                     const std::string &name)
        : AppWindow(app, name), OptionsList(std::make_shared<OptionsModel>(app, one_option_height))
    {
        buildInterface();

        auto storedCallback        = optionsList->inputCallback;
        optionsList->inputCallback = [&, storedCallback](Item &item, const InputEvent &event) {
            return storedCallback(item, invertNavigationDirection(event));
        };
    }

    void BellOptionWithDescriptionWindow::rebuild()
    {
        recreateOptions();
    }

    void BellOptionWithDescriptionWindow::buildInterface()
    {
        AppWindow::buildInterface();

        statusBar->setVisible(false);
        header->setTitleVisibility(false);
        navBar->setVisible(false);

        body = new BellBaseLayout(this, 0, 0, style::window_width, style::window_height, false);
        body->setEdges(RectangleEdge::None);

        optionsList = new gui::ListView(body->lastBox, 0, 0, 0, 0, optionsModel, listview::ScrollBarType::None);
        optionsList->setAlignment(Alignment(Alignment::Vertical::Bottom));
        optionsList->setMinimumSize(style::bell_options::default_text_width, option_layout_height);
        optionsList->setEdges(RectangleEdge::None);

        body->lastBox->setMaximumHeight(option_layout_height);
        body->resize();

        optionsList->prepareRebuildCallback = [this]() { recreateOptions(); };
        optionsModel->createData(options);

        setFocusItem(optionsList);
    }

    void BellOptionWithDescriptionWindow::setListTitle(const std::string &title)
    {
        auto titleBody = new TextFixedSize(body->firstBox);
        titleBody->drawUnderline(false);
        titleBody->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        titleBody->setFont(style::window::font::largelight);
        titleBody->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
        titleBody->setEdges(RectangleEdge::None);
        titleBody->setEditMode(EditMode::Browse);
        titleBody->setRichText(title);

        body->firstBox->resizeItems();
    }

    void BellOptionWithDescriptionWindow::setListDescription(const std::string &title)
    {
        auto titleBody = new TextFixedSize(body->centerBox);

        titleBody->drawUnderline(false);
        titleBody->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        titleBody->setFont(style::window::font::verybiglight);
        titleBody->setMinimumSize(style::window_width, description_height);
        titleBody->setEdges(RectangleEdge::None);
        titleBody->setEditMode(EditMode::Browse);
        titleBody->setRichText(title);

        body->centerBox->setMargins(gui::Margins{0, top_center_margin, 0, 0});
        body->centerBox->setMaximumHeight(max_description_height);
        body->centerBox->setMinimumHeight(description_height);
        body->centerBox->resizeItems();
        body->resizeItems();
    }

    void BellOptionWithDescriptionWindow::onClose([[maybe_unused]] CloseReason reason)
    {
        if (reason != CloseReason::Popup) {
            optionsList->onClose();
        }
    }

    void BellOptionWithDescriptionWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        if (auto message = dynamic_cast<gui::OptionsWindowOptions *>(data)) {
            LOG_DEBUG("Options load!");
            options = message->takeOptions();
        }

        optionsList->rebuildList(listview::RebuildType::InPlace);
    }

} /* namespace gui */

M products/BellHybrid/apps/common/src/windows/BellFactoryReset.cpp => products/BellHybrid/apps/common/src/windows/BellFactoryReset.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "windows/BellFactoryReset.hpp"


@@ 17,7 17,7 @@ namespace gui
        buildInterface();

        timerCallback = [this](Item &, sys::Timer &) {
            this->presenter->powerOff(sys::CloseReason::FactoryReset);
            this->presenter->powerOff();
            return true;
        };
    }

M scripts/lua/factory.lua => scripts/lua/factory.lua +6 -0
@@ 25,9 25,15 @@ local function remove_cache()
    end
end

local function remove_user_relaxation_files()
    print(string.format("Removing user relaxation files from '%s'", paths.user_relaxation_file))
    helpers.rm_files_from_dir(paths.user_relaxation_file)
end

function factory.execute()
    remove_old_databases()
    copy_clean_databases()
    remove_user_relaxation_files()
    remove_cache()
end


M scripts/lua/share/paths.lua => scripts/lua/share/paths.lua +1 -0
@@ 14,6 14,7 @@ paths.db_factory_dir = paths.db_dir .. "/factory"
paths.temp_dir = user_dir .. "/temp"
paths.update_dir = user_dir .. "/temp/update"
paths.migration_scripts_dir = paths.db_dir .. "/migration"
paths.user_relaxation_file = user_dir .. "/media/app/relaxation"

local target = {}
target.var_dir = target_dir .. "/var"