Skip to content

Commit

Permalink
lock device with pin by long pressing up button
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrodriges committed Oct 13, 2022
1 parent 5f28eaf commit f76b3eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions applications/services/desktop/scenes/desktop_scene_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -96,6 +97,14 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;

case DesktopMainEventPinLock:
if(desktop->settings.pin_code.length > 0) {
desktop_pin_lock(&desktop->settings);
desktop_lock(desktop);
}
consumed = true;
break;

case DesktopMainEventOpenArchive:
#ifdef APP_ARCHIVE
desktop_switch_to_app(desktop, &FLIPPER_ARCHIVE);
Expand Down
1 change: 1 addition & 0 deletions applications/services/desktop/views/desktop_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ typedef enum {
DesktopMainEventOpenDebug,
DesktopMainEventOpenPassport,
DesktopMainEventOpenPowerOff,
DesktopMainEventPinLock,

DesktopMainEventOpenGameMenu,

Expand Down
2 changes: 2 additions & 0 deletions applications/services/desktop/views/desktop_view_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(DesktopMainEventPinLock, main_view->context);
}
}
} else {
Expand Down

0 comments on commit f76b3eb

Please sign in to comment.