Browse Source

Fix PR review comments

Shahar Hadas 8 years ago
parent
commit
b9f9652ed5

+ 13 - 4
Sources/AnimatedImageView.swift

@@ -149,12 +149,12 @@ open class AnimatedImageView: UIImageView {
         super.didMoveToSuperview()
         didMove()
     }
-    
-    // This is for back compatibility that using regular UIImageView to show GIF.
-    override func shouldPreloadAllGIF() -> Bool {
+
+    // This is for back compatibility that using regular UIImageView to show animated image.
+    override func shouldPreloadAllAnimation() -> Bool {
         return false
     }
-    
+
     // MARK: - Private method
     /// Reset the animator.
     private func reset() {
@@ -353,3 +353,12 @@ extension Array {
 private func pure<T>(_ value: T) -> [T] {
     return [value]
 }
+
+// MARK: - Deprecated. Only for back compatibility.
+extension AnimatedImageView {
+    // This is for back compatibility that using regular UIImageView to show GIF.
+    @available(*, deprecated, renamed: "shouldPreloadAllAnimation")
+    override func shouldPreloadAllGIF() -> Bool {
+        return false
+    }
+}

+ 0 - 5
Sources/Image.swift

@@ -332,11 +332,6 @@ extension Kingfisher where Base: Image {
 
         return image
     }
-
-    @available(*, deprecated, message: "preloadAllGIFData is now preloadAllAnimationData")
-    static func image(data: Data, scale: CGFloat, preloadAllGIFData: Bool, onlyFirstFrame: Bool) -> Image? {
-        return image(data: data, scale: scale, preloadAllAnimationData: preloadAllGIFData, onlyFirstFrame: onlyFirstFrame)
-    }
 }
 
 // MARK: - Image Transforming

+ 0 - 2
Sources/ImageView+Kingfisher.swift

@@ -288,9 +288,7 @@ extension ImageView {
     fileprivate func kf_setImageTask(_ task: RetrieveImageTask?) { kf.setImageTask(task) }
     @available(*, deprecated, message: "Extensions directly on image views are deprecated.", renamed: "kf.setWebURL")
     fileprivate func kf_setWebURL(_ url: URL) { kf.setWebURL(url) }
-}
 
-extension ImageView {
     func shouldPreloadAllAnimation() -> Bool { return true }
 
     @available(*, deprecated, renamed: "shouldPreloadAllAnimation")

+ 15 - 10
Sources/KingfisherOptionsInfo.swift

@@ -91,10 +91,6 @@ public enum KingfisherOptionsInfoItem {
     /// all data, while a normal image view (`UIImageView` or `NSImageView`) will load all data. Choose to use
     /// corresponding image view type instead of setting this option.
     case preloadAllAnimationData
-
-    /// Back compatibility for deprecated preloadAllGIFData
-    @available(*, deprecated, renamed: "preloadAllAnimation")
-    static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData
     
     /// The `ImageDownloadRequestModifier` contained will be used to change the request before it being sent.
     /// This is the last chance you can modify the request. You can modify the request for some customizing purpose,
@@ -237,12 +233,6 @@ public extension Collection where Iterator.Element == KingfisherOptionsInfoItem
     public var preloadAllAnimationData: Bool {
         return contains { $0 <== .preloadAllAnimationData }
     }
-
-    /// Whether the image data should be all loaded at once if it is a GIF.
-    @available(*, deprecated, renamed: "preloadAllAnimation")
-    public var preloadAllGIFData: Bool {
-        return contains { $0 <== .preloadAllAnimationData }
-    }
     
     /// The queue of callbacks should happen from Kingfisher.
     public var callbackDispatchQueue: DispatchQueue {
@@ -304,3 +294,18 @@ public extension Collection where Iterator.Element == KingfisherOptionsInfoItem
         return contains { $0 <== .onlyLoadFirstFrame }
     }
 }
+
+// MARK: - Deprecated. Only for back compatibility.
+public extension Collection where Iterator.Element == KingfisherOptionsInfoItem {
+
+    /// Whether the image data should be all loaded at once if it is a GIF.
+    @available(*, deprecated, renamed: "preloadAllAnimationData")
+    public var preloadAllGIFData: Bool {
+        return preloadAllAnimationData
+    }
+}
+
+public extension KingfisherOptionsInfoItem {
+    @available(*, deprecated, renamed: "preloadAllAnimationData")
+    static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData
+}

+ 1 - 1
Tests/KingfisherTests/ImageExtensionTests.swift

@@ -96,7 +96,7 @@ class ImageExtensionTests: XCTestCase {
 #endif
     }
     
-    func testPreloadAllGIFData() {
+    func testPreloadAllAnimationData() {
         let image = Kingfisher<Image>.animated(with: testImageSingleFrameGIFData, preloadAll: true)!
         XCTAssertNotNil(image, "The image should be initiated.")
 #if os(iOS) || os(tvOS)