Merge branch 'develop' into feature/Headers_H1_NoButtons
This commit is contained in:
commit
40fcfaee26
@ -22,6 +22,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case image
|
case image
|
||||||
case action
|
case action
|
||||||
|
case moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
@ -33,6 +34,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ public class NavigationLabelButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case moleculeName
|
||||||
case title
|
case title
|
||||||
case action
|
case action
|
||||||
}
|
}
|
||||||
@ -33,6 +34,7 @@ public class NavigationLabelButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,7 +243,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.setSplitViewController(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0)
|
MVMCoreUISplitViewController.setNavigationBarUI(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eventually will be moved to server
|
// Eventually will be moved to server
|
||||||
@ -355,6 +355,9 @@ import UIKit
|
|||||||
|
|
||||||
open func pageShown() {
|
open func pageShown() {
|
||||||
// Update the navigation bar ui when view is appearing.
|
// Update the navigation bar ui when view is appearing.
|
||||||
|
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
||||||
|
MVMCoreUISplitViewController.main()?.setupPanels()
|
||||||
|
}
|
||||||
setNavigationBar()
|
setNavigationBar()
|
||||||
|
|
||||||
// Update tab if needed.
|
// Update tab if needed.
|
||||||
|
|||||||
@ -11,7 +11,7 @@ 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. Optional parameters use current value if not set.
|
||||||
static func setSplitViewController(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, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
||||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
guard let splitView = MVMCoreUISplitViewController.main(),
|
||||||
navigationController == splitView.navigationController,
|
navigationController == splitView.navigationController,
|
||||||
navigationController.topViewController == viewController else {
|
navigationController.topViewController == viewController else {
|
||||||
@ -22,11 +22,7 @@ public extension MVMCoreUISplitViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
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, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
||||||
|
|
||||||
// Setup the panels.
|
|
||||||
setupPanels()
|
|
||||||
|
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||||
|
|
||||||
setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
||||||
@ -110,7 +106,7 @@ public extension MVMCoreUISplitViewController {
|
|||||||
|
|
||||||
// MARK: - Legacy Functions
|
// MARK: - Legacy Functions
|
||||||
/// Convenience setter for legacy files. Sets the navigation item for the view controller based on the json and splitview controller
|
/// Convenience setter for legacy files. Sets the navigation item for the view controller based on the json and splitview controller
|
||||||
@objc static func setSplitViewController(for viewController: UIViewController, navigationController: UINavigationController, navigationJSON: [String: Any], leftPanelAccessible: Bool, rightPanelAccessible: Bool, progress: NSNumber?) throws {
|
@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 {
|
guard let navigationItemModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
||||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,13 @@ import MVMCore
|
|||||||
groupWatchers.append(action)
|
groupWatchers.append(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Removes the form field to the validator.
|
||||||
|
public func remove(_ field: FormFieldProtocol) {
|
||||||
|
if let fieldKey = field.fieldKey {
|
||||||
|
fields.removeValue(forKey: fieldKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Determines the type of item and adds it.
|
/// Determines the type of item and adds it.
|
||||||
private func insert(_ item: FormItemProtocol) {
|
private func insert(_ item: FormItemProtocol) {
|
||||||
if let item = item as? FormFieldProtocol {
|
if let item = item as? FormFieldProtocol {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user