Digital PCT265 story PCT-135: Pager fix. TwoButtonViewModel isEqual.
This commit is contained in:
parent
32deda3d3d
commit
cd5d9b0c4a
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user