Selaa lähdekoodia

CollectionModel: Add removal from Playlist

(fixes #507)
Carola Nitz 6 vuotta sitten
vanhempi
commit
2f2cfae524
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 7 1
      SharedSources/MediaLibraryModel/CollectionModel.swift

+ 7 - 1
SharedSources/MediaLibraryModel/CollectionModel.swift

@@ -40,7 +40,13 @@ class CollectionModel: MLBaseModel {
     var indicatorName: String = "Collections"
 
     func delete(_ items: [VLCMLObject]) {
-       assertionFailure("still needs implementation")
+        if let playlist = mediaCollection as? VLCMLPlaylist {
+            for case let media as VLCMLMedia in items {
+                if let index = files.firstIndex(of: media) {
+                    playlist.removeMedia(fromPosition: UInt32(index))
+                }
+            }
+        }
     }
 }