diff --git a/CHANGELOG.md b/CHANGELOG.md index d52619b84..580f596bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### 🐞 Fixed - Use bright color for typing indicator animation in dark mode [#702](https://github.com/GetStream/stream-chat-swiftui/pull/702) +- Refresh quoted message preview when the quoted message is deleted [#705](https://github.com/GetStream/stream-chat-swiftui/pull/705) # [4.69.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.69.0) _December 18, 2024_ diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift index 0b0513a9c..e2471b7d3 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift @@ -193,6 +193,9 @@ extension View { public func textColor(for message: ChatMessage) -> Color { @Injected(\.colors) var colors + if message.isDeleted { + return Color(colors.textLowEmphasis) + } if message.isSentByCurrentUser { return Color(colors.messageCurrentUserTextColor) } else { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift index a092e9656..8cf0cbb23 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift @@ -178,8 +178,9 @@ public struct QuotedMessageView: View { } private var textForMessage: String { - if !quotedMessage.text.isEmpty { - return quotedMessage.adjustedText + let textContent = quotedMessage.textContent ?? "" + if !textContent.isEmpty { + return textContent } if !quotedMessage.imageAttachments.isEmpty { diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index 5994d71bb..aa9ba665c 100644 --- a/StreamChatSwiftUI.xcodeproj/project.pbxproj +++ b/StreamChatSwiftUI.xcodeproj/project.pbxproj @@ -3835,8 +3835,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/GetStream/stream-chat-swift.git"; requirement = { - kind = upToNextMajorVersion; - minimumVersion = 4.69.0; + branch = develop; + kind = branch; }; }; E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { diff --git a/StreamChatSwiftUITests/Infrastructure/TestTools/ViewFrameUtils.swift b/StreamChatSwiftUITests/Infrastructure/TestTools/ViewFrameUtils.swift index 78c0e2ff6..9add0d939 100644 --- a/StreamChatSwiftUITests/Infrastructure/TestTools/ViewFrameUtils.swift +++ b/StreamChatSwiftUITests/Infrastructure/TestTools/ViewFrameUtils.swift @@ -12,4 +12,8 @@ extension View { height: defaultScreenSize.height ) } + + func applySize(_ size: CGSize) -> some View { + frame(width: size.width, height: size.height) + } } diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift index d2e9bffa8..31a1f6082 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/QuotedMessageView_Tests.swift @@ -46,6 +46,21 @@ class QuotedMessageView_Tests: StreamChatTestCase { assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } + func test_quotedMessageView_deletedSnapshot() { + // Given + let viewSize = CGSize(width: 200, height: 50) + let message = ChatMessage.mock(text: "Hello", deletedAt: .unique) + let view = QuotedMessageView( + factory: DefaultViewFactory.shared, + quotedMessage: message, + fillAvailableSpace: true, + forceLeftToRight: true + ) + .applySize(viewSize) + + AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: viewSize) + } + func test_quotedMessageView_voiceAttachmentSnapshot() { // Given let payload = VoiceRecordingAttachmentPayload( diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-dark.png new file mode 100644 index 000000000..2b41a52e1 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-light.png new file mode 100644 index 000000000..6e07b13fa Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/QuotedMessageView_Tests/test_quotedMessageView_deletedSnapshot.default-light.png differ