mirror of
https://github.com/Steffo99/twom.git
synced 2025-02-16 16:23:57 +00:00
Handle Matrix session providing
This commit is contained in:
parent
bf0130f096
commit
373fcc2f6b
1 changed files with 9 additions and 1 deletions
|
@ -9,8 +9,10 @@ import eu.steffo.twom.R
|
||||||
import org.matrix.android.sdk.api.Matrix
|
import org.matrix.android.sdk.api.Matrix
|
||||||
import org.matrix.android.sdk.api.MatrixConfiguration
|
import org.matrix.android.sdk.api.MatrixConfiguration
|
||||||
import org.matrix.android.sdk.api.provider.RoomDisplayNameFallbackProvider
|
import org.matrix.android.sdk.api.provider.RoomDisplayNameFallbackProvider
|
||||||
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
|
||||||
val LocalMatrix = compositionLocalOf<Matrix?> { null }
|
val LocalMatrix = compositionLocalOf<Matrix?> { null }
|
||||||
|
val LocalSession = compositionLocalOf<Session?> { null }
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TwoMMatrixProvider(
|
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()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue