mirror of
https://github.com/kean/Nuke.git
synced 2024-11-28 12:04:01 +03:00
Remove deprecated APIs
This commit is contained in:
parent
786bebcf76
commit
6168ab1624
@ -48,14 +48,6 @@ public final class DataCache: DataCaching, @unchecked Sendable {
|
||||
/// The time interval between cache sweeps. The default value is 1 hour.
|
||||
public var sweepInterval: TimeInterval = 3600
|
||||
|
||||
// Deprecated in Nuke 12.2
|
||||
@available(*, deprecated, message: "It's not recommended to use compression with the popular image formats that already compress the data")
|
||||
public var isCompressionEnabled: Bool {
|
||||
get { _isCompressionEnabled }
|
||||
set { _isCompressionEnabled = newValue }
|
||||
}
|
||||
var _isCompressionEnabled = false
|
||||
|
||||
// Staging
|
||||
|
||||
private let lock = NSLock()
|
||||
@ -143,7 +135,7 @@ public final class DataCache: DataCaching, @unchecked Sendable {
|
||||
guard let url = url(for: key) else {
|
||||
return nil
|
||||
}
|
||||
return try? decompressed(Data(contentsOf: url))
|
||||
return try? Data(contentsOf: url)
|
||||
}
|
||||
|
||||
/// Returns `true` if the cache contains the data for the given key.
|
||||
@ -322,33 +314,17 @@ public final class DataCache: DataCaching, @unchecked Sendable {
|
||||
switch change.type {
|
||||
case let .add(data):
|
||||
do {
|
||||
try compressed(data).write(to: url)
|
||||
try data.write(to: url)
|
||||
} catch let error as NSError {
|
||||
guard error.code == CocoaError.fileNoSuchFile.rawValue && error.domain == CocoaError.errorDomain else { return }
|
||||
try? FileManager.default.createDirectory(at: self.path, withIntermediateDirectories: true, attributes: nil)
|
||||
try? compressed(data).write(to: url) // re-create a directory and try again
|
||||
try? data.write(to: url) // re-create a directory and try again
|
||||
}
|
||||
case .remove:
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Compression
|
||||
|
||||
private func compressed(_ data: Data) throws -> Data {
|
||||
guard _isCompressionEnabled else {
|
||||
return data
|
||||
}
|
||||
return try (data as NSData).compressed(using: .lzfse) as Data
|
||||
}
|
||||
|
||||
private func decompressed(_ data: Data) throws -> Data {
|
||||
guard _isCompressionEnabled else {
|
||||
return data
|
||||
}
|
||||
return try (data as NSData).decompressed(using: .lzfse) as Data
|
||||
}
|
||||
|
||||
// MARK: Sweep
|
||||
|
||||
/// Synchronously performs a cache sweep and removes the least recently items
|
||||
|
@ -141,10 +141,6 @@ extension ImagePipeline {
|
||||
/// Data loading queue. Default maximum concurrent task count is 6.
|
||||
public var dataLoadingQueue = OperationQueue(maxConcurrentCount: 6)
|
||||
|
||||
// Deprecated in Nuke 12.6
|
||||
@available(*, deprecated, message: "The pipeline now performs cache lookup on the internal queue, reducing the amount of context switching")
|
||||
public var dataCachingQueue = OperationQueue(maxConcurrentCount: 2)
|
||||
|
||||
/// Image decoding queue. Default maximum concurrent task count is 1.
|
||||
public var imageDecodingQueue = OperationQueue(maxConcurrentCount: 1)
|
||||
|
||||
|
@ -19,10 +19,6 @@ extension ImageProcessors {
|
||||
private let crop: Bool
|
||||
private let upscale: Bool
|
||||
|
||||
// Deprecated in Nuke 12.0
|
||||
@available(*, deprecated, message: "Renamed to `ImageProcessingOptions.ContentMode")
|
||||
public typealias ContentMode = ImageProcessingOptions.ContentMode
|
||||
|
||||
/// Initializes the processor with the given size.
|
||||
///
|
||||
/// - parameters:
|
||||
|
Loading…
Reference in New Issue
Block a user