Merge branch 'feature/molecule_replacement_header_fix' into 'feature/molecule_replacement_behavior'
minor cleanup Co-authored-by: vimal <vimal.murugan@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1043
This commit is contained in:
commit
e14b9fdffe
@ -203,17 +203,12 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
|
|
||||||
open func newData(for molecule: MoleculeModelProtocol) {
|
open func newData(for molecule: MoleculeModelProtocol) {
|
||||||
|
|
||||||
//Update the header
|
//Check header and footer if replace happens then return.
|
||||||
if updateHeaderFooter(modelView: topView, molecule: molecule) {
|
if updateMoleculeViewById(topView, with: molecule) ||
|
||||||
|
updateMoleculeViewById(bottomView, with: molecule) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the footer
|
|
||||||
if updateHeaderFooter(modelView: bottomView, molecule: molecule) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: expand for navigation, etc
|
|
||||||
guard let moleculesInfo = moleculesInfo else { return }
|
guard let moleculesInfo = moleculesInfo else { return }
|
||||||
|
|
||||||
let indicies = moleculesInfo.indices.filter({ index -> Bool in
|
let indicies = moleculesInfo.indices.filter({ index -> Bool in
|
||||||
@ -233,10 +228,10 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Helper functions to update the header/footer view
|
///Helper functions to update view with molecule
|
||||||
private func updateHeaderFooter(modelView: UIView?, molecule: MoleculeModelProtocol) -> Bool {
|
private func updateMoleculeViewById(_ view: UIView?, with molecule: MoleculeModelProtocol) -> Bool {
|
||||||
if let updateView = modelView,
|
if let updateView = view,
|
||||||
let moleculeView = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [updateView]).first(where: { $0.model?.moleculeName == molecule.moleculeName && $0.model?.id == molecule.id }) {
|
let moleculeView = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [updateView]).first(where: { $0.model?.moleculeName == molecule.moleculeName && $0.model?.id == molecule.id }) {
|
||||||
updateMoleculeView(moleculeView, from: molecule)
|
updateMoleculeView(moleculeView, from: molecule)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user