~aleteoryx/muditaos

14a3bd1687c677feb687dcd30c7f112e427e1bf2 — Maciej Gibowicz 2 years ago 1b08c01
[BH-1746] Minor fixes for onboarding

- default year update
- added system shutdown if there is no user activity for 180 seconds on
the language selection screen
- fixing the logic in onboarding screens
M harmony_changelog.md => harmony_changelog.md +3 -0
@@ 18,6 18,7 @@
* Fixed occasional crash when a deep press occurs during popups
* Fixed diacritics in translations
* Fixed problem with sounds in relaxation and power nap applications
* Fixed the logic in onboarding screens

### Added



@@ 26,12 27,14 @@
* Added extended information to crashdump filename
* Added extended information to log filename
* Added Harmony version information in about section
* Added system shutdown if there is no user activity for 180 seconds on the language selection screen

### Changed / Improved

* Information about device memory is now sent to MC in floating points numbers
* General improvement in Eink display and error handling
* Changed the "Turn off Harmony" popup display time to 10 seconds
* The default year has been updated to 2023

## [2.0.0 2023-06-29]


M products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp => products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp +46 -15
@@ 29,6 29,15 @@
#include <Timers/TimerFactory.hpp>
#include <AppMessage.hpp>

namespace
{
    constexpr auto informationPromptTimeout = std::chrono::seconds{15};
    constexpr auto informationTimerName     = "OnBoardingInformationTimer";
    constexpr auto userIdleTimeout          = std::chrono::minutes{3};
    constexpr auto userIdleTimerName        = "OnBoardingUserIdleTimer";

} // namespace

namespace app
{
    ApplicationBellOnBoarding::ApplicationBellOnBoarding(std::string name,


@@ 38,9 47,21 @@ namespace app
        : Application(std::move(name), std::move(parent), statusIndicators, startInBackground)
    {}

    ApplicationBellOnBoarding::~ApplicationBellOnBoarding()
    {
        if (informationPromptTimer.isValid()) {
            informationPromptTimer.stop();
            informationPromptTimer.reset();
        }
        if (userIdleTimer.isValid()) {
            userIdleTimer.stop();
            userIdleTimer.reset();
        }
    }

    sys::ReturnCodes ApplicationBellOnBoarding::InitHandler()
    {
        auto ret = Application::InitHandler();
        const auto ret = Application::InitHandler();
        if (ret != sys::ReturnCodes::Success) {
            return ret;
        }


@@ 55,10 76,18 @@ namespace app
        });

        informationPromptTimer = sys::TimerFactory::createSingleShotTimer(
            this,
            OnBoarding::informationTimerName,
            OnBoarding::informationPromptTimeout,
            [this]([[maybe_unused]] sys::Timer &timer) { displayInformation(getCurrentWindow()->getName()); });
            this, informationTimerName, informationPromptTimeout, [this]([[maybe_unused]] sys::Timer &timer) {
                displayInformation(getCurrentWindow()->getName());
            });

        userIdleTimer = sys::TimerFactory::createSingleShotTimer(
            this, userIdleTimerName, userIdleTimeout, [this]([[maybe_unused]] sys::Timer &timer) {
                if (getCurrentWindow()->getName() == gui::window::name::onBoardingLanguageWindow) {
                    switchWindow(gui::name::window::main_window);
                }
            });

        userIdleTimer.start();

        return sys::ReturnCodes::Success;
    }


@@ 155,15 184,15 @@ namespace app
    {
        // If user is during language selection, pick new language for hint popup
        if (windowToReturn == gui::window::name::onBoardingLanguageWindow) {
            auto languageSelectWindow = dynamic_cast<gui::OnBoardingLanguageWindow *>(getWindow(windowToReturn));
            auto selectedLang         = languageSelectWindow->getSelectedLanguage();
            const auto languageSelectWindow = dynamic_cast<gui::OnBoardingLanguageWindow *>(getWindow(windowToReturn));
            const auto selectedLang         = languageSelectWindow->getSelectedLanguage();

            if (utils::getDisplayLanguage() != selectedLang) {
                utils::setDisplayLanguage(selectedLang);
            }
        }

        auto [icon, text] = getDisplayDataFromState();
        const auto [icon, text] = getDisplayDataFromState();
        switchWindow(
            gui::window::name::informationOnBoardingWindow,
            gui::BellFinishedWindowData::Factory::create(icon,


@@ 190,11 219,12 @@ namespace app

    bool ApplicationBellOnBoarding::isInformationPromptPermittedOnCurrentWindow()
    {
        auto currentWindow = getCurrentWindow()->getName();
        const auto currentWindow = getCurrentWindow()->getName();
        return (currentWindow != gui::name::window::main_window &&
                currentWindow != gui::window::name::finalizeOnBoardingWindow &&
                (currentWindow != gui::window::name::informationOnBoardingWindow ||
                 informationState == OnBoarding::InformationStates::DeepClickWarningInfo));
                 informationState == OnBoarding::InformationStates::DeepClickWarningInfo ||
                 informationState == OnBoarding::InformationStates::DeepClickCorrectionInfo));
    }

    void ApplicationBellOnBoarding::startTimerOnWindows()


@@ 214,7 244,7 @@ namespace app

    void ApplicationBellOnBoarding::handleInformationBeforeSwitchWindow(sys::DataMessage *msgl)
    {
        auto msg = static_cast<AppSwitchWindowMessage *>(msgl);
        const auto msg = static_cast<AppSwitchWindowMessage *>(msgl);

        informationPromptTimer.stop();



@@ 241,15 271,16 @@ namespace app

    bool ApplicationBellOnBoarding::handleInformationOnInputEvent(sys::DataMessage *msgl)
    {
        auto inputEvent = static_cast<AppInputEventMessage *>(msgl)->getEvent();
        const auto inputEvent = static_cast<AppInputEventMessage *>(msgl)->getEvent();
        restartTimerOnWindows();
        userIdleTimer.restart(userIdleTimeout);

        if (isInformationPromptPermittedOnCurrentWindow()) {
            if (inputEvent.isKeyRelease(gui::KeyCode::KEY_UP) || inputEvent.isKeyRelease(gui::KeyCode::KEY_DOWN)) {
                gui::AppWindow *window = getCurrentWindow();
                auto shortcutsWindow   = window->getName() == gui::window::name::onBoardingShortcutsWindow
                                             ? dynamic_cast<gui::OnBoardingShortcutsWindow *>(window)
                                             : nullptr;
                const auto shortcutsWindow = window->getName() == gui::window::name::onBoardingShortcutsWindow
                                                 ? dynamic_cast<gui::OnBoardingShortcutsWindow *>(window)
                                                 : nullptr;
                if (shortcutsWindow != nullptr) {
                    if (shortcutsWindow->isOneOfTwoLastShortcuts() && inputEvent.isKeyRelease(gui::KeyCode::KEY_UP))
                        informationState = OnBoarding::InformationStates::LightClickInfo;

M products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp => products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp +3 -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


@@ 11,9 11,6 @@ namespace app::OnBoarding
    /// Image name, Prompt info text
    using InformationDisplay = std::pair<std::string, std::string>;

    constexpr auto informationPromptTimeout = std::chrono::seconds{15};
    constexpr auto informationTimerName     = "OnBoardingInformationTimer";

    enum class InformationStates
    {
        RotateInfo,


@@ 30,6 27,7 @@ namespace app
      private:
        OnBoarding::InformationStates informationState = OnBoarding::InformationStates::RotateInfo;
        sys::TimerHandle informationPromptTimer;
        sys::TimerHandle userIdleTimer;

        OnBoarding::InformationDisplay getDisplayDataFromState();
        void displayInformation(const std::string &windowToReturn);


@@ 46,6 44,7 @@ namespace app
                                           std::string parent                  = "",
                                           StatusIndicators statusIndicators   = StatusIndicators{},
                                           StartInBackground startInBackground = {false});
        ~ApplicationBellOnBoarding();

        sys::ReturnCodes InitHandler() override;
        sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;

M products/BellHybrid/apps/application-bell-settings/models/DateTimeUnitsModel.cpp => products/BellHybrid/apps/application-bell-settings/models/DateTimeUnitsModel.cpp +2 -2
@@ 154,8 154,8 @@ namespace app::bell_settings
    {
        using namespace date::literals;

        /// Default date/time after factory reset: 2022/01/01 12:00PM
        const auto factoryResetDate   = 2022_y / jan / 1_d;
        /// Default date/time after factory reset: 2023/01/01 12:00PM
        const auto factoryResetDate   = 2023_y / jan / 1_d;
        const auto factoryRestTimeFmt = utils::time::Locale::TimeFormat::FormatTime12H;

        dateSetListItem->dateSetSpinner->setDate(factoryResetDate);