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

Update nfc_playlist_scene_nfc_move_item.c

- Fixes move logic so it now acts how it should
acegoal07 1 год назад
Родитель
Сommit
be4153b7ba
1 измененных файлов с 12 добавлено и 7 удалено
  1. 12 7
      scenes/nfc_playlist_scene_nfc_move_item.c

+ 12 - 7
scenes/nfc_playlist_scene_nfc_move_item.c

@@ -109,21 +109,26 @@ bool nfc_playlist_nfc_move_item_scene_on_event(void* context, SceneManagerEvent
 
                while(stream_read_line(stream, line)) {
                   counter++;
+
                   if(counter == selected_target) {
                      continue;
                   }
-                  furi_string_trim(line);
+
                   if(!furi_string_empty(tmp_new_order_str)) {
                      furi_string_cat_printf(tmp_new_order_str, "%s", "\n");
                   }
-                  if(counter == selected_destination && counter == nfc_playlist->settings.playlist_length) {
-                     furi_string_cat_printf(tmp_new_order_str, "%s\n%s", furi_string_get_cstr(line), furi_string_get_cstr(tmp_target_str));
-                     furi_string_free(tmp_target_str);
-                  } else {
-                     if(counter == selected_destination) {
-                        furi_string_cat_printf(tmp_new_order_str, "%s\n", furi_string_get_cstr(tmp_target_str));
+                  
+                  furi_string_trim(line);
+
+                  if(counter == selected_destination) {
+                     if(counter == 1) {
+                        furi_string_cat_printf(tmp_new_order_str, "%s\n%s", furi_string_get_cstr(tmp_target_str), furi_string_get_cstr(line));
+                        furi_string_reset(tmp_target_str);
+                     } else {
+                        furi_string_cat_printf(tmp_new_order_str, "%s\n%s", furi_string_get_cstr(line), furi_string_get_cstr(tmp_target_str));
                         furi_string_reset(tmp_target_str);
                      }
+                  } else {
                      furi_string_cat_printf(tmp_new_order_str, "%s", furi_string_get_cstr(line));
                   }
                }