Open Emperor-Koala opened 5 years ago
The strange thing here is that I got this to work in the simulator, but it still doesn't work on my actual device.
To fix the delete to propagate down to the subdirectory files you need to add the line
fileListViewController.allowEditing = self.allowEditing
at line 48 in FileListTableView.swift
This will allow it to propagate into the subdirectory.
Here is the full function in that file with the added line
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedFile = fileForIndexPath(indexPath)
searchController.isActive = false
if selectedFile.isDirectory {
let fileListViewController = FileListViewController(initialPath: selectedFile.filePath)
fileListViewController.didSelectFile = didSelectFile
// Here is the fix ----
fileListViewController.allowEditing = self.allowEditing
self.navigationController?.pushViewController(fileListViewController, animated: true)
}
else {
if let didSelectFile = didSelectFile {
self.dismiss()
didSelectFile(selectedFile)
}
else {
let filePreview = previewManager.previewViewControllerForFile(selectedFile, fromNavigation: true)
self.navigationController?.pushViewController(filePreview, animated: true)
}
}
tableView.deselectRow(at: indexPath, animated: true)
}
When I import this project, I can use it and everything works (mostly) as expected. My only issue is that I can't delete anything if its in a subdirectory to the initial directory. Is this a bug, or is there some sort of easy fix?
I've been scratching my head for about an hour, and I tried adding
fileListViewController.allowEditing = allowEditing
to the functiontableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
, but it doesn't appear to work the way I was hoping.