mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 16:23:32 +01:00
Clears image cache with “Clear Cache…” option in Settings
Also increases image cache size to 512MB.
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
import Foundation
|
||||
import AltStoreCore
|
||||
/*
|
||||
|
||||
import Nuke
|
||||
|
||||
struct BatchError: ALTLocalizedError
|
||||
{
|
||||
|
||||
@@ -54,6 +57,8 @@ class ClearAppCacheOperation: ResultOperation<Void>
|
||||
{
|
||||
super.main()
|
||||
|
||||
self.clearNukeCache()
|
||||
|
||||
var allErrors = [Error]()
|
||||
|
||||
self.clearTemporaryDirectory { result in
|
||||
@@ -89,6 +94,12 @@ class ClearAppCacheOperation: ResultOperation<Void>
|
||||
|
||||
private extension ClearAppCacheOperation
|
||||
{
|
||||
func clearNukeCache()
|
||||
{
|
||||
guard let dataCache = ImagePipeline.shared.configuration.dataCache as? DataCache else { return }
|
||||
dataCache.removeAll()
|
||||
}
|
||||
|
||||
func clearTemporaryDirectory(completion: @escaping (Result<Void, Error>) -> Void)
|
||||
{
|
||||
let intent = NSFileAccessIntent.writingIntent(with: FileManager.default.temporaryDirectory, options: [.forDeleting])
|
||||
|
||||
Reference in New Issue
Block a user