No need to search cache here

This commit is contained in:
Ali
2023-02-13 21:26:12 +04:00
parent 81486eb1cc
commit 08f49fdaad

View File

@@ -1704,10 +1704,10 @@ public final class MediaBox {
public func removeCachedResources(_ ids: [MediaResourceId], force: Bool = false, notify: Bool = false) -> Signal<Float, NoError> {
return Signal { subscriber in
self.dataQueue.async {
let uniqueIds = Set(ids.map { $0.stringRepresentation })
var pathsToDelete: [String] = []
//let uniqueIds = Set(ids.map { $0.stringRepresentation })
let pathsToDelete: [String] = []
for cacheType in ["cache", "short-cache"] {
/*for cacheType in ["cache", "short-cache"] {
if let enumerator = FileManager.default.enumerator(at: URL(fileURLWithPath: "\(self.basePath)/\(cacheType)"), includingPropertiesForKeys: [], options: [.skipsSubdirectoryDescendants], errorHandler: nil) {
while let item = enumerator.nextObject() {
guard let url = item as? NSURL, let path = url.path, let fileName = url.lastPathComponent else {
@@ -1722,7 +1722,7 @@ public final class MediaBox {
}
}
}
}
}*/
var count: Int = 0
let totalCount = ids.count * 3 + pathsToDelete.count