Merge branch 'bugfix/missing_model_register' into 'develop'

update to match documentation

See merge request BPHV_MIPS/mvm_core_ui!467
This commit is contained in:
Pan, Xinlei (Ryan) 2020-05-27 17:43:30 -04:00
commit 27295c940e
3 changed files with 8 additions and 8 deletions

View File

@ -13,5 +13,5 @@ public protocol PageModelProtocol {
/// Temporary: for legacy response /// Temporary: for legacy response
var screenHeading: String? { get set } var screenHeading: String? { get set }
var backgroundColor: Color? { get set } var backgroundColor: Color? { get set }
var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)? { get set } var navigationBar: (NavigationItemModelProtocol & MoleculeModelProtocol)? { get set }
} }

View File

@ -26,7 +26,7 @@ import Foundation
public var backgroundColor: Color? public var backgroundColor: Color?
public var screenHeading: String? public var screenHeading: String?
public var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)? public var navigationBar: (NavigationItemModelProtocol & MoleculeModelProtocol)?
public var formRules: [FormGroupRule]? public var formRules: [FormGroupRule]?
public var behaviors: [PageBehaviorProtocol]? public var behaviors: [PageBehaviorProtocol]?
@ -49,7 +49,7 @@ import Foundation
case backgroundColor case backgroundColor
case formRules case formRules
case behaviors case behaviors
case navigationItem case navigationBar
} }
//-------------------------------------------------- //--------------------------------------------------
@ -63,7 +63,7 @@ import Foundation
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules)
behaviors = try typeContainer.decodeModelsIfPresent(codingKey: .behaviors) behaviors = try typeContainer.decodeModelsIfPresent(codingKey: .behaviors)
navigationItem = try typeContainer.decodeModelIfPresent(codingKey: .navigationItem) navigationBar = try typeContainer.decodeModelIfPresent(codingKey: .navigationBar)
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
@ -73,6 +73,6 @@ import Foundation
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeIfPresent(screenHeading, forKey: .screenHeading)
try container.encodeIfPresent(formRules, forKey: .formRules) try container.encodeIfPresent(formRules, forKey: .formRules)
try container.encodeModelIfPresent(navigationItem, forKey: .navigationItem) try container.encodeModelIfPresent(navigationBar, forKey: .navigationBar)
} }
} }

View File

@ -172,9 +172,9 @@ import UIKit
/// 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() {
// TODO: remove legacy. Temporary, convert legacy to navigation model. // TODO: remove legacy. Temporary, convert legacy to navigation model.
if pageModel?.navigationItem == nil { if pageModel?.navigationBar == nil {
let navigationItem = createDefaultLegacyNavigationModel() let navigationItem = createDefaultLegacyNavigationModel()
pageModel?.navigationItem = navigationItem pageModel?.navigationBar = navigationItem
} }
if formValidator == nil { if formValidator == nil {
@ -190,7 +190,7 @@ import UIKit
// MARK: - Navigation Item (Move to model base) // MARK: - Navigation Item (Move to model base)
open func setNavigationController() { open func setNavigationController() {
let viewController = manager ?? self let viewController = manager ?? self
guard let navigationItemModel = pageModel?.navigationItem, guard let navigationItemModel = pageModel?.navigationBar,
let navigationController = viewController.navigationController else { let navigationController = viewController.navigationController else {
MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate() MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate()
return return