|
5 | 5 | import StreamChat
|
6 | 6 | import SwiftUI
|
7 | 7 |
|
8 |
| -struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable { |
| 8 | +public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable { |
| 9 | + |
9 | 10 | @Injected(\.utils) private var utils
|
10 | 11 | @Injected(\.chatClient) private var chatClient
|
11 | 12 |
|
@@ -45,7 +46,37 @@ struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
|
45 | 46 |
|
46 | 47 | private let scrollAreaId = "scrollArea"
|
47 | 48 |
|
48 |
| - var body: some View { |
| 49 | + public init( |
| 50 | + factory: Factory, |
| 51 | + channel: ChatChannel, |
| 52 | + messages: LazyCachedMapCollection<ChatMessage>, |
| 53 | + messagesGroupingInfo: [String: [String]], |
| 54 | + scrolledId: Binding<String?>, |
| 55 | + showScrollToLatestButton: Binding<Bool>, |
| 56 | + quotedMessage: Binding<ChatMessage?>, |
| 57 | + currentDateString: String? = nil, |
| 58 | + listId: String, |
| 59 | + isMessageThread: Bool, |
| 60 | + onMessageAppear: @escaping (Int) -> Void, |
| 61 | + onScrollToBottom: @escaping () -> Void, |
| 62 | + onLongPress: @escaping (MessageDisplayInfo) -> Void |
| 63 | + ) { |
| 64 | + self.factory = factory |
| 65 | + self.channel = channel |
| 66 | + self.messages = messages |
| 67 | + self.messagesGroupingInfo = messagesGroupingInfo |
| 68 | + self.currentDateString = currentDateString |
| 69 | + self.listId = listId |
| 70 | + self.isMessageThread = isMessageThread |
| 71 | + self.onMessageAppear = onMessageAppear |
| 72 | + self.onScrollToBottom = onScrollToBottom |
| 73 | + self.onLongPress = onLongPress |
| 74 | + _scrolledId = scrolledId |
| 75 | + _showScrollToLatestButton = showScrollToLatestButton |
| 76 | + _quotedMessage = quotedMessage |
| 77 | + } |
| 78 | + |
| 79 | + public var body: some View { |
49 | 80 | ZStack {
|
50 | 81 | ScrollViewReader { scrollView in
|
51 | 82 | ScrollView {
|
|
0 commit comments