Skip to content

Commit

Permalink
switch to FLAnimatedImage, from PINRemoteImage
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-fixit committed Nov 21, 2022
1 parent e807f8c commit 9d9def3
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 128 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## develop
- fixed SPM problem by switching from PINRemoteImage to FLAnimatedImage

## [5.0.8](https://github.com/nytimes/NYTPhotoViewer/releases/tag/5.0.8)

Changes for users of the library currently on `5.0.8`:
Expand Down
2 changes: 1 addition & 1 deletion Examples/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"

gem 'cocoapods', '1.10.0'
gem 'cocoapods', '1.11.3'
76 changes: 40 additions & 36 deletions Examples/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.2)
activesupport (5.2.4.4)
CFPropertyList (3.0.5)
rexml
activesupport (6.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.3)
cocoapods (1.10.0)
addressable (~> 2.6)
claide (1.1.0)
cocoapods (1.11.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.10.0)
cocoapods-core (= 1.11.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -28,66 +30,68 @@ GEM
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.19.0, < 2.0)
cocoapods-core (1.10.0)
activesupport (> 5.0, < 6)
addressable (~> 2.6)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-trunk (1.5.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.10)
escape (0.0.4)
ethon (0.12.0)
ffi (>= 1.3.0)
ffi (1.13.1)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.5)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.3.1)
minitest (5.14.2)
molinillo (0.6.6)
json (2.6.2)
minitest (5.16.3)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
ruby-macho (1.4.0)
thread_safe (0.3.6)
public_suffix (4.0.7)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.10)
thread_safe (~> 0.1)
xcodeproj (1.19.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.1)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.10.0)
cocoapods (= 1.11.3)

BUNDLED WITH
2.1.4
41 changes: 11 additions & 30 deletions Examples/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,51 +1,32 @@
PODS:
- NYTPhotoViewer (5.0.7):
- NYTPhotoViewer/AnimatedGifSupport (= 5.0.7)
- NYTPhotoViewer/Core (= 5.0.7)
- NYTPhotoViewer/AnimatedGifSupport (5.0.7):
- FLAnimatedImage (1.0.17)
- NYTPhotoViewer (5.0.8):
- NYTPhotoViewer/AnimatedGifSupport (= 5.0.8)
- NYTPhotoViewer/Core (= 5.0.8)
- NYTPhotoViewer/AnimatedGifSupport (5.0.8):
- FLAnimatedImage
- NYTPhotoViewer/Core
- PINRemoteImage/iOS
- PINRemoteImage/PINCache
- NYTPhotoViewer/Core (5.0.7)
- NYTPhotoViewer/Core (5.0.8)
- OCMock (3.7.1)
- PINCache (3.0.3):
- PINCache/Arc-exception-safe (= 3.0.3)
- PINCache/Core (= 3.0.3)
- PINCache/Arc-exception-safe (3.0.3):
- PINCache/Core
- PINCache/Core (3.0.3):
- PINOperation (~> 1.2.1)
- PINOperation (1.2.1)
- PINRemoteImage/Core (3.0.3):
- PINOperation
- PINRemoteImage/iOS (3.0.3):
- PINRemoteImage/Core
- PINRemoteImage/PINCache (3.0.3):
- PINCache (~> 3.0.3)
- PINRemoteImage/Core

DEPENDENCIES:
- NYTPhotoViewer (from `..`)
- OCMock

SPEC REPOS:
trunk:
- FLAnimatedImage
- OCMock
- PINCache
- PINOperation
- PINRemoteImage

EXTERNAL SOURCES:
NYTPhotoViewer:
:path: ".."

SPEC CHECKSUMS:
NYTPhotoViewer: 64f9c45438a0e6a8f6fa67fd924bd090dea54ad4
FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b
NYTPhotoViewer: 56bb5fd5c90524ef2e8bd23e660440934bc5764d
OCMock: 75fbeaa46a9b11f8c182bbb1d1f7e9a35ccc9955
PINCache: 7a8fc1a691173d21dbddbf86cd515de6efa55086
PINOperation: 00c935935f1e8cf0d1e2d6b542e75b88fc3e5e20
PINRemoteImage: f1295b29f8c5e640e25335a1b2bd9d805171bd01

PODFILE CHECKSUM: 2d91d58ac59e8440027da7c7b8b5f2e362fb3857

COCOAPODS: 1.10.0
COCOAPODS: 1.11.3
3 changes: 1 addition & 2 deletions NYTPhotoViewer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Pod::Spec.new do |s|
s.subspec 'AnimatedGifSupport' do |ss|
ss.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'ANIMATED_GIF_SUPPORT=1' }
ss.dependency 'NYTPhotoViewer/Core'
ss.dependency 'PINRemoteImage/iOS'
ss.dependency 'PINRemoteImage/PINCache'
ss.dependency 'FLAnimatedImage'
end

end
6 changes: 2 additions & 4 deletions NYTPhotoViewer/NYTPhotoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@

#ifdef ANIMATED_GIF_SUPPORT
#if SWIFT_PACKAGE
#import "PINRemoteImage.h"
#import "PINAnimatedImageView.h"
#import "FLAnimatedImageView.h"
#else
#import <PINRemoteImage/PINRemoteImage.h>
#import <PINRemoteImage/PINAnimatedImageView.h>
#import <FLAnimatedImage/FLAnimatedImageView.h>
#endif
#endif

Expand Down
6 changes: 2 additions & 4 deletions NYTPhotoViewer/NYTPhotosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

#ifdef ANIMATED_GIF_SUPPORT
#if SWIFT_PACKAGE
#import "PINRemoteImage.h"
#import "PINAnimatedImageView.h"
#import "FLAnimatedImageView.h"
#else
#import <PINRemoteImage/PINRemoteImage.h>
#import <PINRemoteImage/PINAnimatedImageView.h>
#import <FLAnimatedImage/FLAnimatedImageView.h>
#endif
#endif

Expand Down
16 changes: 8 additions & 8 deletions NYTPhotoViewer/NYTScalingImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

#ifdef ANIMATED_GIF_SUPPORT
#if SWIFT_PACKAGE
#import "PINRemoteImage.h"
#import "PINAnimatedImageView.h"
#import "FLAnimatedImageView.h"
#else
#import <PINRemoteImage/PINRemoteImage.h>
#import <PINRemoteImage/PINAnimatedImageView.h>
#import <FLAnimatedImage/FLAnimatedImageView.h>
#import <FLAnimatedImage/FLAnimatedImage.h>
#endif
#endif

Expand All @@ -25,7 +24,7 @@ @interface NYTScalingImageView ()
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

#ifdef ANIMATED_GIF_SUPPORT
@property (nonatomic) PINAnimatedImageView *imageView;
@property (nonatomic) FLAnimatedImageView *imageView;
#else
@property (nonatomic) UIImageView *imageView;
#endif
Expand Down Expand Up @@ -94,7 +93,8 @@ - (void)setupInternalImageViewWithImage:(UIImage *)image imageData:(NSData *)ima
UIImage *imageToUse = image ?: [UIImage imageWithData:imageData];

#ifdef ANIMATED_GIF_SUPPORT
self.imageView = [[PINAnimatedImageView alloc] initWithAnimatedImage:[[PINCachedAnimatedImage alloc] initWithAnimatedImageData:imageData]];
self.imageView = FLAnimatedImageView.new;
self.imageView.animatedImage = [FLAnimatedImage animatedImageWithGIFData:imageData];
#else
self.imageView = [[UIImageView alloc] initWithImage:imageToUse];
#endif
Expand Down Expand Up @@ -127,8 +127,8 @@ - (void)updateImage:(UIImage *)image imageData:(NSData *)imageData {
self.imageView.image = imageToUse;

#ifdef ANIMATED_GIF_SUPPORT
// It's necessarry to first assign the UIImage so calulations for layout go right (see above)
self.imageView.animatedImage = [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:imageData];
// It's necessary to first assign the UIImage so calculations for layout go right (see above)
self.imageView.animatedImage = [FLAnimatedImage animatedImageWithGIFData:imageData];
#endif

self.imageView.frame = CGRectMake(0, 0, imageToUse.size.width, imageToUse.size.height);
Expand Down
4 changes: 2 additions & 2 deletions NYTPhotoViewer/include/NYTScalingImageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@import UIKit;

#ifdef ANIMATED_GIF_SUPPORT
@class PINAnimatedImageView;
@class FLAnimatedImageView;
#endif

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
* The image view used internally as the contents of the scroll view.
*/
#ifdef ANIMATED_GIF_SUPPORT
@property (nonatomic, readonly) PINAnimatedImageView *imageView;
@property (nonatomic, readonly) FLAnimatedImageView *imageView;
#else
@property (nonatomic, readonly) UIImageView *imageView;
#endif
Expand Down
35 changes: 4 additions & 31 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,12 @@
"object": {
"pins": [
{
"package": "libwebp",
"repositoryURL": "https://github.com/SDWebImage/libwebp-Xcode",
"package": "FLAnimatedImage",
"repositoryURL": "https://github.com/Flipboard/FLAnimatedImage.git",
"state": {
"branch": null,
"revision": "86c1b5d567ed548da861486b54e1f8f068a3cef7",
"version": "1.1.0"
}
},
{
"package": "PINCache",
"repositoryURL": "https://github.com/pinterest/PINCache.git",
"state": {
"branch": null,
"revision": "875c654984fb52b47ca65ae70d24852b0003ccd9",
"version": "3.0.3"
}
},
{
"package": "PINOperation",
"repositoryURL": "https://github.com/pinterest/PINOperation.git",
"state": {
"branch": null,
"revision": "44d8ca154a4e75a028a5548c31ff3a53b90cef15",
"version": "1.2.1"
}
},
{
"package": "PINRemoteImage",
"repositoryURL": "https://github.com/pinterest/PINRemoteImage.git",
"state": {
"branch": null,
"revision": "611d8ab1c6937bcdfd9d59a967716b0370a332be",
"version": "3.0.3"
"revision": "d4f07b6f164d53c1212c3e54d6460738b1981e9f",
"version": "1.0.17"
}
}
]
Expand Down
12 changes: 2 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,16 @@ let package = Package(
products: [
.library(
name: "NYTPhotoViewer",
targets: ["NYTPhotoViewer", "NYTPhotoViewerGIF"]
targets: ["NYTPhotoViewer"]
),
],
dependencies: [
.package(url: "https://github.com/pinterest/PINRemoteImage.git", from: "3.0.1")
.package(url: "https://github.com/Flipboard/FLAnimatedImage.git", .upToNextMajor(from: "1.0.17"))
],
targets: [
.target(
name: "NYTPhotoViewer",
path: "NYTPhotoViewer"
),
.target(
name: "NYTPhotoViewerGIF",
dependencies: ["PINRemoteImage"],
path: "SourceSymLink",
cSettings: [
.define("ANIMATED_GIF_SUPPORT", to: "1")
]
)
]
)

0 comments on commit 9d9def3

Please sign in to comment.