Skip to content

cannot hide commentsBarButtonItem #27

@flysec

Description

@flysec

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];
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions