~aleteoryx/muditaos

36ba11a72a15e66c667ab037c0de0414ae43e9ee — Maciej Gibowicz 2 years ago d90576e
[BH-1729] Changed the "Turn off Harmony" popup display time to 10 seconds

When the user activates the prompt to turn off Harmony, it has been
displayed for more than 3 minutes.
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 26,6 26,7 @@

* 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

## [2.0.0 2023-06-29]


M products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp => products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp +5 -2
@@ 1,9 1,10 @@
// 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

#pragma once

#include <common/options/BellShortOptionWindow.hpp>
#include <Timers/TimerHandle.hpp>

namespace gui
{


@@ 12,10 13,12 @@ namespace gui
      public:
        static constexpr auto defaultName = "BellTurnOffOptionWindow";
        explicit BellTurnOffOptionWindow(app::ApplicationCommon *app, const char *name = defaultName);
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void onClose(CloseReason reason) override;

      private:
        std::list<Option> settingsOptionsList();

        sys::TimerHandle popupTimer;
        const UTF8 yesStr;
        const UTF8 noStr;
    };

M products/BellHybrid/apps/common/src/popups/BellTurnOffOptionWindow.cpp => products/BellHybrid/apps/common/src/popups/BellTurnOffOptionWindow.cpp +33 -1
@@ 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 "popups/BellTurnOffOptionWindow.hpp"


@@ 12,6 12,14 @@
#include <options/OptionBellMenu.hpp>
#include <service-appmgr/Constants.hpp>
#include <service-appmgr/messages/SwitchRequest.hpp>
#include <GuiTimer.hpp>

namespace
{
    using namespace std::chrono_literals;
    constexpr auto windowTimeout{10s};
    constexpr auto timerName{"BellTurnOffPopupTimer"};
} // namespace

namespace gui
{


@@ 20,6 28,15 @@ namespace gui
    {
        addOptions(settingsOptionsList());
        setListTitle(utils::translate("app_bell_turn_off_question"));

        popupTimer    = app::GuiTimerFactory::createSingleShotTimer(application, this, timerName, windowTimeout);
        timerCallback = [this, name](Item &, sys::Timer &timer) {
            if (application->getCurrentWindow()->getName() == name) {
                application->returnToPreviousWindow();
                return true;
            }
            return false;
        };
    }

    std::list<Option> BellTurnOffOptionWindow::settingsOptionsList()


@@ 43,4 60,19 @@ namespace gui

        return settingsOptionList;
    }

    void BellTurnOffOptionWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        if (popupTimer.isValid()) {
            popupTimer.start();
        }
    }

    void BellTurnOffOptionWindow::onClose([[maybe_unused]] CloseReason reason)
    {
        if (popupTimer.isValid()) {
            popupTimer.stop();
            popupTimer.reset(nullptr);
        }
    }
} /* namespace gui */