Compare commits

...

2 Commits

Author SHA1 Message Date
Matt Bruce
ef7fa4a693 Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui.git into feature/atomic-vds-isEqual
# Conflicts:
#	MVMCoreUI/Atomic/Atoms/Views/IconModel.swift

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-08-26 14:54:47 -05:00
Matt Bruce
81076da249 added isEqual
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-08-26 13:20:11 -05:00
12 changed files with 148 additions and 2 deletions

View File

@ -93,6 +93,17 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
try container.encode(enabled, forKey: .enabled)
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 {

View File

@ -107,5 +107,26 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
try container.encodeIfPresent(hideBorder, forKey: .hideBorder)
try container.encodeIfPresent(width, forKey: .width)
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
}
}

View File

@ -147,4 +147,26 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
try container.encodeIfPresent(selectable, forKey: .selectable)
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
}
}

View File

@ -37,4 +37,13 @@ open class IconModel: MoleculeModelProtocol {
public var customSize: Int?
public var isAccessibilityElement: Bool?
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
&& isAccessibilityElement == model.isAccessibilityElement
}
}

View File

@ -68,6 +68,12 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
try container.encodeIfPresent(diameter, forKey: .diameter)
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 {

View File

@ -49,6 +49,21 @@ open class TileContainerModel: TileContainerBaseModel<TileContainer.Padding, Til
try container.encodeModelIfPresent(molecule, forKey: .molecule)
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
}
}

View File

@ -161,4 +161,32 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
try container.encodeIfPresent(textPercentage, forKey: .textPercentage)
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
}
}

View File

@ -95,6 +95,16 @@ open class TooltipModel: MoleculeModelProtocol {
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 {

View File

@ -181,7 +181,11 @@ open class TabItemModel: Codable, Equatable, MoleculeModelComparisonProtocol {
public static func == (lhs: TabItemModel, rhs: TabItemModel) -> Bool {
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 {

View File

@ -8,6 +8,7 @@
import UIKit
import VDS
import MVMCore
@objcMembers open class TwoButtonView: VDS.View, VDSMoleculeViewProtocol {
@ -97,4 +98,5 @@ import VDS
//--------------------------------------------------
public func updateView(_ size: CGFloat) {}
}

View File

@ -47,4 +47,11 @@ public class TwoLinkViewModel: ParentMoleculeModelProtocol {
try container.encodeIfPresent(rightLink, forKey: .rightLink)
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
}
}

View File

@ -112,6 +112,17 @@ open class NotificationMoleculeModel: MoleculeModelProtocol {
try container.encodeIfPresent(inverted, forKey: .inverted)
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 {