فهرست منبع

PlaylistModel: Handle deletion

Soomin Lee 7 سال پیش
والد
کامیت
918e3dd6f6
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 8 0
      SharedSources/MediaLibraryModel/PlaylistModel.swift

+ 8 - 0
SharedSources/MediaLibraryModel/PlaylistModel.swift

@@ -35,6 +35,14 @@ class PlaylistModel: MLBaseModel {
         files.append(item)
         files.append(item)
     }
     }
 
 
+    func delete(_ items: [VLCMLObject]) {
+        for playlist in items where playlist is VLCMLPlaylist {
+            if !(medialibrary.deletePlaylist(with: playlist.identifier())) {
+                assertionFailure("PlaylistModel: Failed to delete playlist: \(playlist.identifier())")
+            }
+        }
+    }
+
     // Creates a VLCMLPlaylist appending it and updates linked view
     // Creates a VLCMLPlaylist appending it and updates linked view
     func create(name: String) {
     func create(name: String) {
         append(medialibrary.createPlaylist(with: name))
         append(medialibrary.createPlaylist(with: name))