Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

fix CheeseViewModel insertSeparators comparison #994

Merged
merged 2 commits into from
May 21, 2021
Merged

Conversation

claraf3
Copy link
Collaborator

@claraf3 claraf3 commented May 21, 2021

Fix insertSeparator in CheeseViewModel to cast alphabet to lower case when comparing 'before' and 'after' values.

@@ -78,7 +78,8 @@ class CheeseViewModel(private val dao: CheeseDao) : ViewModel() {
} else if (before == null) {
// Header
CheeseListItem.Separator(after.name.first())
} else if (before.name.first() != after.name.first()) {
} else if (before.name.first().toLowerCase() !=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify this to .equals(ignoreCase = true)?

See: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/equals.html#equals

@dlam dlam merged commit 5d284bf into android:main May 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants