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/).
12
12
- Channel list item swipe gesture collision with native gesture
13
13
- Attributes from ` MessageActionInfo ` are now public
14
14
- Crash on older devices when adding multiple images quickly
15
+ - Message text appearing in multiple file attachments from the same message
15
16
16
17
# [ 4.24.0] ( https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.24.0 )
17
18
_ November 16, 2022_
Original file line number Diff line number Diff line change @@ -40,29 +40,22 @@ public struct FileAttachmentsContainer<Factory: ViewFactory>: View {
40
40
)
41
41
}
42
42
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
46
46
FileAttachmentView (
47
47
attachment: attachment,
48
48
width: width,
49
49
isFirst: isFirst
50
50
)
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 ( )
66
59
}
67
60
}
68
61
}
Original file line number Diff line number Diff line change @@ -215,6 +215,30 @@ class MessageView_Tests: StreamChatTestCase {
215
215
assertSnapshot ( matching: view, as: . image)
216
216
}
217
217
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
+
218
242
func test_messageViewJumboEmoji_snapshot( ) {
219
243
// Given
220
244
let emojiMessage = ChatMessage . mock (
You can’t perform that action at this time.
0 commit comments