Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to preloadAllAnimationData #664

Merged
merged 3 commits into from
May 8, 2017

Conversation

ShaharHD
Copy link
Contributor

@ShaharHD ShaharHD commented May 8, 2017

Rename all instances of preloadAllGIFData to preloadAllAnimationData with proper @available notices.

References #663

ShaharHD added 2 commits May 8, 2017 06:01
`pod install` resulted in automated project updates
All instances of `preloadAllGIFData` are now `preloadAllAnimationData` with proper @available notices
@ShaharHD
Copy link
Contributor Author

ShaharHD commented May 8, 2017

@onevcat Please note that the initial pod install changed all the files I've put in the 1st commit (didn't touch anything)
All my changes afterwards are in the 2nd commit.

Also, when trying to run the tests on Xcode I'm getting errors on Kingfisher/Kingfisher-TestImages/Modified/Overlay/onevcat-overlay-red-07-mac.jpg: No such file or directory Are some files missing from the git repo?
Found git clone https://github.com/onevcat/Kingfisher-TestImages.git Kingfisher-TestImages

All Tests on my machine completes with no errors.
Even the one travis-ci reported as failed:

Test Suite 'KingfisherTests-macOS.xctest' passed at 2017-05-08 07:17:35.353.
	 Executed 92 tests, with 0 failures (0 unexpected) in 7.738 (8.656) seconds

@onevcat
Copy link
Owner

onevcat commented May 8, 2017

Thanks!
It was a travis issue and I'll restart the tests.

@ShaharHD
Copy link
Contributor Author

ShaharHD commented May 8, 2017

Worked.
Two FYIs:

  1. Version 3.7.0 was never pushed to cocoapods
  2. I would appreciate if you can push 3.7.1 also with my fix after you approve it so I can base KingfisherWebP on the latest while I'm implementing the proper animation (right now I have it pointed to my branch for development)

Copy link
Owner

@onevcat onevcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Added several comments, please review them. We could merge it once things get done & CI passed.

Thanks!

public var preloadAllGIFData: Bool {
return contains { $0 <== .preloadAllGIFData }
return contains { $0 <== .preloadAllAnimationData }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could just return preloadAllAnimationData?

return image
}

@available(*, deprecated, message: "preloadAllGIFData is now preloadAllAnimationData")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is an internal API, we could just remove it instead of marking it as deprecated.

case preloadAllAnimationData

/// Back compatibility for deprecated preloadAllGIFData
@available(*, deprecated, renamed: "preloadAllAnimation")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move the deprecated statements to an extra extension at the end of this file (like what is done here)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference here it's a enum and not functions. But I'll fix the other ones as requested.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fine to have this static property in an extension (as long as the extension is public, it should also supply good back compatibility).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how you suggest having the enum value deprecated outside of the enum declaration (Swift AFAIK does not support adding to an enum through inheritance or any other extension mechanism)

Copy link
Owner

@onevcat onevcat May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you are using a static property to "simulate" the syntax of an enum case:

@available(*, deprecated, renamed: "preloadAllAnimation")
static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData

So it is possible to move it to extension (it is not an enum member anymore). Sure you could keep it as an enum member (in which case you cannot move it to an extension), but I think it is a clever way to make it a static property here.

In there, this should also compile:

public extension KingfisherOptionsInfoItem {
    @available(*, deprecated, renamed: "preloadAllAnimation")
    static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData
}

And users could get a rename warning if it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried the same, but with incorrect syntax is seems... Thanks 👍

@onevcat
Copy link
Owner

onevcat commented May 8, 2017

Version 3.7.0 was never pushed to cocoapods

Oops, didn't notice it. It should since the release script runs without issue. I guess it might be a CocoaPods issue.

I would appreciate if you can push 3.7.1 also with my fix after you approve it so I can base KingfisherWebP on the latest while I'm implementing the proper animation (right now I have it pointed to my branch for development)

Sure. I'll release 3.7.1 once it prepared.

@ShaharHD ShaharHD force-pushed the fix/preloadAllAnimationData branch from 48aa054 to 9dbbab3 Compare May 8, 2017 05:35
@available(*, deprecated, renamed: "preloadAllAnimation")
public var preloadAllGIFData: KingfisherOptionsInfoItem {
return .preloadAllAnimationData
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return a Bool with implementation like this:

@available(*, deprecated, renamed: "preloadAllAnimation")
public var preloadAllGIFData: Bool {
    return preloadAllAnimationData
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad a typo of copy & paste.
Fixed

@onevcat
Copy link
Owner

onevcat commented May 8, 2017

@ShaharHD

Great. I added another comment. Please fix that too before we could finally merge it.

@ShaharHD ShaharHD force-pushed the fix/preloadAllAnimationData branch from 9dbbab3 to 63c4bac Compare May 8, 2017 05:47
@onevcat onevcat merged commit 7e892b0 into onevcat:master May 8, 2017
@ShaharHD ShaharHD deleted the fix/preloadAllAnimationData branch May 8, 2017 05:55
petarlazarov pushed a commit to dowjones-mobile/Kingfisher that referenced this pull request Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants