Skip to content

Commit

Permalink
Expose protocol to get image data from the cache plus WebP cleanup
Browse files Browse the repository at this point in the history
## Summary

Recently we made several headers private in Cocoapods. However, some clients were reaching directly into PINRemoteImage's memory cache (PINCache) and pulling out `PINRemoteImageMemoryContainer` and doing whatever with it. To support that use case without exposing more than necessary publicly, introduce the `PINRemoteImageDataConvertible` protocol and have `PINRemoteImageMemoryContainer` conform to it.

So if previously the code was:

```
PINRemoteImageMemoryContainer *container = [[PINRemoteImageManager sharedImageManager].cache objectFromMemoryForKey:imageURL.absoluteString];
NSData *cachedImageDataForURL = [container data];
```
it can be
```
id<PINRemoteImageDataConvertible> container = [[PINRemoteImageManager sharedImageManager].cache objectFromMemoryForKey:imageURL.absoluteString];
NSData *cachedImageDataForURL = [container data];
```

Also, previous changes required `PIN_WEBP` to be defined in the project settings or it would fail to compile. That's been changed to always build. If _not_ specified it will default to `1`.

## Test plan

Run `make all` to run tests and build everything
  • Loading branch information
andyfinnell committed May 23, 2024
1 parent c6e0d06 commit 7d878be
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
Loading

0 comments on commit 7d878be

Please sign in to comment.