Skip to content

4.75.0 Release #792

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
Mar 26, 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
4 changes: 2 additions & 2 deletions .github/workflows/cron-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
strategy:
matrix:
include:
- ios: 18.1
xcode: 16.1 # fails on 16.2
- ios: 18.2
xcode: 16.2
os: macos-15
device: "iPhone 16 Pro"
setup_runtime: false
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/smoke-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ jobs:
- build-test-app-and-frameworks
env:
LAUNCH_ID: ${{ needs.allure_testops_launch.outputs.launch_id }}
XCODE_VERSION: "16.1" # fails on 16.2
IOS_SIMULATOR_DEVICE: "iPhone 16 Pro (18.1)"
strategy:
matrix:
batch: [0, 1]
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### 🔄 Changed

# [4.75.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.75.0)
_March 26, 2025_

### ✅ Added
- Add avatar customization in add users popup [#787](https://github.com/GetStream/stream-chat-swiftui/pull/787)
- Add support for Draft Messages when `Utils.messageListConfig.draftMessagesEnabled` is `true` [#775](https://github.com/GetStream/stream-chat-swiftui/pull/775)
- Add draft preview in Channel List and Thread List if drafts are enabled [#775](https://github.com/GetStream/stream-chat-swiftui/pull/775)

# [4.74.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.74.0)
_March 14, 2025_

Expand Down
3 changes: 2 additions & 1 deletion DemoAppSwiftUI/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class AppDelegate: NSObject, UIApplicationDelegate {
bouncedMessagesAlertActionsEnabled: true,
skipEditedMessageLabel: { message in
message.extraData["ai_generated"]?.boolValue == true
}
},
draftMessagesEnabled: true
),
composerConfig: ComposerConfig(isVoiceRecordingEnabled: true)
)
Expand Down
3 changes: 2 additions & 1 deletion DemoAppSwiftUI/AppleMessageComposerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ struct AppleMessageComposerView<Factory: ViewFactory>: View, KeyboardReadable {
channelConfig = channelController.channel?.config
let vm = viewModel ?? ViewModelsFactory.makeMessageComposerViewModel(
with: channelController,
messageController: messageController
messageController: messageController,
quotedMessage: quotedMessage
)
_viewModel = StateObject(
wrappedValue: vm
Expand Down
11 changes: 10 additions & 1 deletion DemoAppSwiftUI/PinChannelHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,16 @@ struct DemoAppChatChannelListItem: View {
TypingIndicatorView()
}
}
SubtitleText(text: injectedChannelInfo?.subtitle ?? channel.subtitleText)
if let draftText = channel.draftMessageText {
HStack(spacing: 2) {
Text("Draft:")
.font(fonts.caption1).bold()
.foregroundColor(Color(colors.highlightedAccentBackground))
SubtitleText(text: draftText)
}
} else {
SubtitleText(text: injectedChannelInfo?.subtitle ?? channel.subtitleText)
}
Spacer()
}
.accessibilityIdentifier("subtitleView")
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.3)
nokogiri (1.18.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (9.1.0)
Expand Down
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.74.0"),
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.75.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.18%20MB-blue"/>
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-8.19%20MB-blue"/>
</p>

## SwiftUI StreamChat SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,47 @@ import StreamChat
import SwiftUI

/// View for the add users popup.
struct AddUsersView: View {
struct AddUsersView<Factory: ViewFactory>: View {

@Injected(\.fonts) private var fonts
@Injected(\.colors) private var colors

private static let columnCount = 4
private static let itemSize: CGFloat = 64

private let columns = Array(
repeating:
GridItem(
.adaptive(minimum: itemSize),
.adaptive(minimum: 64),
alignment: .top
),
count: columnCount
count: 4
)

private let factory: Factory

@StateObject private var viewModel: AddUsersViewModel
var onUserTap: (ChatUser) -> Void

init(
factory: Factory = DefaultViewFactory.shared,
loadedUserIds: [String],
onUserTap: @escaping (ChatUser) -> Void
) {
_viewModel = StateObject(
wrappedValue: AddUsersViewModel(loadedUserIds: loadedUserIds)
)
self.onUserTap = onUserTap
self.factory = factory
}

init(
factory: Factory = DefaultViewFactory.shared,
viewModel: AddUsersViewModel,
onUserTap: @escaping (ChatUser) -> Void
) {
_viewModel = StateObject(
wrappedValue: viewModel
)
self.onUserTap = onUserTap
self.factory = factory
}

var body: some View {
Expand All @@ -57,17 +60,20 @@ struct AddUsersView: View {
onUserTap(user)
} label: {
VStack {
MessageAvatarView(
avatarURL: user.imageURL,
size: CGSize(width: Self.itemSize, height: Self.itemSize),
showOnlineIndicator: false
let itemSize: CGFloat = 64
let userDisplayInfo = UserDisplayInfo(
id: user.id,
name: user.name ?? "",
imageURL: user.imageURL,
size: CGSize(width: itemSize, height: itemSize)
)
factory.makeMessageAvatarView(for: userDisplayInfo)

Text(user.name ?? user.id)
.multilineTextAlignment(.center)
.lineLimit(2)
.font(fonts.footnoteBold)
.frame(width: Self.itemSize)
.frame(width: itemSize)
.foregroundColor(Color(colors.text))
}
.padding(.all, 8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
viewModel.addUsersShown = false
}
AddUsersView(
factory: factory,
loadedUserIds: viewModel.participants.map(\.id),
onUserTap: viewModel.addUserTapped(_:)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright © 2025 Stream.io Inc. All rights reserved.
//

import AVFoundation
import StreamChat
import SwiftUI

Expand Down Expand Up @@ -52,6 +53,48 @@ extension AddedAsset {
}
}

extension AnyChatMessageAttachment {
func toAddedAsset() -> AddedAsset? {
if let imageAttachment = attachment(payloadType: ImageAttachmentPayload.self),
let imageData = try? Data(contentsOf: imageAttachment.imageURL),
let image = UIImage(data: imageData) {
return AddedAsset(
image: image,
id: imageAttachment.id.rawValue,
url: imageAttachment.imageURL,
type: .image,
extraData: imageAttachment.extraData ?? [:]
)
} else if let videoAttachment = attachment(payloadType: VideoAttachmentPayload.self),
let thumbnail = imageThumbnail(for: videoAttachment.payload) {
return AddedAsset(
image: thumbnail,
id: videoAttachment.id.rawValue,
url: videoAttachment.videoURL,
type: .video,
extraData: videoAttachment.extraData ?? [:]
)
}
return nil
}

private func imageThumbnail(for videoAttachmentPayload: VideoAttachmentPayload) -> UIImage? {
if let thumbnailURL = videoAttachmentPayload.thumbnailURL, let data = try? Data(contentsOf: thumbnailURL) {
return UIImage(data: data)
}
let asset = AVURLAsset(url: videoAttachmentPayload.videoURL, options: nil)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
guard let cgImage = try? imageGenerator.copyCGImage(
at: CMTimeMake(value: 0, timescale: 1),
actualTime: nil
) else {
return nil
}
return UIImage(cgImage: cgImage)
}
}

/// Type of asset added to the composer.
public enum AssetType {
case image
Expand Down Expand Up @@ -92,3 +135,16 @@ public struct AddedVoiceRecording: Identifiable, Equatable {
self.waveform = waveform
}
}

extension AnyChatMessageAttachment {
func toAddedVoiceRecording() -> AddedVoiceRecording? {
guard let voiceAttachment = attachment(payloadType: VoiceRecordingAttachmentPayload.self) else { return nil }
guard let duration = voiceAttachment.duration else { return nil }
guard let waveform = voiceAttachment.waveformData else { return nil }
return AddedVoiceRecording(
url: voiceAttachment.voiceRecordingURL,
duration: duration,
waveform: waveform
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
private var channelConfig: ChannelConfig?
@Binding var quotedMessage: ChatMessage?
@Binding var editedMessage: ChatMessage?

private let recordingViewHeight: CGFloat = 80

public init(
Expand All @@ -37,7 +37,8 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
_viewModel = StateObject(
wrappedValue: viewModel ?? ViewModelsFactory.makeMessageComposerViewModel(
with: channelController,
messageController: messageController
messageController: messageController,
quotedMessage: quotedMessage
)
)
_quotedMessage = quotedMessage
Expand Down Expand Up @@ -214,6 +215,12 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
viewModel.selectedRangeLocation = editedMessage?.text.count ?? 0
}
}
.onAppear(perform: {
viewModel.fillDraftMessage()
})
.onDisappear(perform: {
viewModel.updateDraftMessage(quotedMessage: quotedMessage)
})
.accessibilityElement(children: .contain)
}
}
Expand Down
Loading
Loading