Skip to content

Commit c8d0660

Browse files
authored
Quoted message preview did not update when the quoted message was deleted (#705)
1 parent 11b026c commit c8d0660

File tree

8 files changed

+28
-4
lines changed

8 files changed

+28
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### 🐞 Fixed
77
- Use bright color for typing indicator animation in dark mode [#702](https://github.com/GetStream/stream-chat-swiftui/pull/702)
8+
- Refresh quoted message preview when the quoted message is deleted [#705](https://github.com/GetStream/stream-chat-swiftui/pull/705)
89

910
# [4.69.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.69.0)
1011
_December 18, 2024_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ extension View {
193193
public func textColor(for message: ChatMessage) -> Color {
194194
@Injected(\.colors) var colors
195195

196+
if message.isDeleted {
197+
return Color(colors.textLowEmphasis)
198+
}
196199
if message.isSentByCurrentUser {
197200
return Color(colors.messageCurrentUserTextColor)
198201
} else {

Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ public struct QuotedMessageView<Factory: ViewFactory>: View {
178178
}
179179

180180
private var textForMessage: String {
181-
if !quotedMessage.text.isEmpty {
182-
return quotedMessage.adjustedText
181+
let textContent = quotedMessage.textContent ?? ""
182+
if !textContent.isEmpty {
183+
return textContent
183184
}
184185

185186
if !quotedMessage.imageAttachments.isEmpty {

StreamChatSwiftUI.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3835,8 +3835,8 @@
38353835
isa = XCRemoteSwiftPackageReference;
38363836
repositoryURL = "https://github.com/GetStream/stream-chat-swift.git";
38373837
requirement = {
3838-
kind = upToNextMajorVersion;
3839-
minimumVersion = 4.69.0;
3838+
branch = develop;
3839+
kind = branch;
38403840
};
38413841
};
38423842
E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = {

StreamChatSwiftUITests/Infrastructure/TestTools/ViewFrameUtils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ extension View {
1212
height: defaultScreenSize.height
1313
)
1414
}
15+
16+
func applySize(_ size: CGSize) -> some View {
17+
frame(width: size.width, height: size.height)
18+
}
1519
}

StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ class QuotedMessageView_Tests: StreamChatTestCase {
4646
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
4747
}
4848

49+
func test_quotedMessageView_deletedSnapshot() {
50+
// Given
51+
let viewSize = CGSize(width: 200, height: 50)
52+
let message = ChatMessage.mock(text: "Hello", deletedAt: .unique)
53+
let view = QuotedMessageView(
54+
factory: DefaultViewFactory.shared,
55+
quotedMessage: message,
56+
fillAvailableSpace: true,
57+
forceLeftToRight: true
58+
)
59+
.applySize(viewSize)
60+
61+
AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: viewSize)
62+
}
63+
4964
func test_quotedMessageView_voiceAttachmentSnapshot() {
5065
// Given
5166
let payload = VoiceRecordingAttachmentPayload(
Loading
Loading

0 commit comments

Comments
 (0)