Fix CategoryListModel equals/hashcode
This commit is contained in:
@@ -40,7 +40,10 @@ class CategoriesAdapter(
|
||||
newItem: CategoryListModel,
|
||||
): Any? = when {
|
||||
oldItem is CategoryListModel.All && newItem is CategoryListModel.All -> Unit
|
||||
else -> super.getChangePayload(oldItem, newItem)
|
||||
oldItem is CategoryListModel.CategoryItem &&
|
||||
newItem is CategoryListModel.CategoryItem &&
|
||||
oldItem.category.title != newItem.category.title -> null
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ sealed interface CategoryListModel : ListModel {
|
||||
if (category.id != other.category.id) return false
|
||||
if (category.title != other.category.title) return false
|
||||
if (category.order != other.category.order) return false
|
||||
if (category.isTrackingEnabled != other.category.isTrackingEnabled) return false
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -53,6 +54,7 @@ sealed interface CategoryListModel : ListModel {
|
||||
var result = category.id.hashCode()
|
||||
result = 31 * result + category.title.hashCode()
|
||||
result = 31 * result + category.order.hashCode()
|
||||
result = 31 * result + category.isTrackingEnabled.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user