Skip to content

Commit

Permalink
Rename …didDisplayPhoto… to …didNavigateToPhoto…
Browse files Browse the repository at this point in the history
This more closely reflects that this delegate method/notification is tightly tied to user interactions.

closes #42
  • Loading branch information
cdzombak committed Apr 20, 2015
1 parent 0a3d13e commit 161e7d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Example/NYTPhotoViewer-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class ViewController: UIViewController, NYTPhotosViewControllerDelegate {
return nil
}

func photosViewController(photosViewController: NYTPhotosViewController!, didDisplayPhoto photo: NYTPhoto!, atIndex photoIndex: UInt) {
println("Did Display Photo: \(photo) identifier: \(photoIndex)")
func photosViewController(photosViewController: NYTPhotosViewController!, didNavigateToPhoto photo: NYTPhoto!, atIndex photoIndex: UInt) {
println("Did Navigate To Photo: \(photo) identifier: \(photoIndex)")
}

func photosViewController(photosViewController: NYTPhotosViewController!, actionCompletedWithActivityType activityType: String!) {
Expand Down
4 changes: 2 additions & 2 deletions Example/NYTPhotoViewer/NYTViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ - (NSDictionary *)photosViewController:(NYTPhotosViewController *)photosViewCont
return nil;
}

- (void)photosViewController:(NYTPhotosViewController *)photosViewController didDisplayPhoto:(id <NYTPhoto>)photo atIndex:(NSUInteger)photoIndex {
NSLog(@"Did Display Photo: %@ identifier: %lu", photo, (unsigned long)photoIndex);
- (void)photosViewController:(NYTPhotosViewController *)photosViewController didNavigateToPhoto:(id <NYTPhoto>)photo atIndex:(NSUInteger)photoIndex {
NSLog(@"Did Navigate To Photo: %@ identifier: %lu", photo, (unsigned long)photoIndex);
}

- (void)photosViewController:(NYTPhotosViewController *)photosViewController actionCompletedWithActivityType:(NSString *)activityType {
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/ios/NYTPhotosViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@protocol NYTPhotosViewControllerDelegate;

// All notifications will have the `NYTPhotosViewController` instance set as the object.
extern NSString * const NYTPhotosViewControllerDidDisplayPhotoNotification;
extern NSString * const NYTPhotosViewControllerDidNavigateToPhotoNotification;
extern NSString * const NYTPhotosViewControllerWillDismissNotification;
extern NSString * const NYTPhotosViewControllerDidDismissNotification;

Expand Down Expand Up @@ -110,7 +110,7 @@ extern NSString * const NYTPhotosViewControllerDidDismissNotification;
* @param photo The photo object that was just displayed.
* @param photoIndex The index of the photo that was just displayed.
*/
- (void)photosViewController:(NYTPhotosViewController *)photosViewController didDisplayPhoto:(id <NYTPhoto>)photo atIndex:(NSUInteger)photoIndex;
- (void)photosViewController:(NYTPhotosViewController *)photosViewController didNavigateToPhoto:(id <NYTPhoto>)photo atIndex:(NSUInteger)photoIndex;

/**
* Called immediately before the photos view controller is about to start dismissal. This will be the beginning of the interactive panning to dismiss, if it is enabled and performed.
Expand Down
12 changes: 6 additions & 6 deletions Pod/Classes/ios/NYTPhotosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import "NYTPhotosOverlayView.h"
#import "NYTPhotoCaptionView.h"

NSString * const NYTPhotosViewControllerDidDisplayPhotoNotification = @"NYTPhotosViewControllerDidDisplayPhotoNotification";
NSString * const NYTPhotosViewControllerDidNavigateToPhotoNotification = @"NYTPhotosViewControllerDidNavigateToPhotoNotification";
NSString * const NYTPhotosViewControllerWillDismissNotification = @"NYTPhotosViewControllerWillDismissNotification";
NSString * const NYTPhotosViewControllerDidDismissNotification = @"NYTPhotosViewControllerDidDismissNotification";

Expand Down Expand Up @@ -371,12 +371,12 @@ - (NYTPhotoViewController *)newPhotoViewControllerForPhoto:(id <NYTPhoto>)photo
return nil;
}

- (void)didDisplayPhoto:(id <NYTPhoto>)photo {
if ([self.delegate respondsToSelector:@selector(photosViewController:didDisplayPhoto:atIndex:)]) {
[self.delegate photosViewController:self didDisplayPhoto:photo atIndex:[self.dataSource indexOfPhoto:photo]];
- (void)didNavigateToPhoto:(id <NYTPhoto>)photo {
if ([self.delegate respondsToSelector:@selector(photosViewController:didNavigateToPhoto:atIndex:)]) {
[self.delegate photosViewController:self didNavigateToPhoto:photo atIndex:[self.dataSource indexOfPhoto:photo]];
}

[[NSNotificationCenter defaultCenter] postNotificationName:NYTPhotosViewControllerDidDisplayPhotoNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:NYTPhotosViewControllerDidNavigateToPhotoNotification object:self];
}

- (id <NYTPhoto>)currentlyDisplayedPhoto {
Expand Down Expand Up @@ -439,7 +439,7 @@ - (void)pageViewController:(UIPageViewController *)pageViewController didFinishA
[self updateOverlayInformation];

UIViewController <NYTPhotoContainer> *photoViewController = pageViewController.viewControllers.firstObject;
[self didDisplayPhoto:photoViewController.photo];
[self didNavigateToPhoto:photoViewController.photo];
}
}

Expand Down

0 comments on commit 161e7d8

Please sign in to comment.