added isEqual to base model
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
86d49053a6
commit
961a0546a8
@ -34,7 +34,6 @@ import Foundation
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case backgroundColor
|
||||
case title
|
||||
case feedback
|
||||
case errorTextColor
|
||||
@ -86,7 +85,6 @@ import Foundation
|
||||
required public init(from decoder: Decoder) throws {
|
||||
try super.init(from: decoder)
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
|
||||
errorTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .errorTextColor)
|
||||
@ -106,7 +104,6 @@ import Foundation
|
||||
open override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(title, forKey: .title)
|
||||
try container.encodeIfPresent(feedback, forKey: .feedback)
|
||||
try container.encodeIfPresent(text, forKey: .text)
|
||||
@ -116,4 +113,28 @@ import Foundation
|
||||
try container.encode(hideBorders, forKey: .hideBorders)
|
||||
try container.encode(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
||||
}
|
||||
|
||||
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||
guard super.isEqual(to: model), let model = model as? Self else { return false }
|
||||
return selected == model.selected
|
||||
&& title == model.title
|
||||
&& feedback == model.feedback
|
||||
&& errorTextColor == model.errorTextColor
|
||||
&& locked == model.locked
|
||||
&& hideBorders == model.hideBorders
|
||||
&& text == model.text
|
||||
&& shouldMaskRecordedView == model.shouldMaskRecordedView
|
||||
}
|
||||
|
||||
open override func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
|
||||
guard super.isVisuallyEquivalent(to: model), let model = model as? Self else { return false }
|
||||
return selected == model.selected
|
||||
&& title == model.title
|
||||
&& feedback == model.feedback
|
||||
&& errorTextColor == model.errorTextColor
|
||||
&& locked == model.locked
|
||||
&& hideBorders == model.hideBorders
|
||||
&& text == model.text
|
||||
&& shouldMaskRecordedView == model.shouldMaskRecordedView
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user