Pre-display the list of calls list after 20 items

This commit is contained in:
Sylvain Berfini 2023-10-03 15:35:01 +02:00
parent 57094d6cce
commit ada4e786ec
2 changed files with 10 additions and 3 deletions

View file

@ -154,7 +154,7 @@ class ContactsManager @UiThread constructor(context: Context) {
clonedAddress.clean()
val sipUri = clonedAddress.asStringUriOnly()
Log.i("$TAG Looking for friend with address [$sipUri]")
Log.d("$TAG Looking for friend with address [$sipUri]")
val username = clonedAddress.username
val found = coreContext.core.findFriend(clonedAddress)
return found ?: if (!username.isNullOrEmpty() && username.startsWith("+")) {
@ -204,7 +204,7 @@ class ContactsManager @UiThread constructor(context: Context) {
Manifest.permission.READ_CONTACTS
) == PackageManager.PERMISSION_GRANTED
) {
Log.i(
Log.d(
"$TAG Looking for native contact with address [$address] ${if (searchAsPhoneNumber) "or phone number [$number]" else ""}"
)
@ -277,7 +277,7 @@ class ContactsManager @UiThread constructor(context: Context) {
friend.done()
Log.i("$TAG Found native contact [${friend.name}] with address [$address]")
Log.d("$TAG Found native contact [${friend.name}] with address [$address]")
cursor.close()
return friend
}

View file

@ -114,6 +114,7 @@ class HistoryListViewModel @UiThread constructor() : AbstractTopBarViewModel() {
}
val list = arrayListOf<CallLogModel>()
var count = 0
// TODO? : Add support for call logs in magic search
val account = LinphoneUtils.getDefaultAccount()
@ -122,6 +123,12 @@ class HistoryListViewModel @UiThread constructor() : AbstractTopBarViewModel() {
if (callLog.remoteAddress.asStringUriOnly().contains(filter)) {
val model = CallLogModel(callLog)
list.add(model)
count += 1
}
if (count == 20) {
callLogs.postValue(list)
fetchInProgress.postValue(false)
}
}