Просмотр исходного кода

Move feed posts to a feed folder

jblanked 1 год назад
Родитель
Сommit
d54a441339
2 измененных файлов с 7 добавлено и 2 удалено
  1. 1 1
      feed/flip_social_feed.c
  2. 6 1
      flip_storage/flip_social_storage.c

+ 1 - 1
feed/flip_social_feed.c

@@ -135,7 +135,7 @@ FlipSocialFeedMini *flip_social_parse_json_feed()
 bool flip_social_load_feed_post(int post_id)
 bool flip_social_load_feed_post(int post_id)
 {
 {
     char file_path[128];
     char file_path[128];
-    snprintf(file_path, sizeof(file_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_social/feed_post_%d.json", post_id);
+    snprintf(file_path, sizeof(file_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_social/feed/feed_post_%d.json", post_id);
 
 
     // load the received data from the saved file
     // load the received data from the saved file
     FuriString *feed_data = flipper_http_load_from_file(file_path);
     FuriString *feed_data = flipper_http_load_from_file(file_path);

+ 6 - 1
flip_storage/flip_social_storage.c

@@ -382,8 +382,13 @@ bool flip_social_save_post(char *post_id, char *json_feed_data)
     Storage *storage = furi_record_open(RECORD_STORAGE);
     Storage *storage = furi_record_open(RECORD_STORAGE);
     File *file = storage_file_alloc(storage);
     File *file = storage_file_alloc(storage);
 
 
+    // Create the directory for saving the feed
+    char directory_path[128];
+    snprintf(directory_path, sizeof(directory_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_social/feed");
+    storage_common_mkdir(storage, directory_path);
+
     char file_path[128];
     char file_path[128];
-    snprintf(file_path, sizeof(file_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_social/feed_post_%s.json", post_id);
+    snprintf(file_path, sizeof(file_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_social/feed/feed_post_%s.json", post_id);
 
 
     if (!storage_file_open(file, file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS))
     if (!storage_file_open(file, file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS))
     {
     {