fix issue with None app used in favourites

User desktop settings will be reset to defaults
This commit is contained in:
MX 2023-06-29 05:51:14 +03:00
parent 380734f804
commit 259979a76a
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
3 changed files with 8 additions and 3 deletions

View file

@ -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 (10) #define DESKTOP_SETTINGS_VER (11)
#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)

View file

@ -70,7 +70,7 @@ static void desktop_scene_main_open_app_or_profile(Desktop* desktop, const char*
} }
static void desktop_scene_main_start_favorite(Desktop* desktop, FavoriteApp* application) { static void desktop_scene_main_start_favorite(Desktop* desktop, FavoriteApp* application) {
if(strlen(application->name_or_path) > 0) { if(strlen(application->name_or_path) > 4) {
loader_start_with_gui_error(desktop->loader, application->name_or_path, NULL); loader_start_with_gui_error(desktop->loader, application->name_or_path, NULL);
} else { } else {
// No favourite app is set! So we skipping this part // No favourite app is set! So we skipping this part

View file

@ -6,6 +6,7 @@
#define EXTERNAL_APPLICATION_NAME ("[External Application]") #define EXTERNAL_APPLICATION_NAME ("[External Application]")
#define EXTERNAL_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 1) #define EXTERNAL_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 1)
#define NONE_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 2)
static bool favorite_fap_selector_item_callback( static bool favorite_fap_selector_item_callback(
FuriString* file_path, FuriString* file_path,
@ -89,7 +90,7 @@ void desktop_settings_scene_favorite_on_enter(void* context) {
submenu_add_item( submenu_add_item(
submenu, submenu,
"None (disable)", "None (disable)",
FLIPPER_APPS_COUNT + 2, NONE_APPLICATION_INDEX,
desktop_settings_scene_favorite_submenu_callback, desktop_settings_scene_favorite_submenu_callback,
app); app);
@ -154,6 +155,10 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e
MAX_APP_LENGTH); MAX_APP_LENGTH);
consumed = true; consumed = true;
} }
} else if(event.event == NONE_APPLICATION_INDEX) {
curr_favorite_app->is_external = false;
strncpy(curr_favorite_app->name_or_path, "no", MAX_APP_LENGTH);
consumed = true;
} else { } else {
curr_favorite_app->is_external = false; curr_favorite_app->is_external = false;
strncpy( strncpy(