Merge branch 'develop' into feature/fga/media_upload_progress
This commit is contained in:
commit
f5baa4a3a7
194 changed files with 397 additions and 408 deletions
|
|
@ -58,9 +58,9 @@ interface MatrixRoom : Closeable {
|
|||
*/
|
||||
suspend fun updateMembers(): Result<Unit>
|
||||
|
||||
fun syncUpdateFlow(): Flow<Long>
|
||||
val syncUpdateFlow: StateFlow<Long>
|
||||
|
||||
fun timeline(): MatrixTimeline
|
||||
val timeline: MatrixTimeline
|
||||
|
||||
fun open(): Result<Unit>
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ import org.matrix.rustcomponents.sdk.RoomVisibility as RustRoomVisibility
|
|||
class RustMatrixClient constructor(
|
||||
private val client: Client,
|
||||
private val sessionStore: SessionStore,
|
||||
private val appCoroutineScope: CoroutineScope,
|
||||
appCoroutineScope: CoroutineScope,
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
private val baseDirectory: File,
|
||||
private val baseCacheDirectory: File,
|
||||
baseCacheDirectory: File,
|
||||
private val clock: SystemClock,
|
||||
) : MatrixClient {
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import kotlinx.coroutines.cancel
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -71,15 +72,10 @@ class RustMatrixRoom(
|
|||
override val roomId = RoomId(innerRoom.id())
|
||||
|
||||
private val roomCoroutineScope = sessionCoroutineScope.childScope(coroutineDispatchers.main, "RoomScope-$roomId")
|
||||
|
||||
override val membersStateFlow: StateFlow<MatrixRoomMembersState>
|
||||
get() = _membersStateFlow
|
||||
|
||||
private var _membersStateFlow = MutableStateFlow<MatrixRoomMembersState>(MatrixRoomMembersState.Unknown)
|
||||
private val _membersStateFlow = MutableStateFlow<MatrixRoomMembersState>(MatrixRoomMembersState.Unknown)
|
||||
private val isInit = MutableStateFlow(false)
|
||||
private val syncUpdateFlow = MutableStateFlow(systemClock.epochMillis())
|
||||
|
||||
private val timeline by lazy {
|
||||
private val _syncUpdateFlow = MutableStateFlow(0L)
|
||||
private val _timeline by lazy {
|
||||
RustMatrixTimeline(
|
||||
matrixRoom = this,
|
||||
innerRoom = innerRoom,
|
||||
|
|
@ -88,13 +84,11 @@ class RustMatrixRoom(
|
|||
)
|
||||
}
|
||||
|
||||
override fun syncUpdateFlow(): Flow<Long> {
|
||||
return syncUpdateFlow
|
||||
}
|
||||
override val membersStateFlow: StateFlow<MatrixRoomMembersState> = _membersStateFlow.asStateFlow()
|
||||
|
||||
override fun timeline(): MatrixTimeline {
|
||||
return timeline
|
||||
}
|
||||
override val syncUpdateFlow: StateFlow<Long> = _syncUpdateFlow.asStateFlow()
|
||||
|
||||
override val timeline: MatrixTimeline = _timeline
|
||||
|
||||
override fun open(): Result<Unit> {
|
||||
if (isInit.value) return Result.failure(IllegalStateException("Listener already registered"))
|
||||
|
|
@ -110,10 +104,10 @@ class RustMatrixRoom(
|
|||
roomListItem.subscribe(settings)
|
||||
roomCoroutineScope.launch(coroutineDispatchers.computation) {
|
||||
innerRoom.timelineDiffFlow { initialList ->
|
||||
timeline.postItems(initialList)
|
||||
_timeline.postItems(initialList)
|
||||
}.onEach {
|
||||
syncUpdateFlow.value = systemClock.epochMillis()
|
||||
timeline.postDiff(it)
|
||||
_syncUpdateFlow.value = systemClock.epochMillis()
|
||||
_timeline.postDiff(it)
|
||||
}.launchIn(this)
|
||||
fetchMembers()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,8 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
|
|||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.libraries.matrix.test.timeline.FakeMatrixTimeline
|
||||
import io.element.android.tests.testutils.simulateLongTask
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import java.io.File
|
||||
|
||||
class FakeMatrixRoom(
|
||||
|
|
@ -126,13 +125,9 @@ class FakeMatrixRoom(
|
|||
updateMembersResult
|
||||
}
|
||||
|
||||
override fun syncUpdateFlow(): Flow<Long> {
|
||||
return emptyFlow()
|
||||
}
|
||||
override val syncUpdateFlow: StateFlow<Long> = MutableStateFlow(0L)
|
||||
|
||||
override fun timeline(): MatrixTimeline {
|
||||
return matrixTimeline
|
||||
}
|
||||
override val timeline: MatrixTimeline = matrixTimeline
|
||||
|
||||
override fun open(): Result<Unit> {
|
||||
return Result.success(Unit)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ internal val materialColorSchemeLight = lightColorScheme(
|
|||
onBackground = LightDesignTokens.colorGray1400,
|
||||
surface = LightDesignTokens.colorThemeBg,
|
||||
onSurface = LightDesignTokens.colorGray1400,
|
||||
surfaceVariant = LightDesignTokens.colorGray400,
|
||||
onSurfaceVariant = LightDesignTokens.colorGray1400,
|
||||
surfaceVariant = LightDesignTokens.colorGray300,
|
||||
onSurfaceVariant = LightDesignTokens.colorGray900,
|
||||
surfaceTint = LightDesignTokens.colorGray1000,
|
||||
inverseSurface = LightDesignTokens.colorGray1300,
|
||||
inverseOnSurface = LightDesignTokens.colorThemeBg,
|
||||
|
|
@ -75,8 +75,8 @@ internal val materialColorSchemeDark = darkColorScheme(
|
|||
onBackground = DarkDesignTokens.colorGray1400,
|
||||
surface = DarkDesignTokens.colorThemeBg,
|
||||
onSurface = DarkDesignTokens.colorGray1400,
|
||||
surfaceVariant = DarkDesignTokens.colorGray400,
|
||||
onSurfaceVariant = DarkDesignTokens.colorGray1400,
|
||||
surfaceVariant = DarkDesignTokens.colorGray300,
|
||||
onSurfaceVariant = DarkDesignTokens.colorGray900,
|
||||
surfaceTint = DarkDesignTokens.colorGray1000,
|
||||
inverseSurface = DarkDesignTokens.colorGray1300,
|
||||
inverseOnSurface = DarkDesignTokens.colorThemeBg,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue