mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
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:
committed by
GitHub
parent
5e5e0bbc6e
commit
11476c73cf
+2
-2
@@ -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 {
|
||||
|
||||
+5
-1
@@ -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)
|
||||
}
|
||||
|
||||
+2
@@ -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,
|
||||
)
|
||||
|
||||
+2
@@ -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(
|
||||
|
||||
+1
@@ -120,6 +120,7 @@ fun aRoomSummary(
|
||||
privilegedCreatorRole = privilegedCreatorRole,
|
||||
isLowPriority = isLowPriority,
|
||||
activeCallIntentConsensus = activeCallIntentConsensus,
|
||||
isDm = false,
|
||||
),
|
||||
latestEvent = latestEvent,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user