mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -62,6 +62,9 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
|||||||
return true;
|
return true;
|
||||||
case DesktopGlobalAutoLock:
|
case DesktopGlobalAutoLock:
|
||||||
if(!loader_is_locked(desktop->loader)) {
|
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);
|
desktop_lock(desktop);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <toolbox/saved_struct.h>
|
#include <toolbox/saved_struct.h>
|
||||||
#include <storage/storage.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_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
|
||||||
#define DESKTOP_SETTINGS_MAGIC (0x17)
|
#define DESKTOP_SETTINGS_MAGIC (0x17)
|
||||||
@@ -63,4 +63,5 @@ typedef struct {
|
|||||||
uint32_t auto_lock_delay_ms;
|
uint32_t auto_lock_delay_ms;
|
||||||
uint8_t displayBatteryPercentage;
|
uint8_t displayBatteryPercentage;
|
||||||
uint8_t dummy_mode;
|
uint8_t dummy_mode;
|
||||||
|
bool auto_lock_with_pin;
|
||||||
} DesktopSettings;
|
} 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];
|
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) {
|
void desktop_settings_scene_start_on_enter(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
VariableItemList* variable_item_list = app->variable_item_list;
|
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_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, auto_lock_delay_text[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(
|
item = variable_item_list_add(
|
||||||
variable_item_list,
|
variable_item_list,
|
||||||
"Battery View",
|
"Battery View",
|
||||||
|
|||||||
Reference in New Issue
Block a user