Merge branch 'feature/root_nonroot_nav_bar' into 'develop'
Feature/root nonroot nav bar See merge request BPHV_MIPS/mvm_core_ui!610
This commit is contained in:
commit
56c6df27d1
@ -305,6 +305,8 @@
|
|||||||
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
|
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
|
||||||
D20C7009250BF99B0095B21C /* TopNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C7008250BF99B0095B21C /* TopNotificationModel.swift */; };
|
D20C7009250BF99B0095B21C /* TopNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C7008250BF99B0095B21C /* TopNotificationModel.swift */; };
|
||||||
D20C700B250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */; };
|
D20C700B250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */; };
|
||||||
|
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20F3B43252E00E4004B3F56 /* PageProtocol.swift */; };
|
||||||
|
D20F3B5E252F9B5E004B3F56 /* NavigationBarRefreshProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */; };
|
||||||
D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */; };
|
D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */; };
|
||||||
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
|
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
|
||||||
D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2169300251E51E7002A6324 /* SectionListTemplate.swift */; };
|
D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2169300251E51E7002A6324 /* SectionListTemplate.swift */; };
|
||||||
@ -809,6 +811,8 @@
|
|||||||
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
|
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
|
||||||
D20C7008250BF99B0095B21C /* TopNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopNotificationModel.swift; sourceTree = "<group>"; };
|
D20C7008250BF99B0095B21C /* TopNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopNotificationModel.swift; sourceTree = "<group>"; };
|
||||||
D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUITopAlertView+Extension.swift"; sourceTree = "<group>"; };
|
D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUITopAlertView+Extension.swift"; sourceTree = "<group>"; };
|
||||||
|
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageProtocol.swift; sourceTree = "<group>"; };
|
||||||
|
D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarRefreshProtocol.swift; sourceTree = "<group>"; };
|
||||||
D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItemModel.swift; sourceTree = "<group>"; };
|
D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItemModel.swift; sourceTree = "<group>"; };
|
||||||
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||||
D2169300251E51E7002A6324 /* SectionListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionListTemplate.swift; sourceTree = "<group>"; };
|
D2169300251E51E7002A6324 /* SectionListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionListTemplate.swift; sourceTree = "<group>"; };
|
||||||
@ -2101,8 +2105,10 @@
|
|||||||
children = (
|
children = (
|
||||||
012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */,
|
012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */,
|
||||||
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
|
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
|
||||||
|
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */,
|
||||||
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
||||||
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */,
|
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */,
|
||||||
|
D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */,
|
||||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||||
);
|
);
|
||||||
path = Protocols;
|
path = Protocols;
|
||||||
@ -2390,6 +2396,7 @@
|
|||||||
525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
|
525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
|
||||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
||||||
D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */,
|
D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */,
|
||||||
|
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */,
|
||||||
8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */,
|
8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */,
|
||||||
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
|
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
|
||||||
D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */,
|
D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */,
|
||||||
@ -2473,6 +2480,7 @@
|
|||||||
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */,
|
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */,
|
||||||
D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */,
|
D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */,
|
||||||
0A9D09222433796500D2E6C0 /* CarouselIndicator.swift in Sources */,
|
0A9D09222433796500D2E6C0 /* CarouselIndicator.swift in Sources */,
|
||||||
|
D20F3B5E252F9B5E004B3F56 /* NavigationBarRefreshProtocol.swift in Sources */,
|
||||||
D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */,
|
D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */,
|
||||||
D260105D23D0BCD400764D80 /* Stack.swift in Sources */,
|
D260105D23D0BCD400764D80 /* Stack.swift in Sources */,
|
||||||
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
||||||
|
|||||||
@ -35,12 +35,12 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience function for legacy classes
|
/// Convenience function for legacy classes
|
||||||
public func getMoleculeModelForJSON(_ json: [String: Any]) throws -> MoleculeModelProtocol? {
|
public func getMoleculeModelForJSON(_ json: [String: Any], delegateObject: DelegateObject? = nil) throws -> MoleculeModelProtocol? {
|
||||||
guard let moleculeName = json.optionalStringForKey(KeyMoleculeName),
|
guard let moleculeName = json.optionalStringForKey(KeyMoleculeName),
|
||||||
let type = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) else {
|
let type = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) else {
|
||||||
throw ModelRegistry.Error.decoderErrorModelNotMapped()
|
throw ModelRegistry.Error.decoderErrorModelNotMapped()
|
||||||
}
|
}
|
||||||
guard let model = try type.decode(jsonDict: json) as? MoleculeModelProtocol else {
|
guard let model = try type.decode(jsonDict: json, delegateObject: delegateObject) as? MoleculeModelProtocol else {
|
||||||
throw ModelRegistry.Error.decoderError
|
throw ModelRegistry.Error.decoderError
|
||||||
}
|
}
|
||||||
return model
|
return model
|
||||||
|
|||||||
@ -8,25 +8,25 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtocol {
|
open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtocol {
|
||||||
public class var identifier: String {
|
open class var identifier: String {
|
||||||
return "navigationBar"
|
return "navigationBar"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var title: String?
|
open var title: String?
|
||||||
public var hidden: Bool
|
open var hidden: Bool
|
||||||
public var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
public var tintColor: Color
|
open var tintColor: Color
|
||||||
public var line: LineModel?
|
open var line: LineModel?
|
||||||
public var hidesSystemBackButton = true
|
open var hidesSystemBackButton = true
|
||||||
|
|
||||||
/// If true, we add the button in the backButton property. If false we do not add the button. If nil, we add the button if the controller is not the bottom of the stack
|
/// If true, we add the button in the backButton property. If false we do not add the button. If nil, we add the button if the controller is not the bottom of the stack
|
||||||
public var alwaysShowBackButton: Bool?
|
open var alwaysShowBackButton: Bool?
|
||||||
public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)?
|
open var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)?
|
||||||
|
|
||||||
public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
open var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
open var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
public var titleView: MoleculeModelProtocol?
|
open var titleView: MoleculeModelProtocol?
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
hidden = false
|
hidden = false
|
||||||
@ -44,8 +44,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
|
|||||||
case line
|
case line
|
||||||
case alwaysShowBackButton
|
case alwaysShowBackButton
|
||||||
case backButton
|
case backButton
|
||||||
case showLeftPanelButton
|
|
||||||
case showRightPanelButton
|
|
||||||
case additionalLeftButtons
|
case additionalLeftButtons
|
||||||
case additionalRightButtons
|
case additionalRightButtons
|
||||||
case titleView
|
case titleView
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// NavigationBarRefreshProtocol.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 10/8/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A protocol to inform that we should refresh the navigation bar ui.
|
||||||
|
@objc public protocol NavigationBarRefreshProtocol {
|
||||||
|
@objc func refreshNavigationUI()
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UIViewController: NavigationBarRefreshProtocol {
|
||||||
|
|
||||||
|
/// Convenience function to refresh the navigation bar ui. A separate function for others to use.
|
||||||
|
@objc public static func refreshNavigationUI(for viewController: UIViewController) {
|
||||||
|
guard let model = (viewController as? PageProtocol)?.pageModel?.navigationBar else { return }
|
||||||
|
if let navigationController = viewController.navigationController {
|
||||||
|
NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: model, viewController: viewController)
|
||||||
|
MVMCoreUISplitViewController.setNavigationBarUI(for: viewController, navigationController: navigationController, navigationItemModel: model)
|
||||||
|
}
|
||||||
|
if let manager = ((viewController as? MVMCoreViewManagerViewControllerProtocol)?.manager as? NavigationBarRefreshProtocol) {
|
||||||
|
// Refresh the manager if possible.
|
||||||
|
manager.refreshNavigationUI()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func refreshNavigationUI() {
|
||||||
|
UIViewController.refreshNavigationUI(for: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
13
MVMCoreUI/Atomic/Protocols/PageProtocol.swift
Normal file
13
MVMCoreUI/Atomic/Protocols/PageProtocol.swift
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// PageProtocol.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 10/7/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol PageProtocol {
|
||||||
|
var pageModel: PageModelProtocol? { get set }
|
||||||
|
}
|
||||||
@ -23,7 +23,7 @@ public extension TemplateProtocol where Self: ViewController {
|
|||||||
let decoder = JSONDecoder()
|
let decoder = JSONDecoder()
|
||||||
try decoder.add(delegateObject: delegateObjectIVar)
|
try decoder.add(delegateObject: delegateObjectIVar)
|
||||||
self.templateModel = try decodeTemplate(using: decoder, from: data)
|
self.templateModel = try decodeTemplate(using: decoder, from: data)
|
||||||
self.pageModel = templateModel as? MVMControllerModelProtocol
|
self.model = templateModel as? MVMControllerModelProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel {
|
func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel {
|
||||||
|
|||||||
@ -8,15 +8,23 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, MVMCoreLoadDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate, MVMCoreUIDetailViewProtocol, PageProtocol {
|
||||||
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, MVMCoreLoadDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate, MVMCoreUIDetailViewProtocol {
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
@objc public var pageType: String?
|
@objc public var pageType: String?
|
||||||
@objc public var loadObject: MVMCoreLoadObject?
|
@objc public var loadObject: MVMCoreLoadObject?
|
||||||
public var pageModel: MVMControllerModelProtocol?
|
public var model: MVMControllerModelProtocol?
|
||||||
|
public var pageModel: PageModelProtocol? {
|
||||||
|
get {
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
model = newValue as? MVMControllerModelProtocol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Set if this page is containted in a manager.
|
/// Set if this page is containted in a manager.
|
||||||
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
|
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
|
||||||
@ -111,9 +119,15 @@ import UIKit
|
|||||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
self.handleNewDataAndUpdateUI()
|
self.handleNewDataAndUpdateUI()
|
||||||
|
|
||||||
// Update navigation bar if showing.
|
|
||||||
if MVMCoreUIUtility.getCurrentVisibleController() == self {
|
if MVMCoreUIUtility.getCurrentVisibleController() == self {
|
||||||
|
// Update navigation bar if showing.
|
||||||
self.setNavigationBar()
|
self.setNavigationBar()
|
||||||
|
self.manager?.refreshNavigationUI()
|
||||||
|
}
|
||||||
|
// Update splitview properties
|
||||||
|
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
||||||
|
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(self.bottomProgress() ?? 0)
|
||||||
|
self.updateTabBar()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
@ -127,7 +141,7 @@ import UIKit
|
|||||||
pageType = loadObject.pageType
|
pageType = loadObject.pageType
|
||||||
self.loadObject = loadObject
|
self.loadObject = loadObject
|
||||||
|
|
||||||
// Verifies all modules needed are loaded. TODO: change to ViewController
|
// Verifies all modules needed are loaded.
|
||||||
guard ViewController.verifyRequiredModulesLoaded(for: loadObject, error: error) else { return false }
|
guard ViewController.verifyRequiredModulesLoaded(for: loadObject, error: error) else { return false }
|
||||||
|
|
||||||
// Parse the model for the page.
|
// Parse the model for the page.
|
||||||
@ -214,18 +228,18 @@ import UIKit
|
|||||||
/// Creates a legacy navigation model.
|
/// Creates a legacy navigation model.
|
||||||
open func createDefaultLegacyNavigationModel() -> NavigationItemModel {
|
open func createDefaultLegacyNavigationModel() -> NavigationItemModel {
|
||||||
let navigationModel = NavigationItemModel()
|
let navigationModel = NavigationItemModel()
|
||||||
navigationModel.title = pageModel?.screenHeading
|
navigationModel.title = model?.screenHeading
|
||||||
return navigationModel
|
return navigationModel
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
|
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
|
||||||
open func handleNewData() {
|
open func handleNewData() {
|
||||||
if formValidator == nil {
|
if formValidator == nil {
|
||||||
let rules = pageModel?.formRules
|
let rules = model?.formRules
|
||||||
formValidator = FormValidator(rules)
|
formValidator = FormValidator(rules)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let backgroundColor = pageModel?.backgroundColor {
|
if let backgroundColor = model?.backgroundColor {
|
||||||
view.backgroundColor = backgroundColor.uiColor
|
view.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,16 +248,16 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Navigation Item (Move to model base)
|
// MARK: - Navigation Item
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func getNavigationModel() -> NavigationItemModelProtocol? {
|
open func getNavigationModel() -> NavigationItemModelProtocol? {
|
||||||
// TODO: remove legacy. Temporary, convert legacy to navigation model.
|
// TODO: remove legacy. Temporary, convert legacy to navigation model.
|
||||||
if pageModel?.navigationBar == nil {
|
if model?.navigationBar == nil {
|
||||||
let navigationItem = createDefaultLegacyNavigationModel()
|
let navigationItem = createDefaultLegacyNavigationModel()
|
||||||
pageModel?.navigationBar = navigationItem
|
model?.navigationBar = navigationItem
|
||||||
}
|
}
|
||||||
return pageModel?.navigationBar
|
return model?.navigationBar
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the navigation item for this view controller.
|
/// Sets the navigation item for this view controller.
|
||||||
@ -252,70 +266,22 @@ import UIKit
|
|||||||
let navigationController = navigationController
|
let navigationController = navigationController
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
// We additionally want our left items
|
|
||||||
navigationItem.leftItemsSupplementBackButton = true
|
|
||||||
|
|
||||||
// Utilize helper function to set the navigation item state.
|
// Utilize helper function to set the navigation item state.
|
||||||
NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self)
|
NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the appearance of the navigation bar based on the model.
|
/// Sets the appearance of the navigation bar based on the model.
|
||||||
open func setNavigationBar() {
|
open func setNavigationBar() {
|
||||||
let viewController = manager ?? self
|
|
||||||
guard let navigationItemModel = getNavigationModel(),
|
guard let navigationItemModel = getNavigationModel(),
|
||||||
let navigationController = viewController.navigationController else {
|
let navigationController = navigationController else {
|
||||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate()
|
MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utilize helper function to set the split view and navigation item state.
|
// Utilize helper function to set the split view and navigation item state.
|
||||||
MVMCoreUISplitViewController.setNavigationBarUI(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0)
|
MVMCoreUISplitViewController.setNavigationBarUI(for: self, navigationController: navigationController, navigationItemModel: navigationItemModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eventually will be moved to server
|
|
||||||
open func isMasterInitiallyAccessible() -> Bool {
|
|
||||||
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eventually will be moved to server
|
|
||||||
open func isSupportInitiallyAccessible() -> Bool {
|
|
||||||
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return (MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false) || showRightPanelForScreenBeforeLaunchApp()
|
|
||||||
}
|
|
||||||
|
|
||||||
open func showRightPanelForScreenBeforeLaunchApp() -> Bool {
|
|
||||||
return loadObject?.pageJSON?.lenientBoolForKey("showRightPanel") ?? false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eventually will be moved to separate button in navigation item model
|
|
||||||
open func isOverridingRightButton() -> Bool {
|
|
||||||
guard let rightPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("rightPanelButtonLink")
|
|
||||||
else { return false }
|
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: rightPanelLink, additionalData: nil, delegateObject: delegateObject())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eventually will be moved to separate button in navigation item model
|
|
||||||
open func isOverridingLeftButton() -> Bool {
|
|
||||||
guard let leftPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("leftPanelButtonLink")
|
|
||||||
else { return false }
|
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: leftPanelLink, additionalData: nil, delegateObject: delegateObject())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eventually will be moved to Model
|
|
||||||
open func bottomProgress() -> Float? {
|
|
||||||
guard let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
|
|
||||||
let progress = Float(progressString)
|
|
||||||
else { return nil }
|
|
||||||
|
|
||||||
return progress / Float(100)
|
|
||||||
}
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - TabBar
|
// MARK: - TabBar
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -324,7 +290,7 @@ import UIKit
|
|||||||
guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self else { return }
|
guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self else { return }
|
||||||
MVMCoreUISplitViewController.main()?.tabBar?.delegateObject = delegateObjectIVar
|
MVMCoreUISplitViewController.main()?.tabBar?.delegateObject = delegateObjectIVar
|
||||||
|
|
||||||
if let index = (pageModel as? TabPageModelProtocol)?.tabBarIndex {
|
if let index = (model as? TabPageModelProtocol)?.tabBarIndex {
|
||||||
MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index)
|
MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index)
|
||||||
} else if let index = loadObject?.requestParameters?.actionMap?["tabBarIndex"] as? Int {
|
} else if let index = loadObject?.requestParameters?.actionMap?["tabBarIndex"] as? Int {
|
||||||
MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index)
|
MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index)
|
||||||
@ -335,7 +301,7 @@ import UIKit
|
|||||||
self.tabBarIndex = index
|
self.tabBarIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
if let hidden = (pageModel as? TabPageModelProtocol)?.tabBarHidden {
|
if let hidden = (model as? TabPageModelProtocol)?.tabBarHidden {
|
||||||
MVMCoreUISplitViewController.main()?.updateTabBarShowing(!hidden)
|
MVMCoreUISplitViewController.main()?.updateTabBarShowing(!hidden)
|
||||||
} else if let hidden = loadObject?.requestParameters?.actionMap?["tabBarHidden"] as? Bool {
|
} else if let hidden = loadObject?.requestParameters?.actionMap?["tabBarHidden"] as? Bool {
|
||||||
MVMCoreUISplitViewController.main()?.updateTabBarShowing(!hidden)
|
MVMCoreUISplitViewController.main()?.updateTabBarShowing(!hidden)
|
||||||
@ -398,14 +364,15 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func pageShown() {
|
open func pageShown() {
|
||||||
// Update the navigation bar ui when view is appearing.
|
// Update split view properties if this is the current detail controller.
|
||||||
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
||||||
MVMCoreUISplitViewController.main()?.setupPanels()
|
MVMCoreUISplitViewController.main()?.setupPanels()
|
||||||
|
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(bottomProgress() ?? 0)
|
||||||
|
updateTabBar()
|
||||||
}
|
}
|
||||||
setNavigationBar()
|
|
||||||
|
|
||||||
// Update tab if needed.
|
// Update the navigation bar ui when view is appearing.
|
||||||
updateTabBar()
|
setNavigationBar()
|
||||||
|
|
||||||
// Track.
|
// Track.
|
||||||
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
||||||
@ -526,6 +493,51 @@ import UIKit
|
|||||||
setNavigationBar()
|
setNavigationBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func isLeftPanelAccessible() -> Bool {
|
||||||
|
// TODO: Remove when hamburger menu is fully phased out.
|
||||||
|
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isRightPanelAccessible() -> Bool {
|
||||||
|
// TODO: Remove when FAB is 100%.
|
||||||
|
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return (MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false) || showRightPanelForScreenBeforeLaunchApp()
|
||||||
|
}
|
||||||
|
|
||||||
|
open func showRightPanelForScreenBeforeLaunchApp() -> Bool {
|
||||||
|
return loadObject?.pageJSON?.lenientBoolForKey("showRightPanel") ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: make molecular
|
||||||
|
open func isOverridingRightButton() -> Bool {
|
||||||
|
guard let rightPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("rightPanelButtonLink")
|
||||||
|
else { return false }
|
||||||
|
MVMCoreActionHandler.shared()?.handleAction(with: rightPanelLink, additionalData: nil, delegateObject: delegateObject())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: make molecular
|
||||||
|
open func isOverridingLeftButton() -> Bool {
|
||||||
|
guard let leftPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("leftPanelButtonLink")
|
||||||
|
else { return false }
|
||||||
|
MVMCoreActionHandler.shared()?.handleAction(with: leftPanelLink, additionalData: nil, delegateObject: delegateObject())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eventually will be moved to Model
|
||||||
|
open func bottomProgress() -> Float? {
|
||||||
|
guard let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
|
||||||
|
let progress = Float(progressString)
|
||||||
|
else { return nil }
|
||||||
|
|
||||||
|
return progress / Float(100)
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - UITextFieldDelegate
|
// MARK: - UITextFieldDelegate
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -594,6 +606,6 @@ import UIKit
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func executeBehaviors<T>(_ behaviorBlock:(_ behavior:T)->Void) {
|
func executeBehaviors<T>(_ behaviorBlock:(_ behavior:T)->Void) {
|
||||||
pageModel?.behaviors?.compactMap({ $0 as? T }).forEach { behaviorBlock($0) }
|
model?.behaviors?.compactMap({ $0 as? T }).forEach { behaviorBlock($0) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,7 @@ import UIKit
|
|||||||
viewController.navigationItem.title = navigationItemModel.title
|
viewController.navigationItem.title = navigationItemModel.title
|
||||||
viewController.navigationItem.accessibilityLabel = navigationItemModel.title
|
viewController.navigationItem.accessibilityLabel = navigationItemModel.title
|
||||||
viewController.navigationItem.hidesBackButton = navigationItemModel.hidesSystemBackButton
|
viewController.navigationItem.hidesBackButton = navigationItemModel.hidesSystemBackButton
|
||||||
|
viewController.navigationItem.leftItemsSupplementBackButton = !navigationItemModel.hidesSystemBackButton
|
||||||
setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
setNavigationTitleView(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
setNavigationTitleView(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ import UIKit
|
|||||||
var leftItems: [UIBarButtonItem] = []
|
var leftItems: [UIBarButtonItem] = []
|
||||||
if navigationItemModel.alwaysShowBackButton != false {
|
if navigationItemModel.alwaysShowBackButton != false {
|
||||||
if let backButtonModel = navigationItemModel.backButton,
|
if let backButtonModel = navigationItemModel.backButton,
|
||||||
navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false {
|
MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 1 || navigationItemModel.alwaysShowBackButton ?? false {
|
||||||
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
|
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
|
||||||
}
|
}
|
||||||
if let leftItemModels = navigationItemModel.additionalLeftButtons {
|
if let leftItemModels = navigationItemModel.additionalLeftButtons {
|
||||||
@ -94,23 +95,7 @@ import UIKit
|
|||||||
navigationController.separatorView?.isHidden = navigationItemModel.line?.type ?? .standard == .none
|
navigationController.separatorView?.isHidden = navigationItemModel.line?.type ?? .standard == .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience setter for legacy files
|
|
||||||
public static func setNavigationItem(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws {
|
|
||||||
guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
|
||||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
|
||||||
}
|
|
||||||
setNavigationItem(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convenience setter for legacy files
|
|
||||||
public static func setNavigationBarUI(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws {
|
|
||||||
guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
|
||||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
|
||||||
}
|
|
||||||
setNavigationBarUI(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convenience function for setting the navigation titleView.
|
/// Convenience function for setting the navigation titleView.
|
||||||
public static func setNavigationTitleView(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
public static func setNavigationTitleView(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
||||||
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||||
|
|||||||
@ -15,6 +15,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@optional
|
@optional
|
||||||
|
|
||||||
|
/// Returns if the left panel should be accessible.
|
||||||
|
- (BOOL)isLeftPanelAccessible;
|
||||||
|
|
||||||
|
/// Returns if the right panel should be accessible.
|
||||||
|
- (BOOL)isRightPanelAccessible;
|
||||||
|
|
||||||
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)willOvertake;
|
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)willOvertake;
|
||||||
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
|
|||||||
@ -10,32 +10,29 @@ import Foundation
|
|||||||
|
|
||||||
public extension MVMCoreUISplitViewController {
|
public extension MVMCoreUISplitViewController {
|
||||||
|
|
||||||
/// Convenience function. Sets the navigation and split view properties for the view controller. Optional parameters use current value if not set.
|
/// Convenience function. Sets the navigation and split view properties for the view controller. Panel access is determined if view controller is a detail view protocol.
|
||||||
static func setNavigationBarUI(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
static func setNavigationBarUI(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
||||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
guard let splitView = MVMCoreUISplitViewController.main(),
|
||||||
navigationController == splitView.navigationController,
|
navigationController == splitView.navigationController,
|
||||||
navigationController.topViewController == viewController else {
|
navigationController.topViewController == viewController else {
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
/// Not the split view navigation controller, skip split functions.
|
||||||
return
|
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress)
|
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the navigation item for the view controller based on the model and splitview controller
|
/// Sets the navigation item for the view controller based on the model and splitview controller
|
||||||
private func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
private func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
|
|
||||||
setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
setLeftPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isLeftPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
||||||
setRightPanelIsAccessible(rightPanelAccessible ?? rightPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
setRightPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isRightPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
||||||
|
|
||||||
setLeftNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
setLeftNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
setRightNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
setRightNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
|
|
||||||
setNavigationIconColor(navigationItemModel.tintColor.uiColor)
|
setNavigationIconColor(navigationItemModel.tintColor.uiColor)
|
||||||
|
|
||||||
if let progress = progress {
|
|
||||||
setBottomProgressBarProgress(progress)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the left navigation items for the view controller based on model and splitview.
|
/// Sets the left navigation items for the view controller based on model and splitview.
|
||||||
@ -48,7 +45,7 @@ public extension MVMCoreUISplitViewController {
|
|||||||
if let forceBackButton = navigationItemModel?.alwaysShowBackButton {
|
if let forceBackButton = navigationItemModel?.alwaysShowBackButton {
|
||||||
showBackButton = forceBackButton
|
showBackButton = forceBackButton
|
||||||
} else {
|
} else {
|
||||||
showBackButton = navigationController.viewControllers.count > 1
|
showBackButton = MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 1
|
||||||
}
|
}
|
||||||
if showBackButton {
|
if showBackButton {
|
||||||
if let backButtonModel = navigationItemModel?.backButton {
|
if let backButtonModel = navigationItemModel?.backButton {
|
||||||
@ -107,20 +104,4 @@ public extension MVMCoreUISplitViewController {
|
|||||||
|
|
||||||
viewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
|
viewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Legacy Functions
|
|
||||||
/// Convenience setter for legacy files. Sets the navigation item for the view controller based on the json and splitview controller
|
|
||||||
@objc static func setNavigationBarUI(for viewController: UIViewController, navigationController: UINavigationController, navigationJSON: [String: Any], leftPanelAccessible: Bool, rightPanelAccessible: Bool, progress: NSNumber?) throws {
|
|
||||||
guard let navigationItemModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
|
||||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
|
||||||
}
|
|
||||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
|
||||||
navigationController == splitView.navigationController,
|
|
||||||
navigationController.topViewController == viewController else {
|
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let progress = progress?.floatValue
|
|
||||||
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -241,7 +241,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
|
|
||||||
- (void)setLeftNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
- (void)setLeftNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
||||||
NSMutableArray *leftBarButtonItems = [NSMutableArray array];
|
NSMutableArray *leftBarButtonItems = [NSMutableArray array];
|
||||||
if ([viewController.navigationController.viewControllers count] > 1) {
|
if (viewController.navigationController && [MVMCoreNavigationHandler.sharedNavigationHandler getViewControllersForNavigationController:viewController.navigationController].count > 1) {
|
||||||
[leftBarButtonItems addObject:self.backButton];
|
[leftBarButtonItems addObject:self.backButton];
|
||||||
}
|
}
|
||||||
if ((accessible && !extended) && self.leftPanelButton) {
|
if ((accessible && !extended) && self.leftPanelButton) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user