added isEqual
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
f6f3cd53fe
commit
81076da249
@ -93,6 +93,17 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
|
|||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return iconPosition == model.iconPosition
|
||||||
|
&& title == model.title
|
||||||
|
&& action.isEqual(to: model.action)
|
||||||
|
&& accessibilityText == model.accessibilityText
|
||||||
|
&& accessibilityIdentifier == model.accessibilityIdentifier
|
||||||
|
&& enabled == model.enabled
|
||||||
|
&& inverted == model.inverted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension CaretLinkModel {
|
extension CaretLinkModel {
|
||||||
|
|||||||
@ -107,5 +107,26 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
|
|||||||
try container.encodeIfPresent(hideBorder, forKey: .hideBorder)
|
try container.encodeIfPresent(hideBorder, forKey: .hideBorder)
|
||||||
try container.encodeIfPresent(width, forKey: .width)
|
try container.encodeIfPresent(width, forKey: .width)
|
||||||
try container.encodeIfPresent(height, forKey: .height)
|
try container.encodeIfPresent(height, forKey: .height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& accessibilityText == model.accessibilityText
|
||||||
|
&& number == model.number
|
||||||
|
&& fillColor == model.fillColor
|
||||||
|
&& borderColorLight == model.borderColorLight
|
||||||
|
&& borderColorDark == model.borderColorDark
|
||||||
|
&& kind == model.kind
|
||||||
|
&& maximumDigits == model.maximumDigits
|
||||||
|
&& size == model.size
|
||||||
|
&& leadingCharacter == model.leadingCharacter
|
||||||
|
&& trailingText == model.trailingText
|
||||||
|
&& dotSize == model.dotSize
|
||||||
|
&& verticalPadding == model.verticalPadding
|
||||||
|
&& hideDot == model.hideDot
|
||||||
|
&& hideBorder == model.hideBorder
|
||||||
|
&& width == model.width
|
||||||
|
&& height == model.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,4 +147,26 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
try container.encodeIfPresent(selectable, forKey: .selectable)
|
try container.encodeIfPresent(selectable, forKey: .selectable)
|
||||||
try container.encodeIfPresent(iconOffset, forKey: .iconOffset)
|
try container.encodeIfPresent(iconOffset, forKey: .iconOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& accessibilityText == model.accessibilityText
|
||||||
|
&& badgeIndicator == model.badgeIndicator
|
||||||
|
&& expandDirection == model.expandDirection
|
||||||
|
&& kind == model.kind
|
||||||
|
&& surfaceType == model.surfaceType
|
||||||
|
&& iconName == model.iconName
|
||||||
|
&& selectedIconName == model.selectedIconName
|
||||||
|
&& size == model.size
|
||||||
|
&& customContainerSize == model.customContainerSize
|
||||||
|
&& customIconSize == model.customIconSize
|
||||||
|
&& customBadgeIndicatorOffSet == model.customBadgeIndicatorOffSet
|
||||||
|
&& floating == model.floating
|
||||||
|
&& fitToIcon == model.fitToIcon
|
||||||
|
&& hideBorder == model.hideBorder
|
||||||
|
&& showBadgeIndicator == model.showBadgeIndicator
|
||||||
|
&& selectable == model.selectable
|
||||||
|
&& iconOffset == model.iconOffset
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,4 +35,12 @@ open class IconModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
/// A custom size of the icon.
|
/// A custom size of the icon.
|
||||||
public var customSize: Int?
|
public var customSize: Int?
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return color == model.color
|
||||||
|
&& size == model.size
|
||||||
|
&& surface == model.surface
|
||||||
|
&& customSize == model.customSize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,6 +68,12 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
try container.encodeIfPresent(diameter, forKey: .diameter)
|
try container.encodeIfPresent(diameter, forKey: .diameter)
|
||||||
try container.encodeIfPresent(inverted, forKey: .inverted)
|
try container.encodeIfPresent(inverted, forKey: .inverted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return diameter == model.diameter
|
||||||
|
&& inverted == model.inverted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LoadingSpinnerModel {
|
extension LoadingSpinnerModel {
|
||||||
|
|||||||
@ -49,6 +49,21 @@ open class TileContainerModel: TileContainerBaseModel<TileContainer.Padding, Til
|
|||||||
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
||||||
try super.encode(to: encoder)
|
try super.encode(to: encoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return backgroundImage == model.backgroundImage
|
||||||
|
&& action.isEqual(to: model.action)
|
||||||
|
&& imageFallbackColor == model.imageFallbackColor
|
||||||
|
&& width == model.width
|
||||||
|
&& height == model.height
|
||||||
|
&& showBorder == model.showBorder
|
||||||
|
&& showDropShadow == model.showDropShadow
|
||||||
|
&& padding.value == model.padding.value
|
||||||
|
&& color == model.color
|
||||||
|
&& aspectRatio == model.aspectRatio
|
||||||
|
&& backgroundEffect == model.backgroundEffect
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -161,4 +161,32 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
|||||||
try container.encodeIfPresent(textPercentage, forKey: .textPercentage)
|
try container.encodeIfPresent(textPercentage, forKey: .textPercentage)
|
||||||
try super.encode(to: encoder)
|
try super.encode(to: encoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return backgroundImage == model.backgroundImage
|
||||||
|
&& action.isEqual(to: model.action)
|
||||||
|
&& imageFallbackColor == model.imageFallbackColor
|
||||||
|
&& width == model.width
|
||||||
|
&& height == model.height
|
||||||
|
&& showBorder == model.showBorder
|
||||||
|
&& showDropShadow == model.showDropShadow
|
||||||
|
&& padding.value == model.padding.value
|
||||||
|
&& color == model.color
|
||||||
|
&& aspectRatio == model.aspectRatio
|
||||||
|
&& backgroundEffect == model.backgroundEffect
|
||||||
|
|
||||||
|
&& badge == model.badge
|
||||||
|
&& eyebrow == model.eyebrow
|
||||||
|
&& eyebrowColor == model.eyebrowColor
|
||||||
|
&& title == model.title
|
||||||
|
&& titleColor == model.titleColor
|
||||||
|
&& subTitle == model.subTitle
|
||||||
|
&& subTitleColor == model.subTitleColor
|
||||||
|
&& descriptiveIcon == model.descriptiveIcon
|
||||||
|
&& directionalIcon == model.directionalIcon
|
||||||
|
&& textWidth == model.textWidth
|
||||||
|
&& textPercentage == model.textPercentage
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,6 +95,16 @@ open class TooltipModel: MoleculeModelProtocol {
|
|||||||
try container.encodeModelIfPresent(molecule, forKey: .contentView)
|
try container.encodeModelIfPresent(molecule, forKey: .contentView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return surface == model.surface
|
||||||
|
&& size == model.size
|
||||||
|
&& fillColor == model.fillColor
|
||||||
|
&& closeButtonText == model.closeButtonText
|
||||||
|
&& title == model.title
|
||||||
|
&& content == model.content
|
||||||
|
&& molecule == model.molecule
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TooltipModel {
|
extension TooltipModel {
|
||||||
|
|||||||
@ -181,7 +181,11 @@ open class TabItemModel: Codable, Equatable, MoleculeModelComparisonProtocol {
|
|||||||
|
|
||||||
public static func == (lhs: TabItemModel, rhs: TabItemModel) -> Bool {
|
public static func == (lhs: TabItemModel, rhs: TabItemModel) -> Bool {
|
||||||
return lhs.label.isEqual(to: rhs.label)
|
return lhs.label.isEqual(to: rhs.label)
|
||||||
&& lhs.action.isEqual(to: rhs.action)
|
}
|
||||||
|
|
||||||
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return self == model
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
|
public func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDS
|
import VDS
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
@objcMembers open class TwoButtonView: VDS.View, VDSMoleculeViewProtocol {
|
@objcMembers open class TwoButtonView: VDS.View, VDSMoleculeViewProtocol {
|
||||||
|
|
||||||
@ -97,4 +98,5 @@ import VDS
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func updateView(_ size: CGFloat) {}
|
public func updateView(_ size: CGFloat) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,4 +47,11 @@ public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
|||||||
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
||||||
try container.encodeIfPresent(leftLink, forKey: .leftLink)
|
try container.encodeIfPresent(leftLink, forKey: .leftLink)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return rightLink == model.rightLink
|
||||||
|
&& leftLink == model.leftLink
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,6 +112,17 @@ open class NotificationMoleculeModel: MoleculeModelProtocol {
|
|||||||
try container.encodeIfPresent(inverted, forKey: .inverted)
|
try container.encodeIfPresent(inverted, forKey: .inverted)
|
||||||
try container.encode(style, forKey: .style)
|
try container.encode(style, forKey: .style)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return accessibilityIdentifier == model.accessibilityIdentifier
|
||||||
|
&& headline == model.headline
|
||||||
|
&& body == model.body
|
||||||
|
&& button == model.button
|
||||||
|
&& secondaryButton == model.secondaryButton
|
||||||
|
&& inverted == model.inverted
|
||||||
|
&& style == model.style
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NotificationMoleculeModel {
|
extension NotificationMoleculeModel {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user