deps(sdk): fix api usages

This commit is contained in:
ganfra
2025-11-19 13:07:59 +01:00
parent d1d2e5f9fc
commit f5d450e68b
11 changed files with 18 additions and 6 deletions

View File

@@ -58,5 +58,7 @@ private fun previewPermissions(): RoomPowerLevelsValues {
roomName = RoomMember.Role.Admin.powerLevel,
roomAvatar = RoomMember.Role.Moderator.powerLevel,
roomTopic = RoomMember.Role.User.powerLevel,
// SpaceManagement section
spaceChild = RoomMember.Role.Moderator.powerLevel,
)
}

View File

@@ -154,7 +154,7 @@ class StateContentFormatter(
"RoomHistoryVisibility"
}
}
OtherState.RoomJoinRules -> when (renderingMode) {
is OtherState.RoomJoinRules -> when (renderingMode) {
RenderingMode.RoomList -> {
Timber.v("Filtering timeline item for room state change: $content")
null

View File

@@ -22,6 +22,7 @@ data class RoomPowerLevelsValues(
val roomName: Long,
val roomAvatar: Long,
val roomTopic: Long,
val spaceChild: Long,
)
/**

View File

@@ -9,6 +9,7 @@
package io.element.android.libraries.matrix.api.timeline.item.event
import androidx.compose.runtime.Immutable
import io.element.android.libraries.matrix.api.room.join.JoinRule
@Immutable
sealed interface OtherState {
@@ -22,7 +23,7 @@ sealed interface OtherState {
data object RoomEncryption : OtherState
data object RoomGuestAccess : OtherState
data object RoomHistoryVisibility : OtherState
data object RoomJoinRules : OtherState
data class RoomJoinRules(val joinRule: JoinRule?) : OtherState
data class RoomName(val name: String?) : OtherState
data class RoomPinnedEvents(val change: Change) : OtherState {
enum class Change {

View File

@@ -24,6 +24,7 @@ object RoomPowerLevelsValuesMapper {
roomName = values.roomName,
roomAvatar = values.roomAvatar,
roomTopic = values.roomTopic,
spaceChild = values.spaceChild,
)
}
}

View File

@@ -32,6 +32,7 @@ import io.element.android.libraries.matrix.api.timeline.item.event.UnknownConten
import io.element.android.libraries.matrix.api.timeline.item.event.UtdCause
import io.element.android.libraries.matrix.impl.media.map
import io.element.android.libraries.matrix.impl.poll.map
import io.element.android.libraries.matrix.impl.room.join.map
import kotlinx.collections.immutable.toImmutableList
import kotlinx.collections.immutable.toImmutableMap
import org.matrix.rustcomponents.sdk.EmbeddedEventDetails
@@ -210,7 +211,7 @@ private fun RustOtherState.map(): OtherState {
RustOtherState.RoomEncryption -> OtherState.RoomEncryption
RustOtherState.RoomGuestAccess -> OtherState.RoomGuestAccess
RustOtherState.RoomHistoryVisibility -> OtherState.RoomHistoryVisibility
RustOtherState.RoomJoinRules -> OtherState.RoomJoinRules
is RustOtherState.RoomJoinRules -> OtherState.RoomJoinRules(joinRule?.map())
is RustOtherState.RoomName -> OtherState.RoomName(name)
is RustOtherState.RoomPinnedEvents -> OtherState.RoomPinnedEvents(change.map())
is RustOtherState.RoomPowerLevels -> OtherState.RoomUserPowerLevels(users)

View File

@@ -21,6 +21,7 @@ internal fun aRustRoomPowerLevelsValues(
roomName: Long,
roomAvatar: Long,
roomTopic: Long,
spaceChild: Long,
) = RoomPowerLevelsValues(
ban = ban,
invite = invite,
@@ -32,4 +33,5 @@ internal fun aRustRoomPowerLevelsValues(
roomName = roomName,
roomAvatar = roomAvatar,
roomTopic = roomTopic,
spaceChild = spaceChild
)

View File

@@ -31,4 +31,5 @@ fun defaultFfiRoomPowerLevelValues() = RoomPowerLevelsValues(
roomTopic = 100,
stateDefault = 0,
usersDefault = 0,
spaceChild = 100,
)

View File

@@ -16,7 +16,6 @@ import io.element.android.libraries.matrix.api.room.RoomInfo
import io.element.android.libraries.matrix.api.room.RoomMember
import io.element.android.libraries.matrix.api.room.RoomMembershipObserver
import io.element.android.libraries.matrix.api.room.powerlevels.RoomPowerLevels
import io.element.android.libraries.matrix.api.room.powerlevels.RoomPowerLevelsValues
import io.element.android.libraries.matrix.api.timeline.item.event.MembershipChange
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiRoom
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiRoomListService
@@ -24,6 +23,7 @@ import io.element.android.libraries.matrix.test.A_DEVICE_ID
import io.element.android.libraries.matrix.test.A_SESSION_ID
import io.element.android.libraries.matrix.test.A_USER_ID
import io.element.android.libraries.matrix.test.room.aRoomInfo
import io.element.android.libraries.matrix.test.room.defaultRoomPowerLevelValues
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.coroutines.flow.SharingStarted
@@ -128,7 +128,7 @@ class RustBaseRoomTest {
val rustBaseRoom = createRustBaseRoom(
initialRoomInfo = aRoomInfo(
roomPowerLevels = RoomPowerLevels(
values = RoomPowerLevelsValues(50, 50, 50, 50, 50, 50, 50, 50),
values = defaultRoomPowerLevelValues(),
users = persistentMapOf(A_USER_ID to 100L)
)
),

View File

@@ -29,6 +29,7 @@ class RoomPowerLevelsValuesMapperTest {
roomName = 8,
roomAvatar = 9,
roomTopic = 10,
spaceChild = 11,
)
)
).isEqualTo(
@@ -41,6 +42,7 @@ class RoomPowerLevelsValuesMapperTest {
roomName = 8,
roomAvatar = 9,
roomTopic = 10,
spaceChild = 11,
)
)
}

View File

@@ -260,5 +260,6 @@ fun defaultRoomPowerLevelValues() = RoomPowerLevelsValues(
redactEvents = 50,
roomName = 100,
roomAvatar = 100,
roomTopic = 100
roomTopic = 100,
spaceChild = 100,
)