1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-21 23:54:26 +00:00

Handle Matrix session providing

This commit is contained in:
Steffo 2023-11-19 18:04:32 +01:00
parent bf0130f096
commit 373fcc2f6b
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -9,8 +9,10 @@ import eu.steffo.twom.R
import org.matrix.android.sdk.api.Matrix
import org.matrix.android.sdk.api.MatrixConfiguration
import org.matrix.android.sdk.api.provider.RoomDisplayNameFallbackProvider
import org.matrix.android.sdk.api.session.Session
val LocalMatrix = compositionLocalOf<Matrix?> { null }
val LocalSession = compositionLocalOf<Session?> { null }
@Composable
fun TwoMMatrixProvider(
@ -24,7 +26,13 @@ fun TwoMMatrixProvider(
)
)
CompositionLocalProvider(LocalMatrix provides matrix) {
// TODO: The session should be opened somewhere, I think.
val session = matrix.authenticationService().getLastAuthenticatedSession()
CompositionLocalProvider(
LocalMatrix provides matrix,
LocalSession provides session,
) {
content()
}
}