From d9f37d3db195f9bd8026a3f6eb43352ea58e162c Mon Sep 17 00:00:00 2001 From: Abhijeet Ranjan <139110221+AbhijeetRanjan308@users.noreply.github.com> Date: Sat, 18 Oct 2025 16:35:36 +0530 Subject: [PATCH 1/3] Update navigation bar button appearance and behavior Adds tintColor customization for navigation bar buttons in FAQ and conversation list screens. Sets hidesSharedBackground for navigation bar items on iOS 26+ to improve UI consistency. Ensures back button and create conversation icon use configurable colors. --- .../Classes/FaqViewController.swift | 12 ++++++- .../KMConversationListViewController.swift | 35 +++++++++++++++++-- .../KMConversationViewController.swift | 8 +++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Sources/Kommunicate/Classes/FaqViewController.swift b/Sources/Kommunicate/Classes/FaqViewController.swift index 7213faa3..6fb2ac84 100644 --- a/Sources/Kommunicate/Classes/FaqViewController.swift +++ b/Sources/Kommunicate/Classes/FaqViewController.swift @@ -79,8 +79,18 @@ public class FaqViewController: UIViewController, Localizable { override public func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - navigationItem.leftBarButtonItem = getBackArrowButton(target: self, action: #selector(backTapped)) + var backButton = getBackArrowButton(target: self, action: #selector(backTapped)) navigationItem.title = localizedString(forKey: "FaqTitle", fileName: configuration.localizedStringFileName) + backButton.tintColor = configuration.bottomSheetNavIconColor + navigationItem.leftBarButtonItem = backButton + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + navigationItem.leftBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + } } @objc func backTapped() { diff --git a/Sources/Kommunicate/Classes/KMConversationListViewController.swift b/Sources/Kommunicate/Classes/KMConversationListViewController.swift index f214d9c8..9898463a 100644 --- a/Sources/Kommunicate/Classes/KMConversationListViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationListViewController.swift @@ -113,6 +113,7 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz target: self, action: #selector(compose) ) barButton.accessibilityIdentifier = "startNewIcon" + barButton.tintColor = configuration.navCreateConversationIconColor return barButton }() @@ -384,9 +385,21 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz guard !configuration.hideBackButtonInConversationList else { return } if configuration.enableBackArrowOnConversationListScreen { - navigationItem.leftBarButtonItem = getBackArrowButton(target: self, action: #selector(customBackAction)) + let backArrowButton = getBackArrowButton(target: self, action: #selector(customBackAction)) + backArrowButton.tintColor = configuration.conversationListScreenBackButtonColor + navigationItem.leftBarButtonItem = backArrowButton } else { - navigationItem.leftBarButtonItem = getBackTextButton(title: LocalizedText.leftBarBackButtonText, target: self, action: #selector(customBackAction)) + let backTextButton = getBackTextButton(title: LocalizedText.leftBarBackButtonText, target: self, action: #selector(customBackAction)) + backTextButton.tintColor = configuration.conversationListScreenBackButtonColor + navigationItem.leftBarButtonItem = backTextButton + } + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + navigationItem.leftBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } } } @@ -418,6 +431,14 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz let rightButtons = rightBarButtonItems.prefix(3) navigationItem.rightBarButtonItems = Array(rightButtons) } + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + navigationItem.leftBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + } } func setupSearchController() { @@ -431,7 +452,15 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz navigationItem.rightBarButtonItems = nil navigationItem.leftBarButtonItems = nil navigationItem.titleView = searchBar - + + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + navigationItem.leftBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + } UIView.animate( withDuration: 0.5, animations: { self.searchBar.show(true) }, diff --git a/Sources/Kommunicate/Classes/KMConversationViewController.swift b/Sources/Kommunicate/Classes/KMConversationViewController.swift index 14e41503..947c7e3c 100644 --- a/Sources/Kommunicate/Classes/KMConversationViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationViewController.swift @@ -704,6 +704,14 @@ open class KMConversationViewController: KMChatConversationViewController, KMUpd // Remove current title from center of navigation bar navigationItem.titleView = UIView() navigationItem.leftBarButtonItems = nil + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + navigationItem.leftBarButtonItems?.forEach { + $0.hidesSharedBackground = true + } + } // Create custom navigation view. let (contact, channel) = conversationDetail.conversationAssignee(groupId: viewModel.channelKey, userId: viewModel.contactId) if let alChannel = channel { From 8ee9006422283e4a54f4a88e3da50d64f094bc6f Mon Sep 17 00:00:00 2001 From: Abhijeet Ranjan <139110221+AbhijeetRanjan308@users.noreply.github.com> Date: Sat, 18 Oct 2025 16:53:08 +0530 Subject: [PATCH 2/3] Refactor navigation bar button configuration for iOS 26 Replaced repeated iOS 26 navigation bar button background hiding logic with a new helper method, configureNavigationBarButtonsForIOS26, in KMConversationListViewController and KMConversationViewController. This improves code maintainability and reduces duplication. --- .../KMConversationListViewController.swift | 27 +++---------------- .../KMConversationViewController.swift | 9 +------ 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/Sources/Kommunicate/Classes/KMConversationListViewController.swift b/Sources/Kommunicate/Classes/KMConversationListViewController.swift index 9898463a..15ed54fb 100644 --- a/Sources/Kommunicate/Classes/KMConversationListViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationListViewController.swift @@ -393,14 +393,7 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz backTextButton.tintColor = configuration.conversationListScreenBackButtonColor navigationItem.leftBarButtonItem = backTextButton } - if #available(iOS 26.0, *) { - navigationItem.rightBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - navigationItem.leftBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - } + configureNavigationBarButtonsForIOS26() } func setupNavigationRightButtons() { @@ -431,14 +424,7 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz let rightButtons = rightBarButtonItems.prefix(3) navigationItem.rightBarButtonItems = Array(rightButtons) } - if #available(iOS 26.0, *) { - navigationItem.rightBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - navigationItem.leftBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - } + configureNavigationBarButtonsForIOS26() } func setupSearchController() { @@ -453,14 +439,7 @@ public class KMConversationListViewController: KMChatBaseViewController, Localiz navigationItem.leftBarButtonItems = nil navigationItem.titleView = searchBar - if #available(iOS 26.0, *) { - navigationItem.rightBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - navigationItem.leftBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - } + configureNavigationBarButtonsForIOS26() UIView.animate( withDuration: 0.5, animations: { self.searchBar.show(true) }, diff --git a/Sources/Kommunicate/Classes/KMConversationViewController.swift b/Sources/Kommunicate/Classes/KMConversationViewController.swift index 947c7e3c..1d22e1d5 100644 --- a/Sources/Kommunicate/Classes/KMConversationViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationViewController.swift @@ -704,14 +704,7 @@ open class KMConversationViewController: KMChatConversationViewController, KMUpd // Remove current title from center of navigation bar navigationItem.titleView = UIView() navigationItem.leftBarButtonItems = nil - if #available(iOS 26.0, *) { - navigationItem.rightBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - navigationItem.leftBarButtonItems?.forEach { - $0.hidesSharedBackground = true - } - } + configureNavigationBarButtonsForIOS26() // Create custom navigation view. let (contact, channel) = conversationDetail.conversationAssignee(groupId: viewModel.channelKey, userId: viewModel.contactId) if let alChannel = channel { From 26aa8fd33d3b2b18f08ed7a818ccc83e3a61c8ae Mon Sep 17 00:00:00 2001 From: Abhijeet Ranjan <139110221+AbhijeetRanjan308@users.noreply.github.com> Date: Sat, 18 Oct 2025 16:57:46 +0530 Subject: [PATCH 3/3] Move navigation bar button configuration call Relocated the call to configureNavigationBarButtonsForIOS26() within KMConversationViewController to ensure navigation bar buttons are set after updating the assignee details and custom navigation view. --- Sources/Kommunicate/Classes/KMConversationViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Kommunicate/Classes/KMConversationViewController.swift b/Sources/Kommunicate/Classes/KMConversationViewController.swift index 1d22e1d5..abd24ee8 100644 --- a/Sources/Kommunicate/Classes/KMConversationViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationViewController.swift @@ -704,7 +704,6 @@ open class KMConversationViewController: KMChatConversationViewController, KMUpd // Remove current title from center of navigation bar navigationItem.titleView = UIView() navigationItem.leftBarButtonItems = nil - configureNavigationBarButtonsForIOS26() // Create custom navigation view. let (contact, channel) = conversationDetail.conversationAssignee(groupId: viewModel.channelKey, userId: viewModel.contactId) if let alChannel = channel { @@ -725,6 +724,7 @@ open class KMConversationViewController: KMChatConversationViewController, KMUpd assigneeUserId = contact?.userId navigationItem.leftBarButtonItem = UIBarButtonItem(customView: customNavigationView) updateAssigneeDetails() + configureNavigationBarButtonsForIOS26() } override public func refreshViewController() {