mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:12:26 +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 {
|
var body: some View {
|
||||||
TimelineStyler(timelineItem: timelineItem) {
|
TimelineStyler(timelineItem: timelineItem) {
|
||||||
Label(timelineItem.body, icon: icon, iconSize: .small, relativeTo: .compound.bodyLG)
|
Label(timelineItem.body, icon: icon, iconSize: .small, relativeTo: .compound.bodyLG)
|
||||||
.labelStyle(RoomTimelineViewLabelStyle())
|
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||||
.font(.compound.bodyLG)
|
.font(.compound.bodyLG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RoomTimelineViewLabelStyle: LabelStyle {
|
struct RoomTimelineViewPlaceholderLabelStyle: LabelStyle {
|
||||||
func makeBody(configuration: Configuration) -> some View {
|
func makeBody(configuration: Configuration) -> some View {
|
||||||
HStack(alignment: .center, spacing: 8) {
|
HStack(alignment: .center, spacing: 8) {
|
||||||
configuration.icon
|
configuration.icon
|
||||||
.foregroundColor(.compound.iconSecondary)
|
.foregroundColor(.compound.iconSecondary)
|
||||||
configuration.title
|
configuration.title
|
||||||
.foregroundColor(.compound.textPrimary)
|
.font(.compound.bodyLG.italic())
|
||||||
|
.foregroundColor(.compound.textSecondary)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 4)
|
.padding(.horizontal, 4)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TimelineStyler(timelineItem: timelineItem) {
|
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
|
// Spacing: 6 = label spacing - formatted text padding
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|||||||
+1
-2
@@ -15,8 +15,7 @@ struct RedactedRoomTimelineView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
TimelineStyler(timelineItem: timelineItem) {
|
TimelineStyler(timelineItem: timelineItem) {
|
||||||
Label(timelineItem.body, icon: \.delete, iconSize: .small, relativeTo: .compound.bodyLG)
|
Label(timelineItem.body, icon: \.delete, iconSize: .small, relativeTo: .compound.bodyLG)
|
||||||
.labelStyle(RoomTimelineViewLabelStyle())
|
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||||
.imageScale(.small) // Smaller icon so that the bubble remains rounded on the outside.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-16
@@ -14,19 +14,11 @@ struct UnsupportedRoomTimelineView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TimelineStyler(timelineItem: timelineItem) {
|
TimelineStyler(timelineItem: timelineItem) {
|
||||||
Label {
|
Label("\(timelineItem.body) (\(timelineItem.eventType)): \(timelineItem.error)",
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
icon: \.warning,
|
||||||
Text("\(timelineItem.body): \(timelineItem.eventType)")
|
iconSize: .small,
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
relativeTo: .compound.bodyLG)
|
||||||
|
.labelStyle(RoomTimelineViewPlaceholderLabelStyle())
|
||||||
Text(timelineItem.error)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
.font(.compound.bodySM)
|
|
||||||
}
|
|
||||||
} icon: {
|
|
||||||
CompoundIcon(\.warning, size: .small, relativeTo: .compound.bodyLG)
|
|
||||||
}
|
|
||||||
.labelStyle(RoomTimelineViewLabelStyle())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +32,7 @@ struct UnsupportedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var body: some View {
|
static var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 20.0) {
|
VStack(alignment: .leading, spacing: 20.0) {
|
||||||
UnsupportedRoomTimelineView(timelineItem: itemWith(text: "Text",
|
UnsupportedRoomTimelineView(timelineItem: itemWith(text: "Unsupported",
|
||||||
timestamp: .mock,
|
timestamp: .mock,
|
||||||
isOutgoing: false,
|
isOutgoing: false,
|
||||||
senderId: "Bob"))
|
senderId: "Bob"))
|
||||||
@@ -55,8 +47,8 @@ struct UnsupportedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
|||||||
private static func itemWith(text: String, timestamp: Date, isOutgoing: Bool, senderId: String) -> UnsupportedRoomTimelineItem {
|
private static func itemWith(text: String, timestamp: Date, isOutgoing: Bool, senderId: String) -> UnsupportedRoomTimelineItem {
|
||||||
UnsupportedRoomTimelineItem(id: .randomEvent,
|
UnsupportedRoomTimelineItem(id: .randomEvent,
|
||||||
body: text,
|
body: text,
|
||||||
eventType: "Some Event Type",
|
eventType: "event.type",
|
||||||
error: "Something went wrong",
|
error: "something went wrong",
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
isOutgoing: isOutgoing,
|
isOutgoing: isOutgoing,
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:599837b3cf44745e1a81f6eccf9687468286066981214ccb868b736befb3f80f
|
oid sha256:dac0f06f2694bdc9c61df2eff5e57e8e868ebf16400a228c3c936f2bc642d330
|
||||||
size 118021
|
size 119845
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:8daa2bfbf798bb111978d13174889463d1d62880a35dc9cc5b2f751fa45aff06
|
oid sha256:c3f14dc9ccbed42c0490430532c5f733084646a12b3c0d3b5c067d721ee2c54f
|
||||||
size 126885
|
size 127808
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:3818a4ddca0e8788ce91af48cd8244aac1216c65c26ac60653c176562f638abe
|
oid sha256:407851003ec9cd81d2fd2209c3a591048e249c6e9fdd9b815537019f73dc8a6d
|
||||||
size 80278
|
size 82110
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:83af2ec2ee026089714c3bece5acbb6e90a5ca1abfcbd6632df3b35ae7eff796
|
oid sha256:f18544db4f5de17ac2a364c650cf4f9cb172b43b1c6f98f22a1d251e1adba94d
|
||||||
size 106258
|
size 108387
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:09577f08ea4a26ceca9efb32a98ce33c51670ff93256d509504591c0b22a8945
|
oid sha256:5fc52760113ba2324d9ca87f525b5ec0485ea95c23b85071c680c277b16780ce
|
||||||
size 77351
|
size 77808
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:b37a9f4d9e6979c87533bf8ebf66c06530d1a3ca11c3d88f3d6a434610ae9ee4
|
oid sha256:de75fb594d6759c3019ffe071176b7007580b04e395658176af35dc28f00800f
|
||||||
size 78520
|
size 78688
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:d9a80f7f3db6726f06a6674c45520786d87e9827a336debe612d2bdada895023
|
oid sha256:d8d7e4c177a9a50d25aa0aac5c001dc1a939a5c2c0df32802732ec1cc8372942
|
||||||
size 37067
|
size 37245
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:268159d435529e0b0cd88bdd80c2bdc7a4fc95eb63370af499775a77f546e0cd
|
oid sha256:b074ba6bb70d9ef3369132ecf5cfddbb94f9fe634e977e73baf8ce1c6aa14114
|
||||||
size 42518
|
size 43083
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:21a7ba692edf2537865567214d653a068bbb67e4d490d4b59c1f69a7b14b70c4
|
oid sha256:b527e3f499439841db8325815ce8e0c9cf2487da6f1b8ef0e36050770c7b7527
|
||||||
size 97993
|
size 96663
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:ce4369d6bb5071611a5635e2b2d61c0e2a1ffa24254c4d1b457e7fe62c1f280d
|
oid sha256:ebea9e2ddda9d139ad162ecc0c8eb7f9c0f2b6a8e178cbf87b214e8dbee8aa8b
|
||||||
size 102198
|
size 98028
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:b660004b4fe4464d92c7011a7c624d015b5b836212a411355d07fe9c7c291cba
|
oid sha256:c0e519c9139c58d9cd0819e177e2dd64bee016eefdfc8006ccce58f2b95ef267
|
||||||
size 58084
|
size 62206
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:dc3187ace964d97aacce83716d577ee3d3381a5aca83e66c99645db8b6b3839d
|
oid sha256:e3bcbaa8b43c2f675064bf46d5f5e02fc7b686e2f4ba99820d5252d7e77c9242
|
||||||
size 62867
|
size 65860
|
||||||
|
|||||||
Reference in New Issue
Block a user