added the strings for the pin banner, the room list and the notification content builder

This commit is contained in:
Mauro Romito
2026-07-30 16:13:03 +02:00
committed by Mauro
parent 9a1db7e664
commit d7127562d7
2 changed files with 44 additions and 1 deletions
@@ -66,7 +66,7 @@ nonisolated struct RoomMessageEventStringBuilder {
message = AttributedString(content.body)
}
case .gallery(let content):
message = AttributedString(content.body)
message = buildGalleryMessage(for: style, content: content)
case .other(_, let body):
message = AttributedString(body)
}
@@ -91,6 +91,21 @@ nonisolated struct RoomMessageEventStringBuilder {
}
}
/// A gallery's body is its caption. Notifications fall back to counting the attachments when
/// there isn't one, whilst elsewhere it is treated as any other media's caption.
private func buildGalleryMessage(for style: Style, content: GalleryMessageContent) -> AttributedString {
switch style {
case .plain:
if content.body.isBlank {
AttributedString(L10n.notificationGalleryBody(content.itemtypes.count))
} else {
AttributedString(content.body)
}
case .senderPrefixed, .typeBolded:
buildMessage(for: style, caption: content.body, type: L10n.commonGallery)
}
}
private func buildMessage(for style: Style, caption: String?, type: String) -> AttributedString {
guard let caption else {
return AttributedString(type)