Merge branch 'develop' into feature/Headers_H1_NoButtons

This commit is contained in:
Subhankar Acharya 2020-07-16 20:55:32 +05:30
commit 40fcfaee26
5 changed files with 18 additions and 8 deletions

View File

@ -22,6 +22,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
private enum CodingKeys: String, CodingKey {
case image
case action
case moleculeName
}
required public init(from decoder: Decoder) throws {
@ -33,6 +34,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
open func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(image, forKey: .image)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeModel(action, forKey: .action)
}

View File

@ -21,6 +21,7 @@ public class NavigationLabelButtonModel: NavigationButtonModelProtocol, Molecule
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case title
case action
}
@ -33,6 +34,7 @@ public class NavigationLabelButtonModel: NavigationButtonModelProtocol, Molecule
open func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(title, forKey: .title)
try container.encodeModel(action, forKey: .action)
}

View File

@ -243,7 +243,7 @@ import UIKit
}
// 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
@ -355,6 +355,9 @@ import UIKit
open func pageShown() {
// Update the navigation bar ui when view is appearing.
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
MVMCoreUISplitViewController.main()?.setupPanels()
}
setNavigationBar()
// Update tab if needed.

View File

@ -11,7 +11,7 @@ import Foundation
public extension MVMCoreUISplitViewController {
/// 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(),
navigationController == splitView.navigationController,
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
func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
// Setup the panels.
setupPanels()
private func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false)
@ -110,7 +106,7 @@ public extension MVMCoreUISplitViewController {
// 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 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 {
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
}

View File

@ -46,6 +46,13 @@ import MVMCore
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.
private func insert(_ item: FormItemProtocol) {
if let item = item as? FormFieldProtocol {