mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Update the font style for placeholder messages (redacted/encrypted/unsupported). (#4927)
This commit is contained in:
+4
-3
@@ -35,19 +35,20 @@ struct EncryptedRoomTimelineView: View {
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
Label(timelineItem.body, icon: icon, iconSize: .small, relativeTo: .compound.bodyLG)
|
||||
.labelStyle(RoomTimelineViewLabelStyle())
|
||||
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||
.font(.compound.bodyLG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomTimelineViewLabelStyle: LabelStyle {
|
||||
struct RoomTimelineViewPlaceholderLabelStyle: LabelStyle {
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
HStack(alignment: .center, spacing: 8) {
|
||||
configuration.icon
|
||||
.foregroundColor(.compound.iconSecondary)
|
||||
configuration.title
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.font(.compound.bodyLG.italic())
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
}
|
||||
.padding(.horizontal, 4)
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
|
||||
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
// Don't use RoomTimelineViewLabelStyle with FormattedBodyText as the formatted text
|
||||
// adds additional padding so the spacing between the icon and text is inconsistent.
|
||||
|
||||
// Spacing: 6 = label spacing - formatted text padding
|
||||
|
||||
Label {
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@ struct RedactedRoomTimelineView: View {
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
Label(timelineItem.body, icon: \.delete, iconSize: .small, relativeTo: .compound.bodyLG)
|
||||
.labelStyle(RoomTimelineViewLabelStyle())
|
||||
.imageScale(.small) // Smaller icon so that the bubble remains rounded on the outside.
|
||||
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-16
@@ -14,19 +14,11 @@ struct UnsupportedRoomTimelineView: View {
|
||||
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
Label {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text("\(timelineItem.body): \(timelineItem.eventType)")
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Text(timelineItem.error)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.font(.compound.bodySM)
|
||||
}
|
||||
} icon: {
|
||||
CompoundIcon(\.warning, size: .small, relativeTo: .compound.bodyLG)
|
||||
}
|
||||
.labelStyle(RoomTimelineViewLabelStyle())
|
||||
Label("\(timelineItem.body) (\(timelineItem.eventType)): \(timelineItem.error)",
|
||||
icon: \.warning,
|
||||
iconSize: .small,
|
||||
relativeTo: .compound.bodyLG)
|
||||
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +32,7 @@ struct UnsupportedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var body: some View {
|
||||
VStack(alignment: .leading, spacing: 20.0) {
|
||||
UnsupportedRoomTimelineView(timelineItem: itemWith(text: "Text",
|
||||
UnsupportedRoomTimelineView(timelineItem: itemWith(text: "Unsupported",
|
||||
timestamp: .mock,
|
||||
isOutgoing: false,
|
||||
senderId: "Bob"))
|
||||
@@ -55,8 +47,8 @@ struct UnsupportedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
private static func itemWith(text: String, timestamp: Date, isOutgoing: Bool, senderId: String) -> UnsupportedRoomTimelineItem {
|
||||
UnsupportedRoomTimelineItem(id: .randomEvent,
|
||||
body: text,
|
||||
eventType: "Some Event Type",
|
||||
error: "Something went wrong",
|
||||
eventType: "event.type",
|
||||
error: "something went wrong",
|
||||
timestamp: timestamp,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: false,
|
||||
|
||||
Reference in New Issue
Block a user