mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Fix strong reference cycle between RoomProxy and RoomTimelineProvider
This commit is contained in:
parent
40d80e1b90
commit
e2af796d4a
@ -35,11 +35,6 @@ class RoomProxy: RoomProxyProtocol {
|
||||
private(set) var displayName: String?
|
||||
|
||||
private var backPaginationOutcome: PaginationOutcome?
|
||||
private(set) lazy var timelineProvider: RoomTimelineProviderProtocol = {
|
||||
let provider = RoomTimelineProvider(roomProxy: self)
|
||||
addTimelineListener(listener: WeakRoomTimelineProviderWrapper(timelineProvider: provider))
|
||||
return provider
|
||||
}()
|
||||
|
||||
deinit {
|
||||
room.removeTimeline()
|
||||
@ -146,7 +141,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func addTimelineListener(listener: TimelineListener) {
|
||||
func addTimelineListener(listener: TimelineListener) {
|
||||
room.addTimelineListener(listener: listener)
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,6 @@ protocol RoomProxyProtocol {
|
||||
|
||||
var avatarURL: String? { get }
|
||||
|
||||
var timelineProvider: RoomTimelineProviderProtocol { get }
|
||||
|
||||
func avatarURLStringForUserId(_ userId: String) -> String?
|
||||
|
||||
func loadAvatarURLForUserId(_ userId: String) async -> Result<String?, RoomProxyError>
|
||||
@ -56,6 +54,8 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func loadDisplayName() async -> Result<String, RoomProxyError>
|
||||
|
||||
func addTimelineListener(listener: TimelineListener)
|
||||
|
||||
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result<Void, RoomProxyError>
|
||||
|
@ -41,6 +41,10 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
init(roomProxy: RoomProxyProtocol) {
|
||||
self.roomProxy = roomProxy
|
||||
itemProxies = []
|
||||
|
||||
Task {
|
||||
await roomProxy.addTimelineListener(listener: WeakRoomTimelineProviderWrapper(timelineProvider: self))
|
||||
}
|
||||
}
|
||||
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineProviderError> {
|
||||
|
@ -126,10 +126,10 @@ class UserSessionFlowCoordinator: Coordinator {
|
||||
mediaProvider: userSession.mediaProvider,
|
||||
roomProxy: roomProxy,
|
||||
attributedStringBuilder: AttributedStringBuilder())
|
||||
|
||||
|
||||
let timelineController = RoomTimelineController(userId: userId,
|
||||
roomId: roomIdentifier,
|
||||
timelineProvider: roomProxy.timelineProvider,
|
||||
timelineProvider: RoomTimelineProvider(roomProxy: roomProxy),
|
||||
timelineItemFactory: timelineItemFactory,
|
||||
mediaProvider: userSession.mediaProvider,
|
||||
roomProxy: roomProxy)
|
||||
|
1
changelog.d/216.bugfix
Normal file
1
changelog.d/216.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix strong reference cycle between RoomProxy and RoomTimelineProvider
|
Loading…
x
Reference in New Issue
Block a user