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 f266342786
commit 8b35f2bab5
2 changed files with 11 additions and 6 deletions

View file

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

View file

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