mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
Add lock on boot setting
This commit is contained in:
@@ -10,6 +10,14 @@ void xtreme_app_scene_interface_lockscreen_var_item_list_callback(void* context,
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_lockscreen_lock_on_boot_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->lock_on_boot = value;
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_lockscreen_bad_pins_format_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
@@ -64,6 +72,15 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
|
||||
VariableItemList* var_item_list = app->var_item_list;
|
||||
VariableItem* item;
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Lock on Boot",
|
||||
2,
|
||||
xtreme_app_scene_interface_lockscreen_lock_on_boot_changed,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->lock_on_boot);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->lock_on_boot ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Format on 10 bad PINs",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <cli/cli.h>
|
||||
#include <cli/cli_vcp.h>
|
||||
#include <locale/locale.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
#include "animations/animation_manager.h"
|
||||
#include "desktop/scenes/desktop_scene.h"
|
||||
@@ -463,7 +464,7 @@ int32_t desktop_srv(void* p) {
|
||||
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
|
||||
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
|
||||
if(XTREME_SETTINGS()->lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
|
||||
desktop_lock(desktop, true);
|
||||
} else {
|
||||
if(!loader_is_locked(desktop->loader)) {
|
||||
|
||||
@@ -12,6 +12,7 @@ XtremeSettings xtreme_settings = {
|
||||
.unlock_anims = false, // OFF
|
||||
.fallback_anim = true, // ON
|
||||
.wii_menu = true, // ON
|
||||
.lock_on_boot = false, // OFF
|
||||
.bad_pins_format = false, // OFF
|
||||
.lockscreen_time = true, // ON
|
||||
.lockscreen_seconds = false, // OFF
|
||||
@@ -57,6 +58,8 @@ void XTREME_SETTINGS_LOAD() {
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lock_on_boot", &x->lock_on_boot, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
@@ -107,6 +110,7 @@ void XTREME_SETTINGS_SAVE() {
|
||||
flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||
flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1);
|
||||
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_write_bool(file, "lock_on_boot", &x->lock_on_boot, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||
|
||||
@@ -20,6 +20,7 @@ typedef struct {
|
||||
bool unlock_anims;
|
||||
bool fallback_anim;
|
||||
bool wii_menu;
|
||||
bool lock_on_boot;
|
||||
bool bad_pins_format;
|
||||
bool lockscreen_time;
|
||||
bool lockscreen_seconds;
|
||||
|
||||
Reference in New Issue
Block a user