diff --git a/app/src/main/java/at/bitfire/davdroid/MailAccountSyncHelper.kt b/app/src/main/java/at/bitfire/davdroid/MailAccountSyncHelper.kt index 39ebc1fb7100d8ae4735339aec04297cb1f42be7..07675e657ce8d0a72945aafd146c1ef80be2c20c 100644 --- a/app/src/main/java/at/bitfire/davdroid/MailAccountSyncHelper.kt +++ b/app/src/main/java/at/bitfire/davdroid/MailAccountSyncHelper.kt @@ -33,18 +33,6 @@ object MailAccountSyncHelper { applicationContext?.sendBroadcast(intent) } - fun onAccountLoggedOut(applicationContext: Context?, email: String?) { - email?.let { - if (!it.contains("@")) { - return@let - } - val intent = getIntent() - intent.action = ACTION_PREFIX + "remove" - intent.putExtra("account", it) - applicationContext?.sendBroadcast(intent) - } - } - private fun getIntent() : Intent { val intent = Intent() intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES) diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.kt b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.kt index 526ad2c4df7da0d18a6769f40acf12c5968e426d..71ae525184f9c7eee62763b2a5a1e2a80b969e7c 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.kt +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.kt @@ -8,8 +8,6 @@ import android.accounts.AccountManager import android.content.* import android.os.Build import android.os.Bundle -import android.os.Handler -import android.os.Looper import android.os.RemoteException import android.provider.ContactsContract import android.provider.ContactsContract.CommonDataKinds.GroupMembership @@ -26,7 +24,6 @@ import at.bitfire.davdroid.settings.AccountSettings import at.bitfire.davdroid.syncadapter.AccountUtils import at.bitfire.davdroid.syncadapter.SyncUtils import at.bitfire.vcard4android.* -import at.bitfire.davdroid.MailAccountSyncHelper import java.io.ByteArrayOutputStream import java.util.* @@ -255,34 +252,13 @@ open class LocalAddressBook( } private fun removeAccountForOlderSdk(accountManager: AccountManager, email: String?) { - accountManager.removeAccount(account, { - try { - if (it.result) { - Handler(Looper.getMainLooper()).post { - MailAccountSyncHelper.onAccountLoggedOut(context.applicationContext, email) - } - } - } catch (e: Exception) { - Logger.log.log(Level.SEVERE, "Couldn't remove account", e) - } - }, null) + accountManager.removeAccount(account, null, null) } private fun removeAccount(accountManager: AccountManager, email: String?) { - accountManager.removeAccount(account, null, { - try { - if (it.result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) { - Handler(Looper.getMainLooper()).post { - MailAccountSyncHelper.onAccountLoggedOut(context.applicationContext, email) - } - } - } catch (e: Exception) { - Logger.log.log(Level.SEVERE, "Couldn't remove account", e) - } - }, null) + accountManager.removeAccount(account, null, null, null) } - /** * Updates the sync framework settings for this address book: * diff --git a/app/src/main/java/at/bitfire/davdroid/ui/account/AccountActivity.kt b/app/src/main/java/at/bitfire/davdroid/ui/account/AccountActivity.kt index e5522d85a430403c3eb83d99660f13a06cd5370f..ac29735e73f57bdb709bf21822cc18e7c2bbb9fc 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/account/AccountActivity.kt +++ b/app/src/main/java/at/bitfire/davdroid/ui/account/AccountActivity.kt @@ -38,7 +38,6 @@ import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.launch -import at.bitfire.davdroid.MailAccountSyncHelper import java.util.logging.Level import javax.inject.Inject @@ -140,7 +139,6 @@ class AccountActivity: AppCompatActivity() { try { if (future.result) Handler(Looper.getMainLooper()).post { - MailAccountSyncHelper.onAccountLoggedOut(applicationContext, email) finish() } } catch (e: Exception) { @@ -154,7 +152,6 @@ class AccountActivity: AppCompatActivity() { try { if (future.result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) Handler(Looper.getMainLooper()).post { - MailAccountSyncHelper.onAccountLoggedOut(applicationContext, email) finish() } } catch (e: Exception) {