Skip to content

4.78.0 Release #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 24, 2025
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: 0 additions & 1 deletion .github/actions/setup-ios-runtime/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ runs:
shell: bash
run: |
sudo rm -rfv ~/Library/Developer/CoreSimulator/* || true
brew install blacktop/tap/ipsw
bundle exec fastlane install_runtime ios:${{ inputs.version }}
sudo rm -rfv *.dmg || true
xcrun simctl list runtimes
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cron-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
env:
INSTALL_ALLURE: true
INSTALL_YEETD: true
INSTALL_IPSW: true
SKIP_MINT_BOOTSTRAP: true
- uses: ./.github/actions/setup-ios-runtime
if: ${{ matrix.setup_runtime }}
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### πŸ”„ Changed

# [4.78.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.78.0)
_April 24, 2025_

### βœ… Added
- Add factory methods for gallery and video player view [#808](https://github.com/GetStream/stream-chat-swiftui/pull/808)
- Add support for editing message attachments [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
### 🐞 Fixed
- Fix scrolling to the bottom when editing a message [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix having message edit action on Giphy messages [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix being able to long press an unsent Giphy message [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix being able to swipe to reply an unsent Giphy message [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix translated message showing original text in message actions overlay [#810](https://github.com/GetStream/stream-chat-swiftui/pull/810)

### πŸ”„ Changed
- Deprecated `ComposerConfig.attachmentPayloadConverter` in favour of `MessageComposerViewModel.convertAddedAssetsToPayloads()` [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)

# [4.77.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.77.0)
_April 10, 2025_

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ GEM
netrc (0.11.0)
nio4r (2.7.3)
nkf (0.2.0)
nokogiri (1.18.4)
nokogiri (1.18.8)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (9.1.0)
Expand Down
1 change: 1 addition & 0 deletions Githubfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export XCRESULTS_VERSION='1.19.1'
export YEETD_VERSION='1.0'
export MINT_VERSION='0.17.5'
export SONAR_VERSION='6.2.1.4610'
export IPSW_VERSION='3.1.592'
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.77.0"),
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.78.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://sonarcloud.io/summary/new_code?id=GetStream_stream-chat-swiftui"><img src="https://sonarcloud.io/api/project_badges/measure?project=GetStream_stream-chat-swiftui&metric=coverage" /></a>

<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-8.21%20MB-blue"/>
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-8.29%20MB-blue"/>
</p>

## SwiftUI StreamChat SDK
Expand Down
9 changes: 9 additions & 0 deletions Scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ if [[ ${INSTALL_YEETD-default} == true ]]; then
puts "Running yeetd daemon"
yeetd &
fi

if [[ ${INSTALL_IPSW-default} == true ]]; then
puts "Install ipsw v${IPSW_VERSION}"
FILE="ipsw_${IPSW_VERSION}_macOS_universal.tar.gz"
wget "https://github.com/blacktop/ipsw/releases/download/v${IPSW_VERSION}/${FILE}"
tar -xzf "$FILE"
chmod +x ipsw
sudo mv ipsw /usr/local/bin/
fi
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public struct MediaAttachmentsView<Factory: ViewFactory>: View {
if !mediaItem.isVideo, let imageAttachment = mediaItem.imageAttachment {
let index = viewModel.allImageAttachments.firstIndex { $0.id == imageAttachment.id } ?? 0
ImageAttachmentContentView(
factory: factory,
mediaItem: mediaItem,
imageAttachment: imageAttachment,
allImageAttachments: viewModel.allImageAttachments,
Expand All @@ -66,8 +67,9 @@ public struct MediaAttachmentsView<Factory: ViewFactory>: View {
)
} else if let videoAttachment = mediaItem.videoAttachment {
VideoAttachmentContentView(
factory: factory,
attachment: videoAttachment,
author: mediaItem.author,
message: mediaItem.message,
width: Self.itemWidth,
ratio: 1,
cornerRadius: 0
Expand All @@ -78,9 +80,9 @@ public struct MediaAttachmentsView<Factory: ViewFactory>: View {
BottomRightView {
factory.makeMessageAvatarView(
for: UserDisplayInfo(
id: mediaItem.author.id,
name: mediaItem.author.name ?? "",
imageURL: mediaItem.author.imageURL,
id: mediaItem.message.author.id,
name: mediaItem.message.author.name ?? "",
imageURL: mediaItem.message.author.imageURL,
size: .init(width: 24, height: 24)
)
)
Expand Down Expand Up @@ -108,10 +110,11 @@ public struct MediaAttachmentsView<Factory: ViewFactory>: View {
}
}

struct ImageAttachmentContentView: View {
struct ImageAttachmentContentView<Factory: ViewFactory>: View {

@State private var galleryShown = false

let factory: Factory
let mediaItem: MediaItem
let imageAttachment: ChatMessageImageAttachment
let allImageAttachments: [ChatMessageImageAttachment]
Expand All @@ -134,11 +137,11 @@ struct ImageAttachmentContentView: View {
.clipped()
}
.fullScreenCover(isPresented: $galleryShown) {
GalleryView(
imageAttachments: allImageAttachments,
author: mediaItem.author,
factory.makeGalleryView(
mediaAttachments: allImageAttachments.map { MediaAttachment(from: $0) },
message: mediaItem.message,
isShown: $galleryShown,
selected: index
options: .init(selectedIndex: index)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MediaAttachmentsViewModel: ObservableObject, ChatMessageSearchControllerDe
let mediaItem = MediaItem(
id: imageAttachment.id.rawValue,
isVideo: false,
author: message.author,
message: message,
videoAttachment: nil,
imageAttachment: imageAttachment
)
Expand All @@ -94,7 +94,7 @@ class MediaAttachmentsViewModel: ObservableObject, ChatMessageSearchControllerDe
let mediaItem = MediaItem(
id: videoAttachment.id.rawValue,
isVideo: true,
author: message.author,
message: message,
videoAttachment: videoAttachment,
imageAttachment: nil
)
Expand All @@ -110,7 +110,7 @@ class MediaAttachmentsViewModel: ObservableObject, ChatMessageSearchControllerDe
struct MediaItem: Identifiable {
let id: String
let isVideo: Bool
let author: ChatUser
let message: ChatMessage

var videoAttachment: ChatMessageVideoAttachment?
var imageAttachment: ChatMessageImageAttachment?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
messageController: viewModel.messageController,
quotedMessage: $viewModel.quotedMessage,
editedMessage: $viewModel.editedMessage,
onMessageSent: viewModel.scrollToLastMessage
onMessageSent: {
viewModel.messageSentTapped()
}
)
.opacity((
utils.messageListConfig.messagePopoverEnabled && messageDisplayInfo != nil && !viewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,15 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
}
}
}


/// The user tapped on the message sent button.
public func messageSentTapped() {
// only scroll if the message is not being edited
if editedMessage == nil {
scrollToLastMessage()
}
}

public func jumpToMessage(messageId: String) -> Bool {
if messageId == .unknownMessageId {
if firstUnreadMessageId == nil, let lastReadMessageId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public struct ComposerConfig {
public var inputPaddingsConfig: PaddingsConfig
public var adjustMessageOnSend: (String) -> (String)
public var adjustMessageOnRead: (String) -> (String)

@available(
*,
deprecated,
message: """
Override the MessageComposerViewModel.inputAttachmentsAsPayloads() in order to convert the message attachments to payloads.
"""
)
public var attachmentPayloadConverter: (ChatMessage) -> [AnyAttachmentPayload]

public init(
Expand Down Expand Up @@ -44,8 +52,9 @@ public struct ComposerConfig {
self.isVoiceRecordingEnabled = isVoiceRecordingEnabled
}

public static var defaultAttachmentPayloadConverter: (ChatMessage) -> [AnyAttachmentPayload] = { message in
message.allAttachments.toAnyAttachmentPayload()
public static var defaultAttachmentPayloadConverter: (ChatMessage) -> [AnyAttachmentPayload] = { _ in
/// This now returns empty array by default since attachmentPayloadConverter has been deprecated.
[]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,34 @@ public struct AddedAsset: Identifiable, Equatable {
public let url: URL
public let type: AssetType
public var extraData: [String: RawJSON] = [:]


/// The payload of the attachment, in case the attachment has been uploaded to server already.
/// This is mostly used when editing an existing message that contains attachments.
public var payload: AttachmentPayload?

public init(
image: UIImage,
id: String,
url: URL,
type: AssetType,
extraData: [String: RawJSON] = [:]
extraData: [String: RawJSON] = [:],
payload: AttachmentPayload? = nil
) {
self.image = image
self.id = id
self.url = url
self.type = type
self.extraData = extraData
self.payload = payload
}
}

extension AddedAsset {
func toAttachmentPayload() throws -> AnyAttachmentPayload {
try AnyAttachmentPayload(
if let payload = self.payload {
return AnyAttachmentPayload(payload: payload)
}
return try AnyAttachmentPayload(
localFileURL: url,
attachmentType: type == .video ? .video : .image,
extraData: extraData
Expand All @@ -63,7 +72,8 @@ extension AnyChatMessageAttachment {
id: imageAttachment.id.rawValue,
url: imageAttachment.imageURL,
type: .image,
extraData: imageAttachment.extraData ?? [:]
extraData: imageAttachment.extraData ?? [:],
payload: imageAttachment.payload
)
} else if let videoAttachment = attachment(payloadType: VideoAttachmentPayload.self),
let thumbnail = imageThumbnail(for: videoAttachment.payload) {
Expand All @@ -72,7 +82,8 @@ extension AnyChatMessageAttachment {
id: videoAttachment.id.rawValue,
url: videoAttachment.videoURL,
type: .video,
extraData: videoAttachment.extraData ?? [:]
extraData: videoAttachment.extraData ?? [:],
payload: videoAttachment.payload
)
}
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
quotedMessage: quotedMessage,
editedMessage: editedMessage
) {
// Calling onMessageSent() before erasing the edited and quoted message
// so that onMessageSent can use them for state handling.
onMessageSent()
quotedMessage = nil
editedMessage = nil
onMessageSent()
}
}
.environmentObject(viewModel)
Expand Down Expand Up @@ -208,11 +210,10 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
)
.modifier(factory.makeComposerViewModifier())
.onChange(of: editedMessage) { _ in
viewModel.text = editedMessage?.text ?? ""
viewModel.fillEditedMessage(editedMessage)
if editedMessage != nil {
becomeFirstResponder()
editedMessageWillShow = true
viewModel.selectedRangeLocation = editedMessage?.text.count ?? 0
}
}
.onAppear(perform: {
Expand Down
Loading
Loading