mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Fix ReplyView when its content has been redacted. (#2606)
This commit is contained in:
parent
be9cf8713e
commit
bb725db6bb
@ -81,6 +81,11 @@ struct TimelineReplyView: View {
|
||||
plainBody: question,
|
||||
formattedBody: nil,
|
||||
icon: .init(kind: .icon(\.polls), cornerRadii: iconCornerRadii))
|
||||
case .redacted:
|
||||
ReplyView(sender: sender,
|
||||
plainBody: L10n.commonMessageRemoved,
|
||||
formattedBody: nil,
|
||||
icon: .init(kind: .icon(\.delete), cornerRadii: iconCornerRadii))
|
||||
}
|
||||
default:
|
||||
LoadingReplyView()
|
||||
@ -295,7 +300,11 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
|
||||
eventContent: .message(.notice(.init(body: "", formattedBody: attributedStringWithAtRoomMention))))),
|
||||
TimelineReplyView(placement: .timeline,
|
||||
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Bob"),
|
||||
eventContent: .poll(question: "Do you like polls?")))
|
||||
eventContent: .poll(question: "Do you like polls?"))),
|
||||
|
||||
TimelineReplyView(placement: .timeline,
|
||||
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Bob"),
|
||||
eventContent: .redacted))
|
||||
]
|
||||
}
|
||||
|
||||
@ -305,7 +314,9 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
|
||||
previewItems[index]
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.environmentObject(viewModel.context)
|
||||
.snapshot(delay: 0.2) // Allow member names to load.
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ struct RedactedRoomTimelineView: View {
|
||||
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
Label(timelineItem.body, systemImage: "trash")
|
||||
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.
|
||||
}
|
||||
|
@ -26,4 +26,5 @@ enum TimelineItemReplyDetails: Hashable {
|
||||
enum TimelineEventContent: Hashable {
|
||||
case message(EventBasedMessageTimelineItemContentType)
|
||||
case poll(question: String)
|
||||
case redacted
|
||||
}
|
||||
|
@ -645,6 +645,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
replyContent = .poll(question: question)
|
||||
case .sticker(let body, _, _):
|
||||
replyContent = .message(.text(.init(body: body)))
|
||||
case .redactedMessage:
|
||||
replyContent = .redacted
|
||||
default:
|
||||
replyContent = .message(.text(.init(body: L10n.commonUnsupportedEvent)))
|
||||
}
|
||||
|
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_redactedRoomTimelineView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
1
changelog.d/2396.bugfix
Normal file
1
changelog.d/2396.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix ReplyView when its content has been redacted.
|
Loading…
x
Reference in New Issue
Block a user