mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 13:03:13 +00:00
lock device shortcut
This commit is contained in:
parent
5f28eafcd2
commit
39cd10f061
3 changed files with 16 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "../views/desktop_view_main.h"
|
||||
#include "desktop_scene.h"
|
||||
#include "desktop_scene_i.h"
|
||||
#include "../helpers/pin_lock.h"
|
||||
|
||||
#define TAG "DesktopSrv"
|
||||
|
||||
|
@ -96,6 +97,18 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||
consumed = true;
|
||||
break;
|
||||
|
||||
case DesktopMainEventLock:
|
||||
if(desktop->settings.pin_code.length > 0) {
|
||||
scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1);
|
||||
desktop_pin_lock(&desktop->settings);
|
||||
desktop_lock(desktop);
|
||||
} else {
|
||||
scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 0);
|
||||
desktop_lock(desktop);
|
||||
}
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
case DesktopMainEventOpenArchive:
|
||||
#ifdef APP_ARCHIVE
|
||||
desktop_switch_to_app(desktop, &FLIPPER_ARCHIVE);
|
||||
|
|
|
@ -9,6 +9,7 @@ typedef enum {
|
|||
DesktopMainEventOpenDebug,
|
||||
DesktopMainEventOpenPassport,
|
||||
DesktopMainEventOpenPowerOff,
|
||||
DesktopMainEventLock,
|
||||
|
||||
DesktopMainEventOpenGameMenu,
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ bool desktop_main_input_callback(InputEvent* event, void* context) {
|
|||
main_view->callback(DesktopMainEventOpenDebug, main_view->context);
|
||||
} else if(event->key == InputKeyLeft) {
|
||||
main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context);
|
||||
} else if(event->key == InputKeyUp) {
|
||||
main_view->callback(DesktopMainEventLock, main_view->context);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue