If signout request fails, do not start LoginActivity, but restart the app (#3099)

This commit is contained in:
Benoit Marty 2021-04-07 14:52:27 +02:00
parent 1ac17b3aee
commit 835eb95aa1
2 changed files with 4 additions and 2 deletions

View File

@ -24,6 +24,7 @@ Bugfix 🐛:
- Disable URL preview for some domains (#2995)
- Fix avatar rendering for DMs, after initial sync (#2693)
- Fix mandatory parameter in API (#3065)
- If signout request fails, do not start LoginActivity, but restart the app (#3099)
Translations 🗣:
-

View File

@ -212,15 +212,16 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
.setTitle(R.string.dialog_title_error)
.setMessage(errorFormatter.toHumanReadable(failure))
.setPositiveButton(R.string.global_retry) { _, _ -> doCleanUp() }
.setNegativeButton(R.string.cancel) { _, _ -> startNextActivityAndFinish() }
.setNegativeButton(R.string.cancel) { _, _ -> startNextActivityAndFinish(ignoreClearCredentials = true) }
.setCancelable(false)
.show()
}
}
private fun startNextActivityAndFinish() {
private fun startNextActivityAndFinish(ignoreClearCredentials: Boolean = false) {
val intent = when {
args.clearCredentials
&& !ignoreClearCredentials
&& (!args.isUserLoggedOut || args.isAccountDeactivated) ->
// User has explicitly asked to log out or deactivated his account
LoginActivity.newIntent(this, null)