From d8943bf0b422beae403985b833541b19c9ffb7d0 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Wed, 7 Jan 2026 14:23:47 +0000 Subject: [PATCH] Update the font style for placeholder messages (redacted/encrypted/unsupported). (#4927) --- .../EncryptedRoomTimelineView.swift | 7 +++--- .../NoticeRoomTimelineView.swift | 3 --- .../RedactedRoomTimelineView.swift | 3 +-- .../UnsupportedRoomTimelineView.swift | 24 +++++++------------ ...encryptedRoomTimelineView.iPad-en-GB-0.png | 4 ++-- ...ncryptedRoomTimelineView.iPad-pseudo-0.png | 4 ++-- ...cryptedRoomTimelineView.iPhone-en-GB-0.png | 4 ++-- ...ryptedRoomTimelineView.iPhone-pseudo-0.png | 4 ++-- .../redactedRoomTimelineView.iPad-en-GB-0.png | 4 ++-- ...redactedRoomTimelineView.iPad-pseudo-0.png | 4 ++-- ...edactedRoomTimelineView.iPhone-en-GB-0.png | 4 ++-- ...dactedRoomTimelineView.iPhone-pseudo-0.png | 4 ++-- ...supportedRoomTimelineView.iPad-en-GB-0.png | 4 ++-- ...upportedRoomTimelineView.iPad-pseudo-0.png | 4 ++-- ...pportedRoomTimelineView.iPhone-en-GB-0.png | 4 ++-- ...portedRoomTimelineView.iPhone-pseudo-0.png | 4 ++-- 16 files changed, 37 insertions(+), 48 deletions(-) diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift index c72b6642f..fad775f8b 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift @@ -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) } diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/NoticeRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/NoticeRoomTimelineView.swift index 3dc6b32bc..85c1889d4 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/NoticeRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/NoticeRoomTimelineView.swift @@ -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 { diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/RedactedRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/RedactedRoomTimelineView.swift index e75981287..fda47b7f6 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/RedactedRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/RedactedRoomTimelineView.swift @@ -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()) } } } diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/UnsupportedRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/UnsupportedRoomTimelineView.swift index 9b8bcf43d..f8cd903fc 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/UnsupportedRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/UnsupportedRoomTimelineView.swift @@ -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, diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-en-GB-0.png index b8e234e2b..c218722a4 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:599837b3cf44745e1a81f6eccf9687468286066981214ccb868b736befb3f80f -size 118021 +oid sha256:dac0f06f2694bdc9c61df2eff5e57e8e868ebf16400a228c3c936f2bc642d330 +size 119845 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-pseudo-0.png index ff5015f6f..0a5551f08 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8daa2bfbf798bb111978d13174889463d1d62880a35dc9cc5b2f751fa45aff06 -size 126885 +oid sha256:c3f14dc9ccbed42c0490430532c5f733084646a12b3c0d3b5c067d721ee2c54f +size 127808 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-en-GB-0.png index fd1c98b39..ee606de6e 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3818a4ddca0e8788ce91af48cd8244aac1216c65c26ac60653c176562f638abe -size 80278 +oid sha256:407851003ec9cd81d2fd2209c3a591048e249c6e9fdd9b815537019f73dc8a6d +size 82110 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-pseudo-0.png index f7a4df8fb..cec84943b 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/encryptedRoomTimelineView.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:83af2ec2ee026089714c3bece5acbb6e90a5ca1abfcbd6632df3b35ae7eff796 -size 106258 +oid sha256:f18544db4f5de17ac2a364c650cf4f9cb172b43b1c6f98f22a1d251e1adba94d +size 108387 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-en-GB-0.png index 2d64f3879..f5bdf81a0 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09577f08ea4a26ceca9efb32a98ce33c51670ff93256d509504591c0b22a8945 -size 77351 +oid sha256:5fc52760113ba2324d9ca87f525b5ec0485ea95c23b85071c680c277b16780ce +size 77808 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-pseudo-0.png index 2ad07d455..d91294953 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b37a9f4d9e6979c87533bf8ebf66c06530d1a3ca11c3d88f3d6a434610ae9ee4 -size 78520 +oid sha256:de75fb594d6759c3019ffe071176b7007580b04e395658176af35dc28f00800f +size 78688 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-en-GB-0.png index 2c7294220..c03f7869d 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9a80f7f3db6726f06a6674c45520786d87e9827a336debe612d2bdada895023 -size 37067 +oid sha256:d8d7e4c177a9a50d25aa0aac5c001dc1a939a5c2c0df32802732ec1cc8372942 +size 37245 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-pseudo-0.png index ea8bf619c..7bd054289 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/redactedRoomTimelineView.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:268159d435529e0b0cd88bdd80c2bdc7a4fc95eb63370af499775a77f546e0cd -size 42518 +oid sha256:b074ba6bb70d9ef3369132ecf5cfddbb94f9fe634e977e73baf8ce1c6aa14114 +size 43083 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-en-GB-0.png index 02f87ce4c..919ad07db 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21a7ba692edf2537865567214d653a068bbb67e4d490d4b59c1f69a7b14b70c4 -size 97993 +oid sha256:b527e3f499439841db8325815ce8e0c9cf2487da6f1b8ef0e36050770c7b7527 +size 96663 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-pseudo-0.png index 784cc7bfd..4ba6497fb 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce4369d6bb5071611a5635e2b2d61c0e2a1ffa24254c4d1b457e7fe62c1f280d -size 102198 +oid sha256:ebea9e2ddda9d139ad162ecc0c8eb7f9c0f2b6a8e178cbf87b214e8dbee8aa8b +size 98028 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-en-GB-0.png index 53b92afa5..198f2f506 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b660004b4fe4464d92c7011a7c624d015b5b836212a411355d07fe9c7c291cba -size 58084 +oid sha256:c0e519c9139c58d9cd0819e177e2dd64bee016eefdfc8006ccce58f2b95ef267 +size 62206 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-pseudo-0.png index 6d68c42ed..b7ecb4f7a 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/unsupportedRoomTimelineView.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc3187ace964d97aacce83716d577ee3d3381a5aca83e66c99645db8b6b3839d -size 62867 +oid sha256:e3bcbaa8b43c2f675064bf46d5f5e02fc7b686e2f4ba99820d5252d7e77c9242 +size 65860