Skip to content

Commit 7e412fc

Browse files
committed
Remove cdnRequester and cdnStorage from ChatClient
CDN configuration is now only available through ChatClientConfig. Access via config.cdnRequester / config.cdnStorage instead.
1 parent 49ce1cd commit 7e412fc

3 files changed

Lines changed: 4 additions & 18 deletions

File tree

Sources/StreamChat/ChatClient.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ public class ChatClient: @unchecked Sendable {
4242
///
4343
public let config: ChatClientConfig
4444

45-
/// The CDN requester used for URL transformation (signing, headers, resizing)
46-
/// when loading images, videos, and downloading files.
47-
///
48-
/// Initialized from ``ChatClientConfig/cdnRequester``.
49-
/// Change this property at runtime to affect all subsequent media loads and downloads.
50-
public var cdnRequester: CDNRequester
51-
52-
/// The CDN storage used for uploading and deleting attachments.
53-
///
54-
/// Initialized from ``ChatClientConfig/cdnStorage``.
55-
public var cdnStorage: CDNStorage?
56-
5745
/// A `Worker` represents a single atomic piece of functionality.
5846
///
5947
/// `ChatClient` initializes a set of background workers that keep observing the current state of the system and perform
@@ -167,8 +155,6 @@ public class ChatClient: @unchecked Sendable {
167155
factory: ChatClientFactory
168156
) {
169157
self.config = config
170-
self.cdnRequester = config.cdnRequester
171-
self.cdnStorage = config.cdnStorage
172158
self.environment = environment
173159

174160
urlSessionConfiguration = factory.makeUrlSessionConfiguration()

Sources/StreamChat/Controllers/MessageController/MessageController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ public class ChatMessageController: DataController, DelegateCallable, DataStoreP
787787

788788
/// Downloads the specified attachment and stores it locally on the device.
789789
///
790-
/// The URL is automatically resolved through the client's ``ChatClient/cdnRequester``
790+
/// The URL is automatically resolved through ``ChatClientConfig/cdnRequester``
791791
/// for signing, authentication headers, or host rewriting before downloading.
792792
///
793793
/// - Parameters:
@@ -799,7 +799,7 @@ public class ChatMessageController: DataController, DelegateCallable, DataStoreP
799799
_ attachment: ChatMessageAttachment<Payload>,
800800
completion: @escaping @MainActor (Result<ChatMessageAttachment<Payload>, Error>) -> Void
801801
) where Payload: DownloadableAttachmentPayload {
802-
client.cdnRequester.fileRequest(for: attachment.remoteURL, options: .init()) { [weak self] result in
802+
client.config.cdnRequester.fileRequest(for: attachment.remoteURL, options: .init()) { [weak self] result in
803803
guard let self else { return }
804804
switch result {
805805
case let .success(cdnRequest):

Sources/StreamChat/StateLayer/Chat.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public class Chat: @unchecked Sendable {
419419

420420
/// Downloads the specified attachment and stores it locally on the device.
421421
///
422-
/// The URL is automatically resolved through the client's ``ChatClient/cdnRequester``
422+
/// The URL is automatically resolved through ``ChatClientConfig/cdnRequester``
423423
/// for signing, authentication headers, or host rewriting before downloading.
424424
///
425425
/// The local URL of the downloaded file:
@@ -438,7 +438,7 @@ public class Chat: @unchecked Sendable {
438438
@discardableResult public func downloadAttachment<Payload>(
439439
_ attachment: ChatMessageAttachment<Payload>
440440
) async throws -> ChatMessageAttachment<Payload> where Payload: DownloadableAttachmentPayload {
441-
let cdnRequest = try await client.cdnRequester.fileRequest(for: attachment.remoteURL)
441+
let cdnRequest = try await client.config.cdnRequester.fileRequest(for: attachment.remoteURL)
442442
return try await messageUpdater.downloadAttachment(attachment, remoteURL: cdnRequest.url)
443443
}
444444

0 commit comments

Comments
 (0)