Skip to content

Commit 4d3a930

Browse files
Prevent audio messages increasing width in reply mode (#926)
1 parent 9ec04a0 commit 4d3a930

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Prevent audio messages increasing width in reply mode [#926](https://github.com/GetStream/stream-chat-swiftui/pull/926)
78

89
# [4.85.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.85.0)
910
_August 13, 2025_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ public struct QuotedMessageView<Factory: ViewFactory>: View {
134134
Text("📊 \(poll.name)")
135135
}
136136

137-
Text(textForMessage)
138-
.foregroundColor(textColor(for: quotedMessage))
139-
.lineLimit(3)
140-
.font(fonts.footnote)
141-
.accessibility(identifier: "quotedMessageText")
137+
if !hasVoiceAttachments {
138+
Text(textForMessage)
139+
.foregroundColor(textColor(for: quotedMessage))
140+
.lineLimit(3)
141+
.font(fonts.footnote)
142+
.accessibility(identifier: "quotedMessageText")
143+
}
142144

143145
if fillAvailableSpace {
144146
Spacer()

StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,40 @@ class QuotedMessageView_Tests: StreamChatTestCase {
7777
// Then
7878
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
7979
}
80+
81+
func test_quotedMessageView_voiceAttachmentWithTextSnapshot() {
82+
// Given
83+
let payload = VoiceRecordingAttachmentPayload(
84+
title: "Recording",
85+
voiceRecordingRemoteURL: .localYodaImage,
86+
file: try! .init(url: .localYodaQuote),
87+
duration: 3,
88+
waveformData: [0, 0.3, 0.6, 1],
89+
extraData: nil
90+
)
91+
let viewSize = CGSize(width: 200, height: 50)
92+
let message = ChatMessage.mock(
93+
text: "Hello, how are you?",
94+
deletedAt: .unique,
95+
attachments: [
96+
ChatMessageVoiceRecordingAttachment(
97+
id: .unique,
98+
type: .voiceRecording,
99+
payload: payload,
100+
downloadingState: nil,
101+
uploadingState: nil
102+
).asAnyAttachment
103+
]
104+
)
105+
let view = QuotedMessageView(
106+
factory: DefaultViewFactory.shared,
107+
quotedMessage: message,
108+
fillAvailableSpace: true,
109+
forceLeftToRight: true
110+
)
111+
.applySize(viewSize)
112+
113+
// Then
114+
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
115+
}
80116
}
Loading

0 commit comments

Comments
 (0)