Add force parameter to resource cleanup

This commit is contained in:
Ali
2021-04-16 22:54:27 +04:00
parent 275927c785
commit 16c095d490
4 changed files with 14 additions and 12 deletions

View File

@@ -1110,15 +1110,17 @@ public final class MediaBox {
}
}
public func removeCachedResources(_ ids: Set<WrappedMediaResourceId>) -> Signal<Void, NoError> {
public func removeCachedResources(_ ids: Set<WrappedMediaResourceId>, force: Bool = false) -> Signal<Void, NoError> {
return Signal { subscriber in
self.dataQueue.async {
for id in ids {
if self.fileContexts[id] != nil {
continue
}
if self.keepResourceContexts[id] != nil {
continue
if !force {
if self.fileContexts[id] != nil {
continue
}
if self.keepResourceContexts[id] != nil {
continue
}
}
let paths = self.storePathsForId(id.id)
unlink(paths.complete)