mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Address the real lifetime issue of the SDK's Client by making Context.mediaProvider weak. (#4466)
This reverts commit 927aea4bfe.
This commit is contained in:
@@ -17,7 +17,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
private let networkMonitor: NetworkMonitorProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
let mediaLoader: MediaLoaderProtocol
|
||||
private let mediaLoader: MediaLoaderProtocol
|
||||
private let clientQueue: DispatchQueue
|
||||
|
||||
private var roomListService: RoomListService
|
||||
@@ -1113,6 +1113,20 @@ 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 {
|
||||
protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
var actionsPublisher: AnyPublisher<ClientProxyAction, Never> { get }
|
||||
|
||||
var loadingStatePublisher: CurrentValuePublisher<ClientProxyLoadingState, Never> { get }
|
||||
@@ -103,8 +103,6 @@ protocol ClientProxyProtocol: AnyObject {
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user