Commit 42392120 authored by Soomin Lee's avatar Soomin Lee

VLCEditController: Handle empty rename

parent 41dc0bb0
......@@ -156,14 +156,21 @@ extension VLCEditController: VLCEditToolbarDelegate {
}
func rename() {
// FIXME: Multiple renaming of files(multiple alert can get unfriendly if too many files)
for indexPath in selectedCellIndexPaths {
if let media = category.anyfiles[indexPath.row] as? VLCMLMedia {
// Not using VLCAlertViewController to have more customization in text fields
let alertInfo = TextFieldAlertInfo(alertTitle: String(format: NSLocalizedString("RENAME_MEDIA_TO", comment: ""), media.title),
placeHolder: "NEW_NAME")
placeHolder: "NEW_NAME",
confirmActionTitle: NSLocalizedString("BUTTON_RENAME", comment: ""))
presentTextFieldAlert(with: alertInfo, completionHandler: {
[weak self] text -> Void in
guard text != "" else {
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_RENAME_FAILED", comment: ""),
errorMessage: NSLocalizedString("ERROR_EMPTY_NAME", comment: ""),
viewController: (UIApplication.shared.keyWindow?.rootViewController)!)
return
}
media.updateTitle(text)
self?.resetCell(at: indexPath)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment