This is an automated email from the ASF dual-hosted git repository. manuelbeck pushed a commit to branch pr-ios-refactor-adding-toolbar-items in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git
commit 306fbe17be7d20356fc5e8b7f315fbd04e1d9cce Author: Manuel Beck <[email protected]> AuthorDate: Sat Feb 21 11:57:13 2026 +0100 refactor(ios): adding toolbar items - Differentiate items for close button and optional navigation items. - Make it more readable what happens, when option `lefttoright` is set. --- src/ios/CDVWKInAppBrowser.m | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 0c6feb8..b0992b2 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -818,17 +818,26 @@ BOOL isExiting = NO; self.backButton.tintColor = [self colorFromHexString:_browserOptions.navigationbuttoncolor]; } - // Filter out Navigation Buttons if user requests so + // Add toolbar items + // Define the close button and flexible space button, they are reverted when lefttoright is set + NSArray *closeItems = _browserOptions.lefttoright ? @[flexibleSpaceButton, self.closeButton] : @[self.closeButton, flexibleSpaceButton]; + // Navigation items are optional + NSArray *navigationItems = @[self.backButton, fixedSpaceButton, self.forwardButton]; + + // Add close items without navigation items if (_browserOptions.hidenavigationbuttons) { + self.toolbar.items = closeItems; + + // Add close items and navigation items + } else { + // left to right is set, first add navigation items, than close items if (_browserOptions.lefttoright) { - [self.toolbar setItems:@[flexibleSpaceButton, self.closeButton]]; + self.toolbar.items = [navigationItems arrayByAddingObjectsFromArray:closeItems]; + + // Default order, first close items than navigation items } else { - [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]]; + self.toolbar.items = [closeItems arrayByAddingObjectsFromArray:navigationItems]; } - } else if (_browserOptions.lefttoright) { - [self.toolbar setItems:@[self.backButton, fixedSpaceButton, self.forwardButton, flexibleSpaceButton, self.closeButton]]; - } else { - [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]]; } self.webView.navigationDelegate = self; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
