From 53320bcf9aa8d770b44a2f3caa9625bbf0131fed Mon Sep 17 00:00:00 2001 From: Eric Slosser Date: Wed, 29 Apr 2020 09:12:37 -0400 Subject: [PATCH 1/3] restore the method i accidentally removed in 5.0.0 --- NYTPhotoViewer/NYTPhotosViewController.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/NYTPhotoViewer/NYTPhotosViewController.m b/NYTPhotoViewer/NYTPhotosViewController.m index 1c46787a..7255f6ce 100644 --- a/NYTPhotoViewer/NYTPhotosViewController.m +++ b/NYTPhotoViewer/NYTPhotosViewController.m @@ -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 From 8cd380ff4917d6d2c5b2dc9db21896fe26b794d4 Mon Sep 17 00:00:00 2001 From: Eric Slosser Date: Wed, 29 Apr 2020 10:55:29 -0400 Subject: [PATCH 2/3] issue 300, remove obsolete check for iOS 8.3 --- .../NYTPhotoDismissalInteractionController.m | 44 +------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/NYTPhotoViewer/NYTPhotoDismissalInteractionController.m b/NYTPhotoViewer/NYTPhotoDismissalInteractionController.m index 7d02717b..76b3d3aa 100644 --- a/NYTPhotoViewer/NYTPhotoDismissalInteractionController.m +++ b/NYTPhotoViewer/NYTPhotoDismissalInteractionController.m @@ -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]; @@ -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 )transitionContext { From fe7f4049cc26fad4dec8b25c16c681c9636678cc Mon Sep 17 00:00:00 2001 From: Eric Slosser Date: Wed, 29 Apr 2020 12:24:51 -0400 Subject: [PATCH 3/3] bump to 5.0.2 --- CHANGELOG.md | 9 ++++++++- NYTPhotoViewer.podspec | 2 +- NYTPhotoViewer/Info.plist | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e66c30..05e7c0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/NYTPhotoViewer.podspec b/NYTPhotoViewer.podspec index 1e1928f8..dce25f39 100644 --- a/NYTPhotoViewer.podspec +++ b/NYTPhotoViewer.podspec @@ -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. diff --git a/NYTPhotoViewer/Info.plist b/NYTPhotoViewer/Info.plist index 881962ab..821c2059 100644 --- a/NYTPhotoViewer/Info.plist +++ b/NYTPhotoViewer/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 5.0.1 + 5.0.2 CFBundleSignature ???? CFBundleVersion