mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Try to centralise session restoration through MatrixClientsHolder
This commit is contained in:
@@ -145,14 +145,10 @@ class RootFlowNode @AssistedInject constructor(
|
||||
onFailure: () -> Unit = {},
|
||||
onSuccess: (SessionId) -> Unit = {},
|
||||
) {
|
||||
// If the session is already known it'll be restored by the node hierarchy
|
||||
if (matrixClientsHolder.knowSession(sessionId)) {
|
||||
Timber.v("Session $sessionId already alive, no need to restore.")
|
||||
return
|
||||
runCatching {
|
||||
matrixClientsHolder.requireSession(sessionId)
|
||||
}
|
||||
authenticationService.restoreSession(sessionId)
|
||||
.onSuccess { matrixClient ->
|
||||
matrixClientsHolder.add(matrixClient)
|
||||
.onSuccess {
|
||||
Timber.v("Succeed to restore session $sessionId")
|
||||
onSuccess(sessionId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user