Skip to content

Commit

Permalink
Merge pull request #319 from nytimes/develop
Browse files Browse the repository at this point in the history
merge developer -> master for 5.0.2
  • Loading branch information
mr-fixit authored Apr 29, 2020
2 parents a5e0660 + f8ea59e commit 65781ed
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 46 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

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

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

Changes for users of the library in 5.0.2:

- Restore a method that was accidentally removed in 5.0.0. This prevented a long-tap guesture from displaying the 'Copy' menu.
- Remove obsolete check for iOS 8.3.

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

Changes for users of the library in 5.0.1:

- bugfix: we weren't treating a nil interstitial correctly.
- bugfix: we weren't treating a nil interstitial correctly, so they weren't being skipped as intended.

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

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 = "5.0.1"
s.version = "5.0.2"

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
2 changes: 1 addition & 1 deletion NYTPhotoViewer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.0.1</string>
<string>5.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
44 changes: 1 addition & 43 deletions NYTPhotoViewer/NYTPhotoDismissalInteractionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,8 @@ - (void)finishPanWithPanGestureRecognizer:(UIPanGestureRecognizer *)panGestureRe
}
else {
[self.transitionContext cancelInteractiveTransition];

if (![[self class] isRadar20070670Fixed]) {
[self fixCancellationStatusBarAppearanceBug];
}
}

self.viewToHideWhenBeginningTransition.alpha = 1.0;

[self.transitionContext completeTransition:isDismissing && !self.transitionContext.transitionWasCancelled];
Expand All @@ -138,44 +134,6 @@ - (CGFloat)backgroundAlphaForPanningWithVerticalDelta:(CGFloat)verticalDelta {
return startingAlpha - (deltaAsPercentageOfMaximum * totalAvailableAlpha);
}

#pragma mark - Bug Fix

- (void)fixCancellationStatusBarAppearanceBug {
UIViewController *toViewController = [self.transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController *fromViewController = [self.transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];

NSString *statusBarViewControllerSelectorPart1 = @"_setPresentedSta";
NSString *statusBarViewControllerSelectorPart2 = @"tusBarViewController:";
SEL setStatusBarViewControllerSelector = NSSelectorFromString([statusBarViewControllerSelectorPart1 stringByAppendingString:statusBarViewControllerSelectorPart2]);

if ([toViewController respondsToSelector:setStatusBarViewControllerSelector] && fromViewController.modalPresentationCapturesStatusBarAppearance) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[toViewController performSelector:setStatusBarViewControllerSelector withObject:fromViewController];
#pragma clang diagnostic pop
}
}

+ (BOOL)isRadar20070670Fixed {
// per @bcapps, this was fixed in iOS 8.3 but not marked as such on bugreport.apple.com
// https://github.com/NYTimes/NYTPhotoViewer/issues/131#issue-126923817

static BOOL isRadar20070670Fixed;

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSOperatingSystemVersion const iOSVersion8Point3 = (NSOperatingSystemVersion) {
.majorVersion = 8,
.minorVersion = 3,
.patchVersion = 0
};

isRadar20070670Fixed = [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:iOSVersion8Point3];
});

return isRadar20070670Fixed;
}

#pragma mark - UIViewControllerInteractiveTransitioning

- (void)startInteractiveTransition:(id <UIViewControllerContextTransitioning>)transitionContext {
Expand Down
21 changes: 21 additions & 0 deletions NYTPhotoViewer/NYTPhotosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,27 @@ - (NSInteger)totalItemCount {
return self.dataSource.numberOfPhotos.integerValue + numberOfInterstitialViews;
}

#pragma mark - NYPhotoViewControllerDelegate

- (void)photoViewController:(NYTPhotoViewController *)photoViewController didLongPressWithGestureRecognizer:(UILongPressGestureRecognizer *)longPressGestureRecognizer {
self.shouldHandleLongPress = NO;

BOOL clientDidHandle = NO;
if ([self.delegate respondsToSelector:@selector(photosViewController:handleLongPressForPhoto:withGestureRecognizer:)]) {
clientDidHandle = [self.delegate photosViewController:self handleLongPressForPhoto:photoViewController.photo withGestureRecognizer:longPressGestureRecognizer];
}

self.shouldHandleLongPress = !clientDidHandle;

if (self.shouldHandleLongPress) {
UIMenuController *menuController = [UIMenuController sharedMenuController];
CGRect targetRect = CGRectZero;
targetRect.origin = [longPressGestureRecognizer locationInView:longPressGestureRecognizer.view];
[menuController setTargetRect:targetRect inView:longPressGestureRecognizer.view];
[menuController setMenuVisible:YES animated:YES];
}
}

#pragma mark - UIPageViewControllerDataSource

/// internal helper method for the following two delegate methods
Expand Down

0 comments on commit 65781ed

Please sign in to comment.