Add SignedOutNode, to handle session behind deleted from outside (no support for soft-logout)
This commit is contained in:
committed by
Benoit Marty
parent
124d6bf95f
commit
266f93cc28
+4
-1
@@ -18,5 +18,8 @@ package io.element.android.libraries.sessionstorage.api
|
||||
|
||||
sealed interface LoggedInState {
|
||||
data object NotLoggedIn : LoggedInState
|
||||
data class LoggedIn(val isTokenValid: Boolean) : LoggedInState
|
||||
data class LoggedIn(
|
||||
val sessionId: String,
|
||||
val isTokenValid: Boolean,
|
||||
) : LoggedInState
|
||||
}
|
||||
|
||||
+4
-1
@@ -32,7 +32,10 @@ class InMemorySessionStore : SessionStore {
|
||||
if (it == null) {
|
||||
LoggedInState.NotLoggedIn
|
||||
} else {
|
||||
LoggedInState.LoggedIn(it.isTokenValid)
|
||||
LoggedInState.LoggedIn(
|
||||
sessionId = it.userId,
|
||||
isTokenValid = it.isTokenValid,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -44,7 +44,10 @@ class DatabaseSessionStore @Inject constructor(
|
||||
if (it == null) {
|
||||
LoggedInState.NotLoggedIn
|
||||
} else {
|
||||
LoggedInState.LoggedIn((it.isTokenValid ?: 1) == 1L)
|
||||
LoggedInState.LoggedIn(
|
||||
sessionId = it.userId,
|
||||
isTokenValid = (it.isTokenValid ?: 1) == 1L
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user