~aleteoryx/muditaos

b1ee7177696170f582313a1424d022e0ab4a8f8f — Lefucjusz 3 years ago 18a4e88
[MOS-37] Slider triggering unlock instructions popup fix

Fix of the issue that changing phone mode
using slider while the phone was locked
unnecessarily triggered the popup with
unlock instructions.
1 files changed, 10 insertions(+), 4 deletions(-)

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

#include "PhoneLockedKeysWhitelist.hpp"


@@ 9,13 9,19 @@ namespace locks::PhoneLockedKeysWhitelist
    namespace
    {
        using namespace gui;
        constexpr std::array list = {
            KeyCode::KEY_TORCH, KeyCode::KEY_VOLDN, KeyCode::HEADSET_VOLDN, KeyCode::KEY_VOLUP, KeyCode::HEADSET_VOLUP};
        constexpr std::array keysWhitelist = {KeyCode::KEY_TORCH,
                                              KeyCode::KEY_VOLDN,
                                              KeyCode::HEADSET_VOLDN,
                                              KeyCode::KEY_VOLUP,
                                              KeyCode::HEADSET_VOLUP,
                                              KeyCode::SWITCH_DN,
                                              KeyCode::SWITCH_MID,
                                              KeyCode::SWITCH_UP};
    } // anonymous namespace

    [[nodiscard]] bool isOnWhitelist(const gui::InputEvent &inputEvent)
    {
        for (const auto &key : list) {
        for (const auto &key : keysWhitelist) {
            if (inputEvent.is(key)) {
                return true;
            }