Files
MuditaOS/module-apps/apps-common/locks/input/PhoneLockedKeysWhitelist.cpp
Lefucjusz 40c628fc60 [MOS-495] Fix deleting message content when changing phone mode
Fix of the issue that moving mode slider on new message
window caused the content of the message to be deleted.
2023-01-09 11:32:39 +01:00

31 lines
1.1 KiB
C++

// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "PhoneLockedKeysWhitelist.hpp"
namespace locks::PhoneLockedKeysWhitelist
{
namespace
{
using namespace gui;
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 : keysWhitelist) {
if (inputEvent.is(key)) {
return true;
}
}
return false;
}
} // namespace locks::PhoneLockedKeysWhitelist