Fixed remove all call logs when workaround is active

This commit is contained in:
Sylvain Berfini 2025-03-22 13:33:57 +01:00
parent 2aed404167
commit 6121cb41bf
2 changed files with 11 additions and 6 deletions

View file

@ -106,13 +106,16 @@ class HistoryListViewModel
@UiThread
fun removeAllCallLogs() {
coreContext.postOnCoreThread { core ->
val account = LinphoneUtils.getDefaultAccount()
if (account != null) {
account.clearCallLogs()
} else {
for (callLog in core.callLogs) {
core.removeCallLog(callLog)
// TODO FIXME: remove workaround later
if (coreContext.core.accountList.size > 1) {
val account = LinphoneUtils.getDefaultAccount()
if (account != null) {
account.clearCallLogs()
} else {
core.clearCallLogs()
}
} else {
core.clearCallLogs()
}
historyDeletedEvent.postValue(Event(true))
@ -143,6 +146,7 @@ class HistoryListViewModel
val account = LinphoneUtils.getDefaultAccount()
// Fetch all call logs if only one account to workaround no history issue
// TODO FIXME: remove workaround later
val logs = if (coreContext.core.accountList.size > 1) {
account?.callLogs ?: coreContext.core.callLogs
} else {

View file

@ -331,6 +331,7 @@ class HistoryViewModel
}
// Required when "unique account displays all call logs from Core" workaround
// TODO FIXME: remove workaround later
if (list.isEmpty()) {
for (log in coreContext.core.callLogs) {
if (log.remoteAddress.weakEqual(address)) {