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

@ -70,12 +70,12 @@ class FakeNotificationSettingsService(
}
}
override suspend fun setDefaultRoomNotificationMode(isEncrypted: Boolean, mode: RoomNotificationMode, isOneToOne: Boolean): Result<Unit> {
override suspend fun setDefaultRoomNotificationMode(isEncrypted: Boolean, mode: RoomNotificationMode, isDM: Boolean): Result<Unit> {
val error = setDefaultNotificationModeError
if (error != null) {
return Result.failure(error)
}
if (isOneToOne) {
if (isDM) {
if (isEncrypted) {
defaultEncryptedOneToOneRoomNotificationMode = mode
} else {

View file

@ -134,7 +134,11 @@ class FakeJoinedRoom(
}
override suspend fun updateRoomNotificationSettings(): Result<Unit> = simulateLongTask {
val notificationSettings = roomNotificationSettingsService.getRoomNotificationSettings(roomId, info().isEncrypted.orFalse(), isOneToOne).getOrThrow()
val notificationSettings = roomNotificationSettingsService.getRoomNotificationSettings(
roomId = roomId,
isEncrypted = info().isEncrypted.orFalse(),
isOneToOne = isDm(),
).getOrThrow()
(roomNotificationSettingsStateFlow as MutableStateFlow).value = RoomNotificationSettingsState.Ready(notificationSettings)
return Result.success(Unit)
}

View file

@ -71,6 +71,7 @@ fun aRoomInfo(
privilegedCreatorRole: Boolean = false,
isLowPriority: Boolean = false,
activeCallIntentConsensus: CallIntentConsensus = CallIntentConsensus.None,
isDm: Boolean = false,
) = RoomInfo(
id = id,
name = name,
@ -109,4 +110,5 @@ fun aRoomInfo(
privilegedCreatorRole = privilegedCreatorRole,
isLowPriority = isLowPriority,
activeCallIntentConsensus = activeCallIntentConsensus,
isDm = isDm,
)

View file

@ -23,6 +23,7 @@ fun aRoomMember(
isIgnored: Boolean = false,
role: RoomMember.Role = RoomMember.Role.User,
membershipChangeReason: String? = null,
isServiceMember: Boolean = false,
) = RoomMember(
userId = userId,
displayName = displayName,
@ -33,6 +34,7 @@ fun aRoomMember(
isIgnored = isIgnored,
role = role,
membershipChangeReason = membershipChangeReason,
isServiceMember = isServiceMember,
)
fun aRoomMemberList() = persistentListOf(

View file

@ -120,6 +120,7 @@ fun aRoomSummary(
privilegedCreatorRole = privilegedCreatorRole,
isLowPriority = isLowPriority,
activeCallIntentConsensus = activeCallIntentConsensus,
isDm = false,
),
latestEvent = latestEvent,
)