Skip to content

Commit

Permalink
AccountRepository: directly delete accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Sep 17, 2024
1 parent 5c31a8a commit 866cdf0
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,11 @@ class AccountRepository @Inject constructor(

suspend fun delete(accountName: String): Boolean {
val account = fromName(accountName)
// remove account
val future = accountManager.removeAccount(account, null, null, null)
// remove account directly (bypassing the authenticator, which is our own)
return try {
// wait for operation to complete
withContext(Dispatchers.Default) {
// blocks calling thread
future.result
}
accountManager.removeAccountExplicitly(account)

// delete address book accounts
// delete address books (= address book accounts)
serviceRepository.getByAccountAndType(accountName, Service.TYPE_CARDDAV)?.let { service ->
collectionRepository.getByService(service.id).forEach { collection ->
LocalAddressBook.deleteByCollection(context, collection.id)
Expand Down

0 comments on commit 866cdf0

Please sign in to comment.