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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Allow pasting images to the composer [#797](https://github.com/GetStream/stream-chat-swiftui/pull/797)
### 🐞 Fixed
- Fix allowing to send Polls when the current user does not have the capability [#798](https://github.com/GetStream/stream-chat-swiftui/pull/798)
- Fix showing a double error indicator when sending attachments without any text [#799](https://github.com/GetStream/stream-chat-swiftui/pull/799)
- Fix showing read indicator when message failed to be sent [#799](https://github.com/GetStream/stream-chat-swiftui/pull/799)
- Fix not showing sending indicator when message is in sending state [#799](https://github.com/GetStream/stream-chat-swiftui/pull/799)

# [4.76.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.76.0)
_March 31, 2025_
Expand Down
3 changes: 2 additions & 1 deletion DemoAppSwiftUI/PinChannelHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ struct DemoAppChatChannelListItem: View {
currentUserId: chatClient.currentUserId,
message: channel.latestMessages.first
),
showReadCount: false
showReadCount: false,
localState: channel.latestMessages.first?.localState
)
}
SubtitleText(text: injectedChannelInfo?.timestamp ?? channel.timestampText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
)
: nil

(message.localState == .sendingFailed || message.isBounced) ? SendFailureIndicator() : nil
((message.localState == .sendingFailed || message.isBounced) && !message.text.isEmpty) ?
SendFailureIndicator() : nil
}
)
.background(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public struct MessageReadIndicatorView: View {
.customizable()
.foregroundColor(!readUsers.isEmpty ? colors.tintColor : Color(colors.textLowEmphasis))
.frame(height: 16)
.opacity(localState == .sendingFailed ? 0.0 : 1)
.accessibilityLabel(
Text(
readUsers.isEmpty ? L10n.Message.ReadStatus.seenByNoOne : L10n.Message.ReadStatus.seenByOthers
Expand All @@ -136,7 +137,12 @@ public struct MessageReadIndicatorView: View {
}

private var image: UIImage {
!readUsers.isEmpty ? images.readByAll : (localState == .pendingSend ? images.messageReceiptSending : images.messageSent)
!readUsers.isEmpty ? images.readByAll : (isMessageSending ? images.messageReceiptSending : images.messageSent)
}

private var isMessageSending: Bool {
localState == .sending
|| localState == .pendingSend
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ class ChatChannelTestHelpers {
return imageAttachments
}()

static func imageAttachment(state: LocalAttachmentState) -> AnyChatMessageAttachment {
let attachmentFile = AttachmentFile(type: .png, size: 0, mimeType: "image/png")
let uploadingState = AttachmentUploadingState(
localFileURL: testURL,
state: state,
file: attachmentFile
)
return ChatMessageImageAttachment(
id: .unique,
type: .image,
payload: ImageAttachmentPayload(
title: "test",
imageRemoteURL: testURL,
extraData: [:]
),
downloadingState: nil,
uploadingState: uploadingState
)
.asAnyAttachment
}

static var giphyAttachments: [AnyChatMessageAttachment] = {
let attachmentFile = AttachmentFile(type: .gif, size: 0, mimeType: "image/gif")
let uploadingState = AttachmentUploadingState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,43 @@ class MessageContainerView_Tests: StreamChatTestCase {
// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}


func test_imageAttachments_failed_snapshot() {
// Given
let message = ChatMessage.mock(
id: .unique,
cid: .unique,
text: "Test message",
author: .mock(id: .unique),
attachments: [ChatChannelTestHelpers.imageAttachment(state: .uploadingFailed)],
localState: .sendingFailed
)

// When
let view = testMessageViewContainer(message: message)

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

func test_imageAttachments_failedWhenMessageTextIsEmpty_snapshot() {
// Given
let message = ChatMessage.mock(
id: .unique,
cid: .unique,
text: "",
author: .mock(id: .unique),
attachments: [ChatChannelTestHelpers.imageAttachment(state: .uploadingFailed)],
localState: .sendingFailed
)

// When
let view = testMessageViewContainer(message: message)

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

func test_translatedText_participant_snapshot() {
// Given
let message = ChatMessage.mock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,30 @@ class MessageReadIndicatorView_Tests: StreamChatTestCase {
// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}

func test_messageReadIndicatorView_snapshotSending() {
// Given
let view = MessageReadIndicatorView(
readUsers: [],
showReadCount: false,
localState: .sending
)
.frame(width: 50, height: 16)

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

func test_messageReadIndicatorView_snapshotMessageFailed() {
// Given
let view = MessageReadIndicatorView(
readUsers: [],
showReadCount: false,
localState: .sendingFailed
)
.frame(width: 50, height: 16)

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading