File tree Expand file tree Collapse file tree 4 files changed +36
-18
lines changed
Sources/StreamChatSwiftUI/ChatChannel/MessageList
StreamChatSwiftUITests/Tests/ChatChannel
__Snapshots__/MessageView_Tests Expand file tree Collapse file tree 4 files changed +36
-18
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212- Channel list item swipe gesture collision with native gesture
1313- Attributes from ` MessageActionInfo ` are now public
1414- Crash on older devices when adding multiple images quickly
15+ - Message text appearing in multiple file attachments from the same message
1516
1617# [ 4.24.0] ( https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.24.0 )
1718_ November 16, 2022_
Original file line number Diff line number Diff line change @@ -40,29 +40,22 @@ public struct FileAttachmentsContainer<Factory: ViewFactory>: View {
4040 )
4141 }
4242
43- VStack ( spacing: 4 ) {
44- ForEach ( message . fileAttachments , id : \ . self ) { attachment in
45- if message. text . isEmpty {
43+ VStack ( spacing: 0 ) {
44+ VStack ( spacing : 4 ) {
45+ ForEach ( message. fileAttachments , id : \ . self ) { attachment in
4646 FileAttachmentView (
4747 attachment: attachment,
4848 width: width,
4949 isFirst: isFirst
5050 )
51- } else {
52- VStack ( spacing: 0 ) {
53- FileAttachmentView (
54- attachment: attachment,
55- width: width,
56- isFirst: isFirst
57- )
58-
59- HStack {
60- Text ( message. adjustedText)
61- . foregroundColor ( textColor ( for: message) )
62- . standardPadding ( )
63- Spacer ( )
64- }
65- }
51+ }
52+ }
53+ if !message. text. isEmpty {
54+ HStack {
55+ Text ( message. adjustedText)
56+ . foregroundColor ( textColor ( for: message) )
57+ . standardPadding ( )
58+ Spacer ( )
6659 }
6760 }
6861 }
Original file line number Diff line number Diff line change @@ -215,6 +215,30 @@ class MessageView_Tests: StreamChatTestCase {
215215 assertSnapshot ( matching: view, as: . image)
216216 }
217217
218+ func test_messageViewFileText_snapshot( ) {
219+ // Given
220+ let fileMessage = ChatMessage . mock (
221+ id: . unique,
222+ cid: . unique,
223+ text: " Test message " ,
224+ author: . mock( id: . unique) ,
225+ attachments: ChatChannelTestHelpers . fileAttachments
226+ )
227+
228+ // When
229+ let view = MessageView (
230+ factory: DefaultViewFactory . shared,
231+ message: fileMessage,
232+ contentWidth: defaultScreenSize. width,
233+ isFirst: true ,
234+ scrolledId: . constant( nil )
235+ )
236+ . applyDefaultSize ( )
237+
238+ // Then
239+ assertSnapshot ( matching: view, as: . image)
240+ }
241+
218242 func test_messageViewJumboEmoji_snapshot( ) {
219243 // Given
220244 let emojiMessage = ChatMessage . mock (
You can’t perform that action at this time.
0 commit comments