mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-19 11:21:39 +03:00
Merge pull request #338 from Willy-JL/autolock-with-pin
Autolock with pin code
This commit is contained in:
commit
faac423772
@ -62,6 +62,9 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
||||
return true;
|
||||
case DesktopGlobalAutoLock:
|
||||
if(!loader_is_locked(desktop->loader)) {
|
||||
if(desktop->settings.auto_lock_with_pin && desktop->settings.pin_code.length > 0) {
|
||||
desktop_pin_lock(&desktop->settings);
|
||||
}
|
||||
desktop_lock(desktop);
|
||||
}
|
||||
return true;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <toolbox/saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define DESKTOP_SETTINGS_VER (6)
|
||||
#define DESKTOP_SETTINGS_VER (7)
|
||||
|
||||
#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
|
||||
#define DESKTOP_SETTINGS_MAGIC (0x17)
|
||||
@ -63,4 +63,5 @@ typedef struct {
|
||||
uint32_t auto_lock_delay_ms;
|
||||
uint8_t displayBatteryPercentage;
|
||||
uint8_t dummy_mode;
|
||||
bool auto_lock_with_pin;
|
||||
} DesktopSettings;
|
||||
|
@ -60,6 +60,14 @@ static void desktop_settings_scene_start_auto_lock_delay_changed(VariableItem* i
|
||||
app->settings.auto_lock_delay_ms = auto_lock_delay_value[index];
|
||||
}
|
||||
|
||||
static void desktop_settings_scene_start_auto_lock_pin_changed(VariableItem* item) {
|
||||
DesktopSettingsApp* app = variable_item_get_context(item);
|
||||
uint8_t value = variable_item_get_current_value_index(item);
|
||||
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
app->settings.auto_lock_with_pin = value;
|
||||
}
|
||||
|
||||
void desktop_settings_scene_start_on_enter(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
VariableItemList* variable_item_list = app->variable_item_list;
|
||||
@ -87,6 +95,16 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, auto_lock_delay_text[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
variable_item_list,
|
||||
"Auto Lock Pin",
|
||||
2,
|
||||
desktop_settings_scene_start_auto_lock_pin_changed,
|
||||
app);
|
||||
|
||||
variable_item_set_current_value_index(item, app->settings.auto_lock_with_pin);
|
||||
variable_item_set_current_value_text(item, app->settings.auto_lock_with_pin ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
variable_item_list,
|
||||
"Battery View",
|
||||
|
Loading…
Reference in New Issue
Block a user