Massive overhaul | Part 1

This commit is contained in:
VerstreuteSeele
2022-12-30 05:12:53 +01:00
parent 4a150d3252
commit d279639e53
51 changed files with 100 additions and 3024 deletions

View File

@@ -11,7 +11,6 @@
#include "desktop_scene_i.h"
#include "desktop_scene.h"
#include "../helpers/pin_lock.h"
#include <power/power_service/power.h>
#define TAG "DesktopSceneLock"
@@ -69,33 +68,12 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
}
consumed = true;
break;
case DesktopLockMenuEventPinLockShutdown:
if(desktop->settings.pin_code.length > 0) {
desktop_pin_lock(&desktop->settings);
desktop_lock(desktop);
} else {
LoaderStatus status =
loader_start(desktop->loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG);
if(status == LoaderStatusOk) {
scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1);
} else {
FURI_LOG_E(TAG, "Unable to start desktop settings");
}
}
consumed = true;
Power* power = furi_record_open(RECORD_POWER);
furi_delay_ms(666);
power_off(power);
furi_record_close(RECORD_POWER);
break;
case DesktopLockMenuEventExit:
scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 0);
case DesktopLockMenuEventDummyModeOn:
case DesktopLockMenuEventSFWModeOn:
desktop_set_sfw_mode_state(desktop, true);
scene_manager_search_and_switch_to_previous_scene(
desktop->scene_manager, DesktopSceneMain);
break;
case DesktopLockMenuEventDummyModeOff:
case DesktopLockMenuEventSFWModeOff:
desktop_set_sfw_mode_state(desktop, false);
scene_manager_search_and_switch_to_previous_scene(
desktop->scene_manager, DesktopSceneMain);
@@ -111,4 +89,4 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
void desktop_scene_lock_menu_on_exit(void* context) {
UNUSED(context);
}
}

View File

@@ -43,8 +43,8 @@ typedef enum {
DesktopLockMenuEventPinLock,
DesktopLockMenuEventPinLockShutdown,
DesktopLockMenuEventExit,
DesktopLockMenuEventDummyModeOn,
DesktopLockMenuEventDummyModeOff,
DesktopLockMenuEventSFWModeOn,
DesktopLockMenuEventSFWModeOff,
DesktopAnimationEventCheckAnimation,
DesktopAnimationEventNewIdleAnimation,

View File

@@ -9,19 +9,11 @@
#define LOCK_MENU_ITEMS_NB 5
static void desktop_view_lock_menu_sfwmode_changed(bool isThisGameMode) {
DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp));
DESKTOP_SETTINGS_LOAD(&app->settings);
app->settings.is_sfwmode = isThisGameMode;
DESKTOP_SETTINGS_SAVE(&app->settings);
}
typedef enum {
DesktopLockMenuIndexLock,
DesktopLockMenuIndexPinLock,
DesktopLockMenuIndexPinLockShutdown,
// DesktopLockMenuIndexGameMode,
DesktopLockMenuIndexDummy,
DesktopLockMenuIndexSFW,
DesktopLockMenuIndexTotalCount
} DesktopLockMenuIndex;
@@ -83,9 +75,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
} else {
str = "Set PIN + Off";
}
// } else if(i == DesktopLockMenuIndexGameMode) {
// str = "Games Mode";
} else if(i == DesktopLockMenuIndexDummy) {
} else if(i == DesktopLockMenuIndexSFW) {
if(m->sfw_mode) {
str = "NSFW Mode";
} else {
@@ -155,12 +145,12 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
// desktop_view_lock_menu_sfwmode_changed(1);
// DOLPHIN_DEED(getRandomDeed());
// lock_menu->callback(DesktopLockMenuEventExit, lock_menu->context);
} else if(idx == DesktopLockMenuIndexDummy) {
} else if(idx == DesktopLockMenuIndexSFW) {
// DOLPHIN_DEED(getRandomDeed());
if((sfw_mode == false) && (event->type == InputTypeShort)) {
lock_menu->callback(DesktopLockMenuEventDummyModeOn, lock_menu->context);
lock_menu->callback(DesktopLockMenuEventSFWModeOn, lock_menu->context);
} else if((sfw_mode == true) && (event->type == InputTypeShort)) {
lock_menu->callback(DesktopLockMenuEventDummyModeOff, lock_menu->context);
lock_menu->callback(DesktopLockMenuEventSFWModeOff, lock_menu->context);
}
}
consumed = true;