Fixed call history list filter not using resolved contact name

This commit is contained in:
Sylvain Berfini 2025-02-03 16:33:11 +01:00
parent da385ee6e1
commit 00a7d34509

View file

@ -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)
}
}