Browse Source

EditController: Adapt deletion message for playlist

Closes #647
Soomin Lee 5 years ago
parent
commit
7f7d08fd7f
2 changed files with 13 additions and 3 deletions
  1. 3 2
      Resources/en.lproj/Localizable.strings
  2. 10 1
      Sources/EditController.swift

+ 3 - 2
Resources/en.lproj/Localizable.strings

@@ -285,8 +285,9 @@
 // Insert %@ where play-pause-glyph should be placed
 "DELETE_ITEM_HINT" = "Press %@ to Delete"; /* Insert %@ where play-pause-glyph should be placed */
 
-"DELETE_MESSAGE" = "Confirm the deletion of the selected files";
-"DELETE_TITLE" = "Delete Selected Files";
+"DELETE_MESSAGE" = "Confirm the deletion of the selection";
+"DELETE_MESSAGE_PLAYLIST" = "Confirm the deletion of the selection from the playlist\nMedia items are not deleted";
+"DELETE_TITLE" = "Delete Selection";
 
 //Drag and Drop
 "THIS_FILE" = "This file";

+ 10 - 1
Sources/EditController.swift

@@ -173,6 +173,15 @@ extension EditController: EditToolbarDelegate {
             objectsToDelete.append(model.anyfiles[indexPath.row])
         }
 
+        var message = NSLocalizedString("DELETE_MESSAGE", comment: "")
+
+        // Check if we are deleting media inside a playlist
+        if let collectionModel = model as? CollectionModel {
+            if collectionModel.mediaCollection is VLCMLPlaylist {
+                message = NSLocalizedString("DELETE_MESSAGE_PLAYLIST", comment: "")
+            }
+        }
+
         let cancelButton = VLCAlertButton(title: NSLocalizedString("BUTTON_CANCEL", comment: ""))
         let deleteButton = VLCAlertButton(title: NSLocalizedString("BUTTON_DELETE", comment: ""),
                                           style: .destructive,
@@ -183,7 +192,7 @@ extension EditController: EditToolbarDelegate {
         })
 
         VLCAlertViewController.alertViewManager(title: NSLocalizedString("DELETE_TITLE", comment: ""),
-                                                errorMessage: NSLocalizedString("DELETE_MESSAGE", comment: ""),
+                                                errorMessage: message,
                                                 viewController: (UIApplication.shared.keyWindow?.rootViewController)!,
                                                 buttonsAction: [cancelButton,
                                                                 deleteButton])