Apply same call history workaround for missed calls count

This commit is contained in:
Sylvain Berfini 2025-03-28 09:33:29 +01:00
parent 07387d3537
commit ee00a2b04b

View file

@ -269,7 +269,13 @@ open class AbstractMainViewModel
@WorkerThread
fun updateMissedCallsCount() {
val account = LinphoneUtils.getDefaultAccount()
val count = account?.missedCallsCount ?: coreContext.core.missedCallsCount
// Fetch all call logs if only one account to workaround no history issue
// TODO FIXME: remove workaround later
val count = if (coreContext.core.accountList.size > 1) {
account?.missedCallsCount ?: coreContext.core.missedCallsCount
} else {
coreContext.core.missedCallsCount
}
val moreThanOne = count > 1
Log.i(
"$TAG There ${if (moreThanOne) "are" else "is"} [$count] missed ${if (moreThanOne) "calls" else "call"}"
@ -292,7 +298,13 @@ open class AbstractMainViewModel
fun resetMissedCallsCount() {
coreContext.postOnCoreThread { core ->
val account = LinphoneUtils.getDefaultAccount()
account?.resetMissedCallsCount() ?: core.resetMissedCallsCount()
// Fetch all call logs if only one account to workaround no history issue
// TODO FIXME: remove workaround later
if (coreContext.core.accountList.size > 1) {
account?.resetMissedCallsCount() ?: core.resetMissedCallsCount()
} else {
core.resetMissedCallsCount()
}
updateMissedCallsCount()
}
}