From 781f3d6d7c966924b7970e6c3d52c10c40d791c6 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Mon, 18 Apr 2022 16:40:56 +0530 Subject: [PATCH 1/4] Fix for navigation bar style update from webpage js bridge call --- .../Protocols/ModelProtocols/NavigationItemModelProtocol.swift | 1 + .../NavigationController/UINavigationController+Extension.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index b9fb111a..5148130d 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -21,4 +21,5 @@ public protocol NavigationItemModelProtocol { var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var titleView: MoleculeModelProtocol? { get set } var titleOffset: UIOffset? { get } + var style: NavigationItemStyle? { get set } } diff --git a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift index ea5003f4..405fbbab 100644 --- a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift +++ b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift @@ -71,7 +71,7 @@ public extension UINavigationController { let tint = model.tintColor.uiColor navigationBar.tintColor = tint - let appearance = UINavigationBarAppearance() + let appearance = navigationBar.standardAppearance appearance.configureWithOpaqueBackground() appearance.titleTextAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: tint]; From afacedda9b6d4658493fbbf62ee9be231b375c05 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 20 Apr 2022 18:40:21 +0530 Subject: [PATCH 2/4] Refresh navigation bar, after updating navigation model received from JS call --- .../Containers/NavigationController/NavigationController.swift | 3 +++ .../UINavigationController+Extension.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift b/MVMCoreUI/Containers/NavigationController/NavigationController.swift index 644dee73..b1f54e57 100644 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift @@ -74,6 +74,9 @@ extension NavigationController: MVMCoreViewManagerProtocol { let model = getNavigationModel(from: viewController) { setNavigationItem(with: model, for: topViewController) setNavigationBarUI(with: model) + + navigationBar.setNeedsLayout() + navigationBar.layoutIfNeeded() } manager?.newDataReceived?(in: viewController) } diff --git a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift index 405fbbab..ea5003f4 100644 --- a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift +++ b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift @@ -71,7 +71,7 @@ public extension UINavigationController { let tint = model.tintColor.uiColor navigationBar.tintColor = tint - let appearance = navigationBar.standardAppearance + let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() appearance.titleTextAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: tint]; From 9cdf267a21d41a88163f0b447cb5ff9e8bdc9db4 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 20 Apr 2022 18:44:01 +0530 Subject: [PATCH 3/4] Removing style parameter from navigation model protocol --- .../Protocols/ModelProtocols/NavigationItemModelProtocol.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index 5148130d..b9fb111a 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -21,5 +21,4 @@ public protocol NavigationItemModelProtocol { var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var titleView: MoleculeModelProtocol? { get set } var titleOffset: UIOffset? { get } - var style: NavigationItemStyle? { get set } } From e8b97c6f4da576700ccdb379a4ed13f0c0a1b3f2 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 20 Apr 2022 19:52:15 +0530 Subject: [PATCH 4/4] Updating navigation layout on display --- .../Containers/NavigationController/NavigationController.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift b/MVMCoreUI/Containers/NavigationController/NavigationController.swift index b1f54e57..9b4b332a 100644 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift @@ -87,6 +87,9 @@ extension NavigationController: MVMCoreViewManagerProtocol { let model = getNavigationModel(from: viewController) { setNavigationItem(with: model, for: topViewController) setNavigationBarUI(with: model) + + navigationBar.setNeedsLayout() + navigationBar.layoutIfNeeded() } manager?.willDisplay?(viewController) }