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;

View File

@@ -81,7 +81,7 @@ uint64_t dolphin_state_timestamp() {
return furi_hal_rtc_datetime_to_timestamp(&datetime);
}
bool dolphin_state_is_levelup(uint32_t icounter) {
bool dolphin_state_is_levelup(int icounter) {
for (int i = 0; i<30; ++i) {
if ((icounter == level_array[i])) {
return true;
@@ -90,7 +90,7 @@ bool dolphin_state_is_levelup(uint32_t icounter) {
return false;
}
uint8_t dolphin_get_level(uint32_t icounter) {
uint8_t dolphin_get_level(int icounter) {
for (int i = 0; i < 29; ++i) {
if (icounter <= level_array[i]) {
return i + 1;
@@ -99,7 +99,7 @@ for (int i = 0; i < 29; ++i) {
return 30;
}
uint32_t dolphin_state_xp_above_last_levelup(uint32_t icounter) {
uint32_t dolphin_state_xp_above_last_levelup(int icounter) {
if(level_array[0] > icounter) {
for(int i = 1; i < 29; ++i) {
if(icounter <= level_array[i]) {
@@ -110,7 +110,7 @@ uint32_t dolphin_state_xp_above_last_levelup(uint32_t icounter) {
return icounter;
}
uint32_t dolphin_state_xp_to_levelup(uint32_t icounter) {
uint32_t dolphin_state_xp_to_levelup(int icounter) {
for(int i = 0; i < 29; ++i) {
if(icounter <= level_array[i]) {
return level_array[i] - icounter;

View File

@@ -37,12 +37,12 @@ void dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed);
void dolphin_state_butthurted(DolphinState* dolphin_state);
uint32_t dolphin_state_xp_to_levelup(uint32_t icounter);
uint32_t dolphin_state_xp_to_levelup(int icounter);
uint32_t dolphin_state_xp_above_last_levelup(uint32_t icounter);
uint32_t dolphin_state_xp_above_last_levelup(int icounter);
bool dolphin_state_is_levelup(uint32_t icounter);
bool dolphin_state_is_levelup(int icounter);
void dolphin_state_increase_level(DolphinState* dolphin_state);
uint8_t dolphin_get_level(uint32_t icounter);
uint8_t dolphin_get_level(int icounter);

View File

@@ -386,7 +386,6 @@ BrowserWorker* file_browser_worker_alloc(
browser->filter_extension = furi_string_alloc_set(filter_ext);
browser->skip_assets = skip_assets;
browser->hide_dot_files = hide_dot_files;
browser->path_start = furi_string_alloc_set(path);
browser->path_current = furi_string_alloc_set(path);
browser->path_next = furi_string_alloc_set(path);
@@ -494,4 +493,4 @@ void file_browser_worker_load(BrowserWorker* browser, uint32_t offset, uint32_t
browser->load_offset = offset;
browser->load_count = count;
furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtLoad);
}
}

View File

@@ -67,4 +67,4 @@ void file_browser_worker_load(BrowserWorker* browser, uint32_t offset, uint32_t
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -455,7 +455,7 @@ static void
} while(false);
furi_string_free(remote_path);
infrared_brute_force_reset(brute_force);
//infrared_brute_force_reset(brute_force);
infrared_brute_force_free(brute_force);
}

View File

@@ -48,18 +48,13 @@ static void loader_menu_callback(void* _ctx, uint32_t index) {
furi_assert(application->app);
furi_assert(application->name);
furi_assert(application->link);
if(strcmp(application->link, "NULL") != 0) {
LoaderStatus status = loader_start(NULL, "Applications", application->link);
} else {
if(!loader_lock(loader_instance)) {
FURI_LOG_E(TAG, "Loader is locked");
return;
}
loader_start_application(application, NULL);
if(!loader_lock(loader_instance)) {
FURI_LOG_E(TAG, "Loader is locked");
return;
}
loader_start_application(application, NULL);
}
static void loader_submenu_callback(void* context, uint32_t index) {