AccountRemovalWork: remove cached owncloudClient after removing account

Otherwise, the account (which is identified by account name only) will reuse old token, if login is done right after account removal.

Three hours of debugging for one line of code

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-03-23 18:22:11 +01:00
parent 23a72722d3
commit 95046c4b5d
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -58,7 +58,6 @@ import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.PushUtils
import org.greenrobot.eventbus.EventBus
import java.io.File
import java.util.ArrayList
/**
* Removes account and all local files
@ -150,6 +149,9 @@ class AccountRemovalWork(
deleteAppPasswordRemoteOperation.execute(optionNextcloudClient.get())
}
// delete cached OwncloudClient
OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(user.toOwnCloudAccount())
if (userRemoved) {
eventBus.post(AccountRemovedEvent())
}