chore: add WearException EventData equal and hash

This commit is contained in:
Andries Smit 2022-07-13 22:39:31 +02:00
parent 5eec69d863
commit 7e61c54c97

View file

@ -35,7 +35,18 @@ sealed class EventData : Event() {
val model: String, val model: String,
val manufacturer: String, val manufacturer: String,
val product: String val product: String
) : EventData() ) : EventData() {
override fun equals(other: Any?): Boolean =
when (other) {
!is WearException -> false
else -> timeStamp == other.timeStamp && fingerprint == other.fingerprint
}
override fun hashCode(): Int {
return Objects.hash(timeStamp, fingerprint)
}
}
@Serializable @Serializable
data class Error(val timeStamp: Long) : EventData() // ignored data class Error(val timeStamp: Long) : EventData() // ignored
@ -146,9 +157,9 @@ sealed class EventData : Event() {
override fun equals(other: Any?): Boolean = override fun equals(other: Any?): Boolean =
when { when {
other !is SingleBg -> false other !is SingleBg -> false
color != other.color -> false color != other.color -> false
else -> timeStamp == other.timeStamp else -> timeStamp == other.timeStamp
} }
override fun hashCode(): Int { override fun hashCode(): Int {