Clear all account's blocking related records when account is deleted

This commit is contained in:
Juha Heinanen
2026-08-01 15:43:54 +03:00
parent b68808fd27
commit 25fb9fbcd9
3 changed files with 9 additions and 0 deletions

View File

@ -159,6 +159,8 @@ fun AccountsContent(contentPadding: PaddingValues, navController: NavController)
lastAction.value = {
CallHistoryNew.clear(aor)
Message.clearMessagesOfAor(aor)
Blocked.clear(aor)
BlockRule.clear(aor)
ua.remove()
Api.ua_destroy(ua.uap)
Account.saveAccounts()

View File

@ -870,6 +870,8 @@ class BaresipService: Service() {
Log.d(TAG, "Removing Mobile account on API < 29")
CallHistoryNew.clear(ua.account.aor)
Message.clearMessagesOfAor(ua.account.aor)
Blocked.clear(ua.account.aor)
BlockRule.clear(ua.account.aor)
Api.ua_destroy(uap)
Account.saveAccounts()
return

View File

@ -23,6 +23,11 @@ class BlockRule(
return BaresipService.blockRules.any { it.aor == aor && it.pattern == pattern }
}
fun clear(aor: String) {
BaresipService.blockRules.removeAll { it.aor == aor }
save()
}
fun save() {
Log.d(TAG, "Saving ${BaresipService.blockRules.size} block rules")
val file = File(BaresipService.filesPath + "/blocking")