Merge branch 'release/11_5_0' into 'develop'

release/11_5_0 hotfix merge

Co-authored-by: Scott Pfeil <Scott.Pfeil3@verizonwireless.com>
Co-authored-by: Bruce, Matt R <matt.bruce@one.verizon.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1093
This commit is contained in:
Hedden, Kyle Matthew 2024-04-12 13:39:00 +00:00
commit 0cb04e3700
10 changed files with 66 additions and 5 deletions

View File

@ -74,7 +74,7 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol, ParentMo
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
titleLockup = try typeContainer.decodeMolecule(codingKey: .titleLockup)
titleLockup = try helper.deprecatedCreate(from: decoder) ?? typeContainer.decodeMolecule(codingKey: .titleLockup)
buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons)
try super.init(from: decoder)
}

View File

@ -67,7 +67,7 @@ public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol, Parent
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
titleLockup = try typeContainer.decodeMolecule(codingKey: .titleLockup)
titleLockup = try helper.deprecatedCreate(from: decoder) ?? typeContainer.decodeMolecule(codingKey: .titleLockup)
caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink)
try super.init(from: decoder)
}

View File

@ -73,7 +73,7 @@ public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol, ParentMolec
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
titleLockup = try typeContainer.decodeMolecule(codingKey: .titleLockup)
titleLockup = try helper.deprecatedCreate(from: decoder) ?? typeContainer.decodeMolecule(codingKey: .titleLockup)
link = try typeContainer.decode(LinkModel.self, forKey: .link)
try super.init(from: decoder)
}

View File

@ -76,7 +76,7 @@ public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol, Paren
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
titleLockup = try typeContainer.decodeMolecule(codingKey: .titleLockup)
titleLockup = try helper.deprecatedCreate(from: decoder) ?? typeContainer.decodeMolecule(codingKey: .titleLockup)
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
try super.init(from: decoder)
}

View File

@ -34,6 +34,7 @@ import Combine
public static func setupNavigationControllerAsMainController() -> Self? {
guard let navigationController = setupNavigationController() else { return nil }
MVMCoreUISession.sharedGlobal()?.setup(asStandardLoadViewDelegate: navigationController)
MVMCoreObject.sharedInstance()?.viewControllerManager = navigationController
return navigationController
}
@ -136,6 +137,31 @@ extension NavigationController: MVMCoreViewManagerProtocol {
public func displayedViewController(_ viewController: UIViewController) {
manager?.displayedViewController?(viewController)
}
private func go(to index: Int) async {
guard index != viewControllers.count - 1 else { return }
await NavigationHandler.shared().set(viewControllers: Array(viewControllers[0...index]), navigationController: self)
}
public func navigate(toViewControllerOfPageType pageType: String, controllerType: AnyClass?) async -> UIViewController? {
for (index, controller) in viewControllers.enumerated() {
if let manager = controller as? MVMCoreViewManagerProtocol,
let viewController = await manager.navigate(toViewControllerOfPageType: pageType, controllerType: controllerType) {
await go(to: index)
return viewController
} else if let controller = controller as? MVMCoreViewControllerProtocol & UIViewController,
controller.pageType == pageType {
guard let controllerType = controllerType else {
await go(to: index)
return controller
}
guard (type(of: controller) == controllerType) else { continue }
await go(to: index)
return controller
}
}
return nil
}
}
extension UIColor {

View File

@ -102,7 +102,7 @@ public extension UINavigationController {
navigationBar.standardAppearance = appearance
navigationBar.scrollEdgeAppearance = appearance
setNavigationBarHidden(model.hidden, animated: true)
setNavigationBarHidden(model.hidden, animated: false)
}
@objc @MainActor

View File

@ -269,6 +269,10 @@ extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol {
public func newDataReceived(in viewController: UIViewController) {
updateState(with: viewController)
}
public func navigate(toViewControllerOfPageType pageType: String, controllerType: AnyClass?) async -> UIViewController? {
return await navigationController?.navigate(toViewControllerOfPageType: pageType, controllerType: controllerType)
}
}
@objc public extension MVMCoreUISplitViewController {

View File

@ -95,6 +95,7 @@ CGFloat const PanelAnimationDuration = 0.2;
if (topAlertView) {
[splitViewController subscribeForNotifications];
}
[MVMCoreObject sharedInstance].viewControllerManager = splitViewController;
return splitViewController;
}

View File

@ -362,6 +362,35 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
manager?.displayedViewController?(viewController)
}
private func go(to index: Int) async {
// Load controller from the cache
guard index != self.index,
let controller = viewControllers[index] else { return }
needToTrackTabSelect = true
self.index = index
await NavigationHandler.shared().replace(viewController: controller, navigationController:subNavigationController, delegateObject:delegateObject(), tryToReplace: false, animated: true)
}
public func navigate(toViewControllerOfPageType pageType: String, controllerType: AnyClass?) async -> UIViewController? {
for (index, controller) in viewControllers.enumerated() {
if let manager = controller as? MVMCoreViewManagerProtocol,
let viewController = await manager.navigate(toViewControllerOfPageType: pageType, controllerType: controllerType) {
await go(to: index)
return viewController
} else if let controller = controller as? MVMCoreViewControllerProtocol & UIViewController,
controller.pageType == pageType {
guard let controllerType = controllerType else {
await go(to: index)
return controller
}
guard (type(of: controller) == controllerType) else { continue }
await go(to: index)
return controller
}
}
return nil
}
// MARK: - MVMCoreUISwipeNavigationProtocol
public func swipeLeft() {

View File

@ -73,6 +73,7 @@ public extension MVMCoreUIUtility {
@objc
public extension MVMCoreUIUtility {
/// Returns the current visible viewcontroller.
@objc @MainActor
static func getVisibleViewController() -> UIViewController? {
var viewController = NavigationHandler.shared().getViewControllerToPresentOn()