Try to centralise session restoration through MatrixClientsHolder
This commit is contained in:
parent
d69dea6608
commit
ded1518f0b
5 changed files with 36 additions and 21 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue