Add history sharing badges to room details (#5043)

* chore: Add dependency `SwiftFlow` for use in avatar header badges.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>

* feat: Display history sharing pill in room details.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>

* tests: Add tests for history sharing room details pill.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>

* tests: Update screenshots for RoomDetailsScreen preview tests.

* fix: Use Localazy translations for room details badges

* fix: Address review comments

* fix: Remove line limit from room details badges

---------

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
This commit is contained in:
Skye Elliot
2026-02-11 12:22:39 +00:00
committed by GitHub
parent 992cec91d6
commit 4841a3bdaf
57 changed files with 333 additions and 67 deletions
@@ -16,4 +16,5 @@ struct RoomDetails {
let isEncrypted: Bool
let isPublic: Bool
let isDirect: Bool
var historySharingState: RoomHistorySharingState?
}
@@ -8,8 +8,13 @@
/// Enumeration of the two possible cases in which history sharing under MSC4268 is enabled. These
/// variants implicitly assume that the feature flag, `enableKeyShareOnInvite`, is set.
enum RoomHistorySharingState: Equatable {
/// The feature flag is set, and the room history visibility is set to `shared`.
/// The feature flag is set, and the room history visibility is either `invited` or `joined`. New
/// members of the room cannot read the room history.
case hidden
/// The feature flag is set, and the room history visibility is set to `shared`. New members of the
/// room can read the room history.
case shared
/// The feature flag is set, and the room history visibility is set to `world_readable`.
/// The feature flag is set, and the room history visibility is set to `world_readable`. Anyone
/// can read the room history.
case worldReadable
}
@@ -142,11 +142,13 @@ extension RoomInfoProxyProtocol {
return nil
}
return switch historyVisibility {
case .joined, .invited:
.hidden
case .shared:
.shared
case .worldReadable:
.worldReadable
default:
case .custom:
nil
}
}
@@ -196,13 +196,20 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol {
extension JoinedRoomProxyProtocol {
var details: RoomDetails {
RoomDetails(id: id,
name: infoPublisher.value.displayName,
avatar: infoPublisher.value.avatar,
canonicalAlias: infoPublisher.value.canonicalAlias,
isEncrypted: infoPublisher.value.isEncrypted,
isPublic: !(infoPublisher.value.isPrivate ?? false),
isDirect: infoPublisher.value.isDirect)
let historySharingState: RoomHistorySharingState? = if infoPublisher.value.isEncrypted {
infoPublisher.value.historySharingState
} else {
nil
}
return RoomDetails(id: id,
name: infoPublisher.value.displayName,
avatar: infoPublisher.value.avatar,
canonicalAlias: infoPublisher.value.canonicalAlias,
isEncrypted: infoPublisher.value.isEncrypted,
isPublic: !(infoPublisher.value.isPrivate ?? false),
isDirect: infoPublisher.value.isDirect,
historySharingState: historySharingState)
}
var isDirectOneToOneRoom: Bool {