Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Make `VoiceRecordingButton` public [#658](https://github.com/GetStream/stream-chat-swiftui/pull/658)
### 🐞 Fixed
- Fix message long press taking too much time to show actions [#648](https://github.com/GetStream/stream-chat-swiftui/pull/648)
- Fix rendering link attachment preview with other attachment types [#659](https://github.com/GetStream/stream-chat-swiftui/pull/659)
### 🔄 Changed
- Message composer now uses `.uploadFile` capability when showing attachment picker icon [#646](https://github.com/GetStream/stream-chat-swiftui/pull/646)
- `ChannelInfoView` now uses `.updateChannelMembers` capability to show "Add Users" button [#651](https://github.com/GetStream/stream-chat-swiftui/pull/651)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public struct MessageView<Factory: ViewFactory>: View {
} else if let poll = message.poll {
factory.makePollView(message: message, poll: poll, isFirst: isFirst)
} else if !message.attachmentCounts.isEmpty {
if messageTypeResolver.hasLinkAttachment(message: message) {
let hasOnlyLinks = { message.attachmentCounts.keys.allSatisfy { $0 == .linkPreview } }
if messageTypeResolver.hasLinkAttachment(message: message) && hasOnlyLinks() {
factory.makeLinkAttachmentView(
for: message,
isFirst: isFirst,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,33 @@ class MessageView_Tests: StreamChatTestCase {
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}

func test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments() {
// Given
let messageWithLinkAndImages = ChatMessage.mock(
id: .unique,
cid: .unique,
text: "https://getstream.io",
author: .mock(id: .unique),
attachments: [
ChatChannelTestHelpers.imageAttachments[0],
ChatChannelTestHelpers.videoAttachments[0]
]
)

// When
let view = MessageView(
factory: DefaultViewFactory.shared,
message: messageWithLinkAndImages,
contentWidth: defaultScreenSize.width,
isFirst: true,
scrolledId: .constant(nil)
)
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}

func test_deletedMessageView_snapshot() {
// Given
let message = ChatMessage.mock(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading