Bug: rightPanelButton and fixed space is getting added multiple times, if additionalRightButtonsForViewController method is called multiple times.

Solution: putting a check, if rightPanelButton is already part of additionalRightButtonsForViewController, then no need to add it again.
This commit is contained in:
Khan, Arshad 2020-06-08 17:19:17 +05:30
parent ee888c21ac
commit 8527b29e50

View File

@ -407,10 +407,10 @@ CGFloat const PanelAnimationDuration = 0.2;
- (void)setRightNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
NSMutableArray *navigationItems = [[NSMutableArray alloc] init];
if ((accessible && !extended) && self.rightPanelButton) {
NSArray *extraButtons = [self additionalRightButtonsForViewController:viewController];
if ((accessible && !extended) && self.rightPanelButton && ![extraButtons containsObject:self.rightPanelButton]) {
[navigationItems addObject:self.rightPanelButton];
}
NSArray *extraButtons = [self additionalRightButtonsForViewController:viewController];
if (extraButtons) {
[navigationItems addObjectsFromArray:extraButtons];
}