mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Fixed call history list filter not using resolved contact name
This commit is contained in:
parent
da385ee6e1
commit
00a7d34509
1 changed files with 10 additions and 2 deletions
|
|
@ -144,8 +144,8 @@ class HistoryListViewModel
|
|||
val account = LinphoneUtils.getDefaultAccount()
|
||||
val logs = account?.callLogs ?: coreContext.core.callLogs
|
||||
for (callLog in logs) {
|
||||
if (callLog.remoteAddress.asStringUriOnly().contains(filter)) {
|
||||
val model = CallLogModel(callLog)
|
||||
val model = CallLogModel(callLog)
|
||||
if (isCallLogMatchingFilter(model, filter)) {
|
||||
list.add(model)
|
||||
count += 1
|
||||
}
|
||||
|
|
@ -158,4 +158,12 @@ class HistoryListViewModel
|
|||
Log.i("$TAG Fetched [${list.size}] call log(s)")
|
||||
callLogs.postValue(list)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun isCallLogMatchingFilter(model: CallLogModel, filter: String): Boolean {
|
||||
if (filter.isEmpty()) return true
|
||||
|
||||
val friendName = model.avatarModel.friend.name ?: LinphoneUtils.getDisplayName(model.address)
|
||||
return friendName.contains(filter, ignoreCase = true) || model.address.asStringUriOnly().contains(filter, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue