Stop storing the openURL action to fix a retain cycle.

Uses the existing timeline action instead.
This commit is contained in:
Doug
2025-09-03 12:32:11 +01:00
committed by Doug
parent af5ebf8cae
commit 86f978a439
3 changed files with 5 additions and 16 deletions
@@ -70,16 +70,11 @@ struct TimelineView: View {
/// A table view wrapper that displays the timeline of a room.
struct TimelineViewRepresentable: UIViewControllerRepresentable {
@EnvironmentObject private var viewModelContext: TimelineViewModel.Context
@Environment(\.openURL) var openURL
func makeUIViewController(context: Context) -> TimelineTableViewController {
let tableViewController = TimelineTableViewController(coordinator: context.coordinator,
isScrolledToBottom: $viewModelContext.isScrolledToBottom,
scrollToBottomPublisher: viewModelContext.viewState.timelineState.scrollToBottomPublisher)
// Needs to be dispatched on main asynchronously otherwise we get a runtime warning
DispatchQueue.main.async {
viewModelContext.send(viewAction: .setOpenURLAction(openURL))
}
return tableViewController
}