mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 02:45:53 +03:00
Make the code a bit easier to understand (no change)
This commit is contained in:
parent
73e93e7d3d
commit
2df9b43abc
2 changed files with 12 additions and 5 deletions
|
@ -14,6 +14,7 @@ Bugfix 🐛:
|
||||||
- VoIP : fix audio devices output
|
- VoIP : fix audio devices output
|
||||||
- Fix crash after initial sync on Dendrite
|
- Fix crash after initial sync on Dendrite
|
||||||
- Fix crash reported by PlayStore (#2707)
|
- Fix crash reported by PlayStore (#2707)
|
||||||
|
- Fix crash when deactivating an account
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -45,10 +45,11 @@ internal class DefaultDeactivateAccountTask @Inject constructor(
|
||||||
override suspend fun execute(params: DeactivateAccountTask.Params) {
|
override suspend fun execute(params: DeactivateAccountTask.Params) {
|
||||||
val deactivateAccountParams = DeactivateAccountParams.create(params.userAuthParam, params.eraseAllData)
|
val deactivateAccountParams = DeactivateAccountParams.create(params.userAuthParam, params.eraseAllData)
|
||||||
|
|
||||||
try {
|
val canCleanup = try {
|
||||||
executeRequest<Unit>(globalErrorReceiver) {
|
executeRequest<Unit>(globalErrorReceiver) {
|
||||||
apiCall = accountAPI.deactivate(deactivateAccountParams)
|
apiCall = accountAPI.deactivate(deactivateAccountParams)
|
||||||
}
|
}
|
||||||
|
true
|
||||||
} catch (throwable: Throwable) {
|
} catch (throwable: Throwable) {
|
||||||
if (!handleUIA(
|
if (!handleUIA(
|
||||||
failure = throwable,
|
failure = throwable,
|
||||||
|
@ -60,12 +61,17 @@ internal class DefaultDeactivateAccountTask @Inject constructor(
|
||||||
) {
|
) {
|
||||||
Timber.d("## UIA: propagate failure")
|
Timber.d("## UIA: propagate failure")
|
||||||
throw throwable
|
throw throwable
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Logout from identity server if any, ignoring errors
|
|
||||||
runCatching { identityDisconnectTask.execute(Unit) }
|
|
||||||
.onFailure { Timber.w(it, "Unable to disconnect identity server") }
|
|
||||||
|
|
||||||
cleanupSession.handle()
|
if (canCleanup) {
|
||||||
|
// Logout from identity server if any, ignoring errors
|
||||||
|
runCatching { identityDisconnectTask.execute(Unit) }
|
||||||
|
.onFailure { Timber.w(it, "Unable to disconnect identity server") }
|
||||||
|
|
||||||
|
cleanupSession.handle()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue