Clear all account's blocking related records when account is deleted
This commit is contained in:
@ -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()
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
Reference in New Issue
Block a user