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
@@ -65,12 +65,7 @@ class StateStoreViewModel<State: BindableState, ViewAction> {
/// An optional image loading service so that views can manage themselves
/// Intentionally non-generic so that it doesn't grow uncontrollably
///
/// We noticed that the keyboard appears to hold onto the Context of the last screen that had text input focus:
/// https://github.com/element-hq/element-x-ios/issues/4465
/// Therefore this is `weak` so that the underlying `MatrixRustSDK.Client` isn't retained when e.g. clearing
/// the cache, otherwise we have the potential for 2 `Client`s to be alive at the same time causing havoc.
private(set) weak var mediaProvider: MediaProviderProtocol?
let mediaProvider: MediaProviderProtocol?
/// Set-able/Bindable access to the bindable state.
subscript<T>(dynamicMember keyPath: WritableKeyPath<State.BindStateType, T>) -> T {
@@ -67,12 +67,7 @@ class StateStoreViewModelV2<State: BindableState, ViewAction> {
/// An optional image loading service so that views can manage themselves
/// Intentionally non-generic so that it doesn't grow uncontrollably
///
/// We noticed that the keyboard appears to hold onto the Context of the last screen that had text input focus:
/// https://github.com/element-hq/element-x-ios/issues/4465
/// Therefore this is `weak` so that the underlying `MatrixRustSDK.Client` isn't retained when e.g. clearing
/// the cache, otherwise we have the potential for 2 `Client`s to be alive at the same time causing havoc.
private(set) weak var mediaProvider: MediaProviderProtocol?
let mediaProvider: MediaProviderProtocol?
/// Set-able access to the bindable state.
subscript<T>(dynamicMember keyPath: WritableKeyPath<State.BindStateType, T>) -> T {