Skip to content

Commit

Permalink
avoid falsely shown "Account scheduled for deletion" info
Browse files Browse the repository at this point in the history
...by setting the correct context.

In removeCurrentAccount
the

WorkManager.getInstance(this) (introduced with commit 943286d)

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 <[email protected]>
  • Loading branch information
mahibi committed Aug 22, 2023
1 parent d7fe5d4 commit b5672e1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b5672e1

Please sign in to comment.