mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved conversations list computing when filter is empty
This commit is contained in:
parent
7fec6cbb75
commit
b919f51ecb
1 changed files with 24 additions and 14 deletions
|
|
@ -152,23 +152,33 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod
|
|||
}
|
||||
}
|
||||
|
||||
val participants = chatRoom.participants
|
||||
val found = participants.find {
|
||||
// Search in address but also in contact name if exists
|
||||
val model = coreContext.contactsManager.getContactAvatarModelForAddress(it.address)
|
||||
model.contactName?.contains(filter, ignoreCase = true) == true || it.address.asStringUriOnly().contains(
|
||||
filter,
|
||||
ignoreCase = true
|
||||
)
|
||||
}
|
||||
if (
|
||||
found != null ||
|
||||
chatRoom.peerAddress.asStringUriOnly().contains(filter, ignoreCase = true) ||
|
||||
chatRoom.subject.orEmpty().contains(filter, ignoreCase = true)
|
||||
) {
|
||||
if (filter.isEmpty()) {
|
||||
val model = ConversationModel(chatRoom)
|
||||
list.add(model)
|
||||
count += 1
|
||||
} else {
|
||||
val participants = chatRoom.participants
|
||||
val found = participants.find {
|
||||
// Search in address but also in contact name if exists
|
||||
val model =
|
||||
coreContext.contactsManager.getContactAvatarModelForAddress(it.address)
|
||||
model.contactName?.contains(
|
||||
filter,
|
||||
ignoreCase = true
|
||||
) == true || it.address.asStringUriOnly().contains(
|
||||
filter,
|
||||
ignoreCase = true
|
||||
)
|
||||
}
|
||||
if (
|
||||
found != null ||
|
||||
chatRoom.peerAddress.asStringUriOnly().contains(filter, ignoreCase = true) ||
|
||||
chatRoom.subject.orEmpty().contains(filter, ignoreCase = true)
|
||||
) {
|
||||
val model = ConversationModel(chatRoom)
|
||||
list.add(model)
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 20) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue