mirror of
https://github.com/nextcloud/talk-android
synced 2025-02-02 04:32:02 +00:00
avoid falsely shown "Account scheduled for deletion" info
...by setting the correct context.
In removeCurrentAccount
the
WorkManager.getInstance(this) (introduced with commit 943286dd
)
must be
WorkManager.getInstance(applicationContext)
because otherwise the worker is dropped when the activity is finished and might not do it's work beforehand (race condition?).
This results in users that keep the
scheduledForDeletion = true
so the next time someone tries to login with this user,
userManager.checkIfUserIsScheduledForDeletion(loginData.username!!, baseUrl!!).blockingGet()
in WebViewLoginController#parseAndLoginFromWebView
is true and
ApplicationWideMessageHolder.getInstance().messageType
is set to
ApplicationWideMessageHolder.MessageType.ACCOUNT_SCHEDULED_FOR_DELETION
which results in the "The account is scheduled for deletion, and cannot be changed" message in ServerSelectionController.
This is just a guess and i was not able to reproduce it.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
2260f2816b
commit
ba8df45bc7
@ -471,7 +471,7 @@ class SettingsActivity : BaseActivity() {
|
||||
private fun removeCurrentAccount() {
|
||||
val otherUserExists = userManager.scheduleUserForDeletionWithId(currentUser!!.id!!).blockingGet()
|
||||
val accountRemovalWork = OneTimeWorkRequest.Builder(AccountRemovalWorker::class.java).build()
|
||||
WorkManager.getInstance(this).enqueue(accountRemovalWork)
|
||||
WorkManager.getInstance(applicationContext).enqueue(accountRemovalWork)
|
||||
if (otherUserExists) {
|
||||
// TODO: find better solution once Conductor is removed
|
||||
finish()
|
||||
|
Loading…
Reference in New Issue
Block a user