Update the font style for placeholder messages (redacted/encrypted/unsupported). (#4927)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:599837b3cf44745e1a81f6eccf9687468286066981214ccb868b736befb3f80f
|
||||
size 118021
|
||||
oid sha256:dac0f06f2694bdc9c61df2eff5e57e8e868ebf16400a228c3c936f2bc642d330
|
||||
size 119845
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8daa2bfbf798bb111978d13174889463d1d62880a35dc9cc5b2f751fa45aff06
|
||||
size 126885
|
||||
oid sha256:c3f14dc9ccbed42c0490430532c5f733084646a12b3c0d3b5c067d721ee2c54f
|
||||
size 127808
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3818a4ddca0e8788ce91af48cd8244aac1216c65c26ac60653c176562f638abe
|
||||
size 80278
|
||||
oid sha256:407851003ec9cd81d2fd2209c3a591048e249c6e9fdd9b815537019f73dc8a6d
|
||||
size 82110
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:83af2ec2ee026089714c3bece5acbb6e90a5ca1abfcbd6632df3b35ae7eff796
|
||||
size 106258
|
||||
oid sha256:f18544db4f5de17ac2a364c650cf4f9cb172b43b1c6f98f22a1d251e1adba94d
|
||||
size 108387
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:09577f08ea4a26ceca9efb32a98ce33c51670ff93256d509504591c0b22a8945
|
||||
size 77351
|
||||
oid sha256:5fc52760113ba2324d9ca87f525b5ec0485ea95c23b85071c680c277b16780ce
|
||||
size 77808
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b37a9f4d9e6979c87533bf8ebf66c06530d1a3ca11c3d88f3d6a434610ae9ee4
|
||||
size 78520
|
||||
oid sha256:de75fb594d6759c3019ffe071176b7007580b04e395658176af35dc28f00800f
|
||||
size 78688
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9a80f7f3db6726f06a6674c45520786d87e9827a336debe612d2bdada895023
|
||||
size 37067
|
||||
oid sha256:d8d7e4c177a9a50d25aa0aac5c001dc1a939a5c2c0df32802732ec1cc8372942
|
||||
size 37245
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:268159d435529e0b0cd88bdd80c2bdc7a4fc95eb63370af499775a77f546e0cd
|
||||
size 42518
|
||||
oid sha256:b074ba6bb70d9ef3369132ecf5cfddbb94f9fe634e977e73baf8ce1c6aa14114
|
||||
size 43083
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:21a7ba692edf2537865567214d653a068bbb67e4d490d4b59c1f69a7b14b70c4
|
||||
size 97993
|
||||
oid sha256:b527e3f499439841db8325815ce8e0c9cf2487da6f1b8ef0e36050770c7b7527
|
||||
size 96663
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ce4369d6bb5071611a5635e2b2d61c0e2a1ffa24254c4d1b457e7fe62c1f280d
|
||||
size 102198
|
||||
oid sha256:ebea9e2ddda9d139ad162ecc0c8eb7f9c0f2b6a8e178cbf87b214e8dbee8aa8b
|
||||
size 98028
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b660004b4fe4464d92c7011a7c624d015b5b836212a411355d07fe9c7c291cba
|
||||
size 58084
|
||||
oid sha256:c0e519c9139c58d9cd0819e177e2dd64bee016eefdfc8006ccce58f2b95ef267
|
||||
size 62206
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc3187ace964d97aacce83716d577ee3d3381a5aca83e66c99645db8b6b3839d
|
||||
size 62867
|
||||
oid sha256:e3bcbaa8b43c2f675064bf46d5f5e02fc7b686e2f4ba99820d5252d7e77c9242
|
||||
size 65860
|
||||
|
||||
Reference in New Issue
Block a user