Revert weak media provider (#4483)

* Revert "Address the real lifetime issue of the SDK's `Client` by making `Context.mediaProvider` weak. (#4466)"

This reverts commit c794144ef1.

* Better docs.
This commit is contained in:
Doug
2025-09-08 17:48:58 +01:00
committed by GitHub
parent 90504d89c8
commit 2f2e6f6226
58 changed files with 161 additions and 380 deletions
@@ -17,7 +17,7 @@ class ClientProxy: ClientProxyProtocol {
private let networkMonitor: NetworkMonitorProtocol
private let appSettings: AppSettings
private let mediaLoader: MediaLoaderProtocol
let mediaLoader: MediaLoaderProtocol
private let clientQueue: DispatchQueue
private var roomListService: RoomListService
@@ -1117,20 +1117,6 @@ class ClientProxy: ClientProxyProtocol {
}
}
extension ClientProxy: MediaLoaderProtocol {
func loadMediaContentForSource(_ source: MediaSourceProxy) async throws -> Data {
try await mediaLoader.loadMediaContentForSource(source)
}
func loadMediaThumbnailForSource(_ source: MediaSourceProxy, width: UInt, height: UInt) async throws -> Data {
try await mediaLoader.loadMediaThumbnailForSource(source, width: width, height: height)
}
func loadMediaFileForSource(_ source: MediaSourceProxy, filename: String?) async throws -> MediaFileHandleProxy {
try await mediaLoader.loadMediaFileForSource(source, filename: filename)
}
}
private class ClientDelegateWrapper: ClientDelegate {
private let authErrorCallback: (Bool) -> Void
@@ -73,7 +73,7 @@ enum TimelineMediaVisibility: Decodable {
}
// sourcery: AutoMockable
protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
protocol ClientProxyProtocol: AnyObject {
var actionsPublisher: AnyPublisher<ClientProxyAction, Never> { get }
var loadingStatePublisher: CurrentValuePublisher<ClientProxyLoadingState, Never> { get }
@@ -105,6 +105,8 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
var pusherNotificationClientIdentifier: String? { get }
var mediaLoader: MediaLoaderProtocol { get }
var roomSummaryProvider: RoomSummaryProviderProtocol { get }
/// Used for listing rooms that shouldn't be affected by the main `roomSummaryProvider` filtering