Skip to content

Commit

Permalink
Merge pull request #306 from nytimes/develop
Browse files Browse the repository at this point in the history
Changes for 4.0.1 release
  • Loading branch information
ZevEisenberg authored Mar 30, 2020
2 parents 81e1cca + d545dd3 commit 989755e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Carthage/Checkouts/FLAnimatedImage"]
path = Carthage/Checkouts/FLAnimatedImage
url = https://github.com/Flipboard/FLAnimatedImage.git
[submodule "Carthage/Checkouts/ocmock"]
path = Carthage/Checkouts/ocmock
url = https://github.com/erikdoe/ocmock.git
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
## `develop`

Changes for users of the library currently on `develop`:

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

Changes for users of the library in 4.0.1:

- Removed `FLAnimatedImage` from .gitmodules.
- Change `NYTPhotosViewController` to use fullscreen presentation by default, so it causes the presenting view to disappear behind it, i.e. to get `-viewWillDisappear:` and `-viewDidDisappear` called on it.
- Fix unbalanced calls to begin/end appearance transitions.
- Modified comment parameter in `NYTPhotosViewController` and `NYTPhotoViewerSinglePhotoDataSource` to match parameter in signature. Removes compilation warning.

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

Changes for users of the library currently on `develop`:
Changes for users of the library in 4.0.0:

- Update deployment target to 9.0 from 8.0
- Remove property `UIPopoverController *activityPopoverController` from `NYTPhotosViewController`
Expand Down
2 changes: 1 addition & 1 deletion NYTPhotoViewer.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "NYTPhotoViewer"
s.version = "4.0.0"
s.version = "4.0.1"

s.description = <<-DESC
NYTPhotoViewer is a slideshow and image viewer that includes double tap to zoom, captions, support for multiple images, interactive flick to dismiss, animated zooming presentation, and more.
Expand Down
23 changes: 22 additions & 1 deletion NYTPhotoViewer/NYTPhotoDismissalInteractionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ - (void)didPanWithPanGestureRecognizer:(UIPanGestureRecognizer *)panGestureRecog
UIView *fromView = [self.transitionContext viewForKey:UITransitionContextFromViewKey];
CGPoint translatedPanGesturePoint = [panGestureRecognizer translationInView:fromView];
CGPoint newCenterPoint = CGPointMake(anchorPoint.x, anchorPoint.y + translatedPanGesturePoint.y);


// If we are presenting fullscreen, the presenting view controller's view will have been removed from the view
// hierarchy when the presentation animation finished. We need to put it back in the view hierarchy in order for
// it to appear behind the interactive dismissal animation.
UIView *toView = [self.transitionContext viewForKey:UITransitionContextToViewKey];
if (!toView.superview) {
UIViewController *toViewController = [self.transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
toView.frame = [self.transitionContext finalFrameForViewController:toViewController];
if (![toView isDescendantOfView:self.transitionContext.containerView]) {
[self.transitionContext.containerView addSubview:toView];
}
[self.transitionContext.containerView bringSubviewToFront:fromView];
}

// Pan the view on pace with the pan gesture.
viewToPan.center = newCenterPoint;

Expand Down Expand Up @@ -76,6 +89,14 @@ - (void)finishPanWithPanGestureRecognizer:(UIPanGestureRecognizer *)panGestureRe
finalBackgroundAlpha = 0.0;
}
}
else {
// Interactive transition was canceled (i.e. the user changed their mind and decided not to finish the
// dismissal), so if we are presenting fullscreen, remove the presenting view controller's view.
if (self.transitionContext.presentationStyle == UIModalPresentationFullScreen) {
UIView *toView = [self.transitionContext viewForKey:UITransitionContextToViewKey];
[toView removeFromSuperview];
}
}

if (!didAnimateUsingAnimator) {
[UIView animateWithDuration:animationDuration delay:0 options:animationCurve animations:^{
Expand Down
8 changes: 6 additions & 2 deletions NYTPhotoViewer/NYTPhotoTransitionAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ + (UIView *)newAnimationViewFromView:(UIView *)view {

#pragma mark - UIViewControllerAnimatedTransitioning
- (void)animationEnded:(BOOL)transitionCompleted {
[self.toViewController endAppearanceTransition];
[self.fromViewController endAppearanceTransition];
if (self.toViewController.parentViewController) {
[self.toViewController endAppearanceTransition];
}
if (self.fromViewController.parentViewController) {
[self.fromViewController endAppearanceTransition];
}
}

- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
Expand Down
2 changes: 1 addition & 1 deletion NYTPhotoViewer/NYTPhotoViewerSinglePhotoDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* The designated initializer that takes and stores a single photo.
*
* @param photos An object conforming to the `NYTPhoto` protocol.
* @param photo An object conforming to the `NYTPhoto` protocol.
*
* @return A fully initialized data source.
*/
Expand Down
2 changes: 1 addition & 1 deletion NYTPhotoViewer/NYTPhotosViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ extern NSString * const NYTPhotosViewControllerDidDismissNotification;
*
* This method has no effect if the given index is out of bounds in the data source.
*
* @param photo The index of the photo which changed in the data source.
* @param photoIndex The index of the photo which changed in the data source.
*/
- (void)updatePhotoAtIndex:(NSInteger)photoIndex;

Expand Down
2 changes: 1 addition & 1 deletion NYTPhotoViewer/NYTPhotosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ - (void)commonInitWithDataSource:(id <NYTPhotoViewerDataSource>)dataSource initi
_singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didSingleTapWithGestureRecognizer:)];

_transitionController = [[NYTPhotoTransitionController alloc] init];
self.modalPresentationStyle = UIModalPresentationCustom;
self.modalPresentationStyle = UIModalPresentationFullScreen;
self.transitioningDelegate = _transitionController;
self.modalPresentationCapturesStatusBarAppearance = YES;

Expand Down

0 comments on commit 989755e

Please sign in to comment.