From 373fcc2f6b30e84797d14138623471cead729665 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 19 Nov 2023 18:04:32 +0100 Subject: [PATCH] Handle Matrix session providing --- .../eu/steffo/twom/ui/scaffold/TwoMMatrixProvider.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/steffo/twom/ui/scaffold/TwoMMatrixProvider.kt b/app/src/main/java/eu/steffo/twom/ui/scaffold/TwoMMatrixProvider.kt index a0ac117..b07e98b 100644 --- a/app/src/main/java/eu/steffo/twom/ui/scaffold/TwoMMatrixProvider.kt +++ b/app/src/main/java/eu/steffo/twom/ui/scaffold/TwoMMatrixProvider.kt @@ -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 { null } +val LocalSession = compositionLocalOf { 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() } }