Skip to content

Commit

Permalink
Merge pull request #1889 from Infomaniak/mutable-parameter
Browse files Browse the repository at this point in the history
Remove mutable parameter.
  • Loading branch information
KevinBoulongne committed Jun 4, 2024
2 parents 16cd037 + 5fa2e68 commit df00f52
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ContactAdapter(
) : Adapter<ContactViewHolder>() {

private var allContacts: List<MergedContact> = emptyList()
private var matchedContacts = mutableListOf<MatchedContact>()
private var matchedContacts = listOf<MatchedContact>()

private var displayAddUnknownContactButton = true
private var searchQuery = ""
Expand Down Expand Up @@ -99,12 +99,13 @@ class ContactAdapter(
}

fun clear() {
matchedContacts.clear()
matchedContacts = listOf()
notifyDataSetChanged()
}

fun searchContacts(text: CharSequence) {
fun performFiltering(constraint: CharSequence): MutableList<MatchedContact> {

fun performFiltering(constraint: CharSequence): List<MatchedContact> {
val searchTerm = constraint.standardize()

val finalUserList = mutableListOf<MatchedContact>()
Expand All @@ -126,13 +127,9 @@ class ContactAdapter(
return finalUserList
}

fun publishResults(results: MutableList<MatchedContact>) {
matchedContacts = results
notifyDataSetChanged()
}

searchQuery = text.toString()
publishResults(performFiltering(text))
matchedContacts = performFiltering(text)
notifyDataSetChanged()
}

fun removeUsedEmail(email: String): Boolean {
Expand Down

0 comments on commit df00f52

Please sign in to comment.