Digital PCT265 story PCT-135: Pager fix. TwoButtonViewModel isEqual.

This commit is contained in:
Hedden, Kyle Matthew 2024-05-14 20:30:11 -04:00
parent 32deda3d3d
commit cd5d9b0c4a
2 changed files with 18 additions and 1 deletions

View File

@ -86,4 +86,20 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
try container.encodeIfPresent(secondaryButton, forKey: .secondaryButton)
try container.encodeIfPresent(fillContainer, forKey: .fillContainer)
}
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return backgroundColor == model.backgroundColor
&& fillContainer == model.fillContainer
&& primaryButton.isEqual(to: model.primaryButton)
&& secondaryButton.isEqual(to: model.secondaryButton)
}
public func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return backgroundColor == model.backgroundColor
&& fillContainer == model.fillContainer
&& primaryButton.isVisuallyEquivalent(to: model.primaryButton)
&& secondaryButton.isVisuallyEquivalent(to: model.secondaryButton)
}
}

View File

@ -178,7 +178,8 @@ open class Carousel: View {
// Prevents a carousel reset while still updating the cell backing data through reconfigureItems.
MVMCoreLoggingHandler.shared()?.handleDebugMessage("[\(Self.self)] Model is visually equivalent. Skipping rebuild...")
FormValidator.setupValidation(for: carouselModel, delegate: delegateObject?.formHolderDelegate)
pagingView?.currentIndex = originalModel.index // Trigger a paging view render.
updateModelIndex() // Ensure the new model indexing matches the old.
pagingView?.currentIndex = pageIndex // Trigger a paging view render.
collectionView.reconfigureItems(at: collectionView.indexPathsForVisibleItems)
return
}