EBPhotoPages icon indicating copy to clipboard operation
EBPhotoPages copied to clipboard

cannot hide commentsBarButtonItem

Open flysec opened this issue 9 years ago • 0 comments

Haven't remove commentsBarButtonItem from mutableLowerItems while checking commentsAreViewable. Please refer to the last line at source code below from EBPhotoPagesController.m

solution: change [mutableUpperItems removeObject:self.commentsBarButtonItem]; to [mutableLowerItems removeObject:self.commentsBarButtonItem];

  • (void)updateToolbarsWithPhotoAtIndex:(NSInteger)index { NSArray *upperItems = [self.photoPagesFactory upperToolbarItemsForPhotoPagesController:self inState:self.currentState];

    NSArray *lowerItems = [self.photoPagesFactory lowerToolbarItemsForPhotoPagesController:self inState:self.currentState];

    NSMutableArray *mutableUpperItems = [NSMutableArray arrayWithArray:upperItems]; NSMutableArray *mutableLowerItems = [NSMutableArray arrayWithArray:lowerItems];

    BOOL taggingAllowed = [self.photosDataSource respondsToSelector:@selector(photoPagesController:shouldAllowTaggingForPhotoAtIndex:)] ? [self.photosDataSource photoPagesController:self shouldAllowTaggingForPhotoAtIndex:index] : YES;

    BOOL activitiesAllowed = [self.photosDataSource respondsToSelector:@selector(photoPagesController:shouldAllowActivitiesForPhotoAtIndex:)] ? [self.photosDataSource photoPagesController:self shouldAllowActivitiesForPhotoAtIndex:index] : YES;

    BOOL commentsAreViewable = [self.photosDataSource respondsToSelector:@selector(photoPagesController:shouldShowCommentsForPhotoAtIndex:)] ? [self.photosDataSource photoPagesController:self shouldShowCommentsForPhotoAtIndex:index] : YES;

    if([self.photosDataSource photoPagesController:self shouldExpectPhotoAtIndex:index] == NO){ taggingAllowed = NO; activitiesAllowed = NO; commentsAreViewable = NO; }

    if(taggingAllowed == NO){ [mutableUpperItems removeObject:self.tagBarButtonItem]; [mutableLowerItems removeObject:self.tagBarButtonItem]; }

    if(activitiesAllowed == NO){ [mutableUpperItems removeObject:self.activityBarButtonItem]; [mutableLowerItems removeObject:self.activityBarButtonItem]; }

    if(commentsAreViewable == NO){ [mutableUpperItems removeObject:self.commentsBarButtonItem]; [mutableUpperItems removeObject:self.commentsBarButtonItem]; }

flysec avatar May 14 '16 13:05 flysec