~aleteoryx/muditaos

2023cf57307c54acf4ffce67a64fb6877bed7cda — Maciej Gibowicz 2 years ago 36ba11a
[BH-1728] Fix redundant clock face display while shutting down Harmony

When the user holds the back button for 10 seconds to display
the "turning off" prompt, we  show a redundant clock face display.
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 13,6 13,7 @@
* Fixed problem with displaying some filenames in Relaxation
* Fixed disabling the alarm on the system shutdown screen
* Fixed "Next alarm will ring in 24h" popup on shutdown screen
* Fixed redundant clock face display while shutting down Harmony

### Added


M module-gui/gui/input/Translator.cpp => module-gui/gui/input/Translator.cpp +0 -1
@@ 161,7 161,6 @@ namespace gui
            return gui::KeyCode::HEADSET_OK;

        case bsp::KeyCodes::HeadsetVolUp:
            void resetPreviousKeyPress();
            return gui::KeyCode::HEADSET_VOLUP;

        case bsp::KeyCodes::HeadsetVolDown:

M products/BellHybrid/apps/application-bell-main/windows/BellBatteryStatusWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellBatteryStatusWindow.cpp +26 -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

#include "BellBatteryStatusWindow.hpp"


@@ 13,6 13,8 @@

namespace
{
    using namespace std::chrono_literals;

    constexpr auto imageType = gui::ImageTypeSpecifier::W_G;
    constexpr auto batteryEntries =
        std::array<battery_utils::BatteryLevelEntry, 6>{{{{0, 9}, "bell_status_battery_lvl0"},


@@ 21,13 23,16 @@ namespace
                                                         {{40, 69}, "bell_status_battery_lvl3"},
                                                         {{70, 95}, "bell_status_battery_lvl4"},
                                                         {{96, 100}, "bell_status_battery_lvl5"}}};
    // this time must be longer than the long press time (10s) to turn off the system
    constexpr auto windowLongTimeout{12s};
    // default screen timeout
    constexpr auto windowDefaultTimeout{3s};
} // namespace

namespace gui
{
    using namespace std::chrono_literals;

    BellBatteryStatusWindow::BellBatteryStatusWindow(app::ApplicationCommon *app) : WindowWithTimer{app, name, 5s}
    BellBatteryStatusWindow::BellBatteryStatusWindow(app::ApplicationCommon *app)
        : WindowWithTimer{app, name, windowLongTimeout}
    {
        buildInterface();
    }


@@ 88,6 93,19 @@ namespace gui
            application->returnToPreviousWindow();
            return true;
        }
        else if (inputEvent.getKeyCode() == KeyCode::KEY_RF) {
            if (inputEvent.isLongRelease()) {
                // here the "back" button is held all the time, so we set the screen timeout to a long time
                // to stay on this screen until the system shutdown popup is displayed
                resetTimer(windowLongTimeout);
            }
            else {
                // here the "back" button is released, so we set the screen timeout to the default time
                resetTimer(windowDefaultTimeout);
            }
            return true;
        }

        return false;
    }
    void BellBatteryStatusWindow::onBeforeShow(ShowMode mode, SwitchData *data)


@@ 105,4 123,8 @@ namespace gui
        }
        WindowWithTimer::onBeforeShow(mode, data);
    }
    void BellBatteryStatusWindow::onClose(CloseReason reason)
    {
        application->popCurrentWindow();
    }
} // namespace gui

M products/BellHybrid/apps/application-bell-main/windows/BellBatteryStatusWindow.hpp => products/BellHybrid/apps/application-bell-main/windows/BellBatteryStatusWindow.hpp +2 -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

#pragma once


@@ 34,6 34,7 @@ namespace gui
        void buildInterface() override;
        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void onClose(CloseReason reason) override;

        BellBaseLayout *body{};
        TextFixedSize *topDescription{};

M products/BellHybrid/services/evtmgr/EventManager.cpp => products/BellHybrid/services/evtmgr/EventManager.cpp +1 -0
@@ 165,6 165,7 @@ void EventManager::buildKeySequences()

    auto powerOffSeq      = std::make_unique<PowerOffSequence>(*this);
    powerOffSeq->onAction = [this]() {
        backlightHandler.handleScreenLight(backlight::Type::Frontlight);
        app::manager::Controller::sendAction(
            this, app::manager::actions::ShowPopup, std::make_unique<PowerOffPopupRequestParams>());
    };