mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
RoomScreenViewModel is now TimelineViewModel (#3157)
Co-authored-by: Stefan Ceriu <stefanc@matrix.org>
This commit is contained in:
@@ -18,7 +18,7 @@ import MatrixRustSDK
|
||||
import SwiftUI
|
||||
|
||||
final class MessageTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
var roomContext: RoomScreenViewModel.Context?
|
||||
var timelineContext: TimelineViewModel.Context?
|
||||
var updateClosure: (() -> Void)?
|
||||
private var pillViews = NSHashTable<UIView>.weakObjects()
|
||||
|
||||
@@ -54,7 +54,7 @@ final class MessageTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
|
||||
struct MessageText: UIViewRepresentable {
|
||||
@Environment(\.openURL) private var openURLAction
|
||||
@Environment(\.roomContext) private var viewModel
|
||||
@Environment(\.timelineContext) private var viewModel
|
||||
@State private var computedSizes = [Double: CGSize]()
|
||||
|
||||
@State var attributedString: AttributedString {
|
||||
@@ -66,7 +66,7 @@ struct MessageText: UIViewRepresentable {
|
||||
func makeUIView(context: Context) -> MessageTextView {
|
||||
// Need to use TextKit 1 for mentions
|
||||
let textView = MessageTextView(usingTextLayoutManager: false)
|
||||
textView.roomContext = viewModel
|
||||
textView.timelineContext = viewModel
|
||||
textView.updateClosure = { [weak textView] in
|
||||
guard let textView else { return }
|
||||
do {
|
||||
@@ -197,7 +197,7 @@ struct MessageText_Previews: PreviewProvider, TestablePreview {
|
||||
static var attachmentPreview: some View {
|
||||
MessageText(attributedString: attributedStringWithAttachment)
|
||||
.border(Color.purple)
|
||||
.environmentObject(RoomScreenViewModel.mock.context)
|
||||
.environmentObject(TimelineViewModel.mock.context)
|
||||
}
|
||||
|
||||
static var previews: some View {
|
||||
|
||||
Reference in New Issue
Block a user