Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot hide commentsBarButtonItem #27

Open
flysec opened this issue May 14, 2016 · 0 comments
Open

cannot hide commentsBarButtonItem #27

flysec opened this issue May 14, 2016 · 0 comments

Comments

@flysec
Copy link

flysec commented May 14, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant