From f780b832ada618579f39270b26f1c123261f1b87 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:57:31 +0200 Subject: [PATCH] Ddesktop service and events cleanup --- .../services/desktop/animations/animation_storage.c | 12 +++--------- .../desktop/animations/views/bubble_animation_view.c | 7 +------ .../animations/views/one_shot_animation_view.c | 7 +------ .../desktop/scenes/desktop_scene_lock_menu.c | 1 - .../services/desktop/scenes/desktop_scene_main.c | 4 ---- applications/services/desktop/views/desktop_events.h | 11 ----------- .../services/desktop/views/desktop_view_main.c | 8 ++++++++ 7 files changed, 13 insertions(+), 37 deletions(-) diff --git a/applications/services/desktop/animations/animation_storage.c b/applications/services/desktop/animations/animation_storage.c index a173de2a3..52927225a 100644 --- a/applications/services/desktop/animations/animation_storage.c +++ b/applications/services/desktop/animations/animation_storage.c @@ -15,15 +15,8 @@ #define ANIMATION_META_FILE "meta.txt" #define BASE_ANIMATION_DIR EXT_PATH("dolphin") #define TAG "AnimationStorage" -/* Unused old code, for safe-keeping - -#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt" - -*/ -// 59 Max length = strlen("/ext/dolphin_custom//Anims") + XTREME_ASSETS_PACK_NAME_LEN + 1 (Null terminator) -char ANIMATION_DIR[59]; -// 72 Max length = ANIMATION_DIR + strlen("/manifest.txt") -char ANIMATION_MANIFEST_FILE[72]; +char ANIMATION_DIR[26 /*"/ext/dolphin_custom//Anims"*/ + XTREME_ASSETS_PACK_NAME_LEN + 1]; +char ANIMATION_MANIFEST_FILE[sizeof(ANIMATION_DIR) + 13 /*"/manifest.txt"*/]; static void animation_storage_free_bubbles(BubbleAnimation* animation); static void animation_storage_free_frames(BubbleAnimation* animation); @@ -43,6 +36,7 @@ void animation_handler_select_manifest() { if(storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) { FURI_LOG_I(TAG, "Custom manifest selected"); } else { + FURI_LOG_E(TAG, "Custom manifest does not exist!"); use_asset_pack = false; } furi_record_close(RECORD_STORAGE); diff --git a/applications/services/desktop/animations/views/bubble_animation_view.c b/applications/services/desktop/animations/views/bubble_animation_view.c index 8fcfba0e3..199f7cd71 100644 --- a/applications/services/desktop/animations/views/bubble_animation_view.c +++ b/applications/services/desktop/animations/views/bubble_animation_view.c @@ -12,7 +12,6 @@ #include #include #include -#include #define ACTIVE_SHIFT 2 @@ -129,15 +128,11 @@ static bool bubble_animation_input_callback(InputEvent* event, void* context) { if(event->key == InputKeyRight) { /* Right button reserved for animation activation, so consume */ - consumed = true; if(event->type == InputTypeShort) { if(animation_view->interact_callback) { + consumed = true; animation_view->interact_callback(animation_view->interact_callback_context); } - } else if(event->type == InputTypeLong) { - Loader* loader = furi_record_open(RECORD_LOADER); - loader_start(loader, "Power", "about_battery", NULL); - furi_record_close(RECORD_LOADER); } } diff --git a/applications/services/desktop/animations/views/one_shot_animation_view.c b/applications/services/desktop/animations/views/one_shot_animation_view.c index 52b183566..e76856288 100644 --- a/applications/services/desktop/animations/views/one_shot_animation_view.c +++ b/applications/services/desktop/animations/views/one_shot_animation_view.c @@ -6,7 +6,6 @@ #include #include #include -#include typedef void (*OneShotInteractCallback)(void*); @@ -66,15 +65,11 @@ static bool one_shot_view_input(InputEvent* event, void* context) { if(!consumed) { if(event->key == InputKeyRight) { /* Right button reserved for animation activation, so consume */ - consumed = true; if(event->type == InputTypeShort) { if(view->interact_callback) { + consumed = true; view->interact_callback(view->interact_callback_context); } - } else if(event->type == InputTypeLong) { - Loader* loader = furi_record_open(RECORD_LOADER); - loader_start(loader, "Power", "about_battery", NULL); - furi_record_close(RECORD_LOADER); } } } diff --git a/applications/services/desktop/scenes/desktop_scene_lock_menu.c b/applications/services/desktop/scenes/desktop_scene_lock_menu.c index 66d732781..480bef951 100644 --- a/applications/services/desktop/scenes/desktop_scene_lock_menu.c +++ b/applications/services/desktop/scenes/desktop_scene_lock_menu.c @@ -4,7 +4,6 @@ #include #include #include -// #include #include #include "../desktop_i.h" diff --git a/applications/services/desktop/scenes/desktop_scene_main.c b/applications/services/desktop/scenes/desktop_scene_main.c index f4e8fd309..1d425d73a 100644 --- a/applications/services/desktop/scenes/desktop_scene_main.c +++ b/applications/services/desktop/scenes/desktop_scene_main.c @@ -154,10 +154,6 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) { } consumed = true; break; - case DesktopMainEventOpenPassport: { - loader_start(desktop->loader, "Passport", NULL, NULL); - break; - } case DesktopMainEventOpenClock: { loader_start_with_gui_error( desktop->loader, EXT_PATH("apps/Misc/Nightstand.fap"), NULL); diff --git a/applications/services/desktop/views/desktop_events.h b/applications/services/desktop/views/desktop_events.h index 11b45a8c7..c0da403da 100644 --- a/applications/services/desktop/views/desktop_events.h +++ b/applications/services/desktop/views/desktop_events.h @@ -6,21 +6,10 @@ typedef enum { DesktopMainEventOpenFavoritePrimary, DesktopMainEventOpenFavoriteSecondary, DesktopMainEventOpenMenu, - DesktopMainEventOpenGames, DesktopMainEventOpenDebug, - DesktopMainEventOpenPassport, DesktopMainEventOpenPowerOff, DesktopMainEventLock, - DesktopMainEventOpenSnake, - DesktopMainEventOpen2048, - DesktopMainEventOpenZombiez, - DesktopMainEventOpenTetris, - DesktopMainEventOpenDOOM, - DesktopMainEventOpenDice, - DesktopMainEventOpenArkanoid, - DesktopMainEventOpenHeap, - DesktopMainEventOpenSubRemote, DesktopMainEventOpenClock, DesktopLockedEventOpenPowerOff, diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index e7e4ab4fd..bd2625f97 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -43,6 +43,10 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { main_view->callback(DesktopMainEventOpenLockMenu, main_view->context); } else if(event->key == InputKeyDown) { main_view->callback(DesktopMainEventOpenArchive, main_view->context); + } else if(event->key == InputKeyRight) { + Loader* loader = furi_record_open(RECORD_LOADER); + loader_start(loader, "Passport", NULL, NULL); + furi_record_close(RECORD_LOADER); } else if(event->key == InputKeyLeft) { main_view->callback(DesktopMainEventOpenClock, main_view->context); } @@ -54,6 +58,10 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { main_view->callback(DesktopMainEventOpenFavoritePrimary, main_view->context); } else if(event->key == InputKeyDown) { main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context); + } else if(event->key == InputKeyRight) { + Loader* loader = furi_record_open(RECORD_LOADER); + loader_start(loader, "Power", "about_battery", NULL); + furi_record_close(RECORD_LOADER); } else if(event->key == InputKeyLeft) { main_view->callback(DesktopMainEventLock, main_view->context); }