Adapt to new DM definition changes in the SDK (#6748)

* Set `DmRoomDefinition.TwoPeople` in `ClientBuilder`. This applies the 'direct and with at most 2 non-service members' rule to what the SDK should consider a DM.

* Map `RoomInfo.isDm` from the SDK

* Map `NotificationData.isDm` from `NotificationInfo.roomInfo.isDm`

* Remove `RoomIsDmCheck` file as its extension functions are now redundant. Move `Room.isDm` helper function to `BaseRoom`.

* Map `isDm` in `SpaceRoom` from the SDK too

* Replace `isDirect` with `isDm` where possible

* Map `RoomMember.isServiceMember` from the SDK and use it to tell apart normal members of a room from service members (i.e. `RoomMembersState.getDirectRoomMember`)
This commit is contained in:
Jorge Martin Espinosa 2026-05-11 17:22:16 +02:00 committed by GitHub
parent 5e5e0bbc6e
commit 11476c73cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 115 additions and 232 deletions

View file

@ -15,7 +15,6 @@ import io.element.android.libraries.matrix.api.MatrixClient
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.room.CurrentUserMembership
import io.element.android.libraries.matrix.api.room.RoomInfo
import io.element.android.libraries.matrix.api.room.isDm
import io.element.android.libraries.matrix.api.room.recent.getRecentlyVisitedRoomInfoFlow
import io.element.android.libraries.matrix.api.roomlist.RoomList
import io.element.android.libraries.matrix.api.roomlist.RoomListFilter

View file

@ -67,7 +67,7 @@ class LeaveSpacePresenter(
.orEmpty()
.partition { it.spaceRoom.roomId == leaveSpaceHandle.id }
// By default select all rooms that can be left
val otherRoomsExcludingDm = otherRooms.filter { it.spaceRoom.isDirect != true }
val otherRoomsExcludingDm = otherRooms.filter { it.spaceRoom.isDm != true }
selectedRoomIds = otherRoomsExcludingDm
.filter { it.isLastOwner.not() }
.map { it.spaceRoom.roomId }

View file

@ -109,6 +109,7 @@ private fun aSpaceInfo(
avatarUrl = null,
isPublic = true,
isDirect = false,
isDm = false,
isEncrypted = false,
joinRule = joinRule,
isSpace = true,

View file

@ -98,13 +98,13 @@ class LeaveSpacePresenterTest {
listOf(
aLeaveSpaceRoom(spaceRoom = aSpace),
aLeaveSpaceRoom(
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID, isDirect = false)
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID, isDm = false)
),
aLeaveSpaceRoom(
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID_2, isDirect = true)
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID_2, isDm = true)
),
aLeaveSpaceRoom(
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID_3, isDirect = null)
spaceRoom = aSpaceRoom(roomId = A_ROOM_ID_3, isDm = null)
),
)
)