File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed
Sources/StreamChatSwiftUI
StreamChatSwiftUITests/Tests/Utils Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,7 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
166166 . accessibilityIdentifier ( " MessageView " )
167167
168168 if message. replyCount > 0 && !isInThread {
169- MessageRepliesView (
170- factory: factory,
169+ factory. makeMessageRepliesView (
171170 channel: channel,
172171 message: message,
173172 replyCount: message. replyCount
Original file line number Diff line number Diff line change @@ -442,6 +442,19 @@ extension ViewFactory {
442442 GiphyBadgeView ( )
443443 }
444444
445+ public func makeMessageRepliesView(
446+ channel: ChatChannel ,
447+ message: ChatMessage ,
448+ replyCount: Int
449+ ) -> some View {
450+ MessageRepliesView (
451+ factory: self ,
452+ channel: channel,
453+ message: message,
454+ replyCount: replyCount
455+ )
456+ }
457+
445458 public func makeMessageComposerViewType(
446459 with channelController: ChatChannelController ,
447460 messageController: ChatMessageController ? ,
Original file line number Diff line number Diff line change @@ -455,6 +455,19 @@ public protocol ViewFactory: AnyObject {
455455 availableWidth: CGFloat
456456 ) -> GiphyBadgeViewType
457457
458+ associatedtype MessageRepliesViewType : View
459+ /// Creates the message replies view.
460+ /// - Parameters:
461+ /// - channel: the channel where the message is sent.
462+ /// - message: the message that's being replied to.
463+ /// - replyCount: the current number of replies.
464+ /// - Returns: view displayed in the message replies view slot.
465+ func makeMessageRepliesView(
466+ channel: ChatChannel ,
467+ message: ChatMessage ,
468+ replyCount: Int
469+ ) -> MessageRepliesViewType
470+
458471 associatedtype MessageComposerViewType : View
459472 /// Creates the message composer view.
460473 /// - Parameters:
Original file line number Diff line number Diff line change @@ -715,6 +715,21 @@ class ViewFactory_Tests: StreamChatTestCase {
715715 // Then
716716 XCTAssert ( view is EmojiTextView < DefaultViewFactory > )
717717 }
718+
719+ func test_viewFactory_makeMessageRepliesView( ) {
720+ // Given
721+ let viewFactory = DefaultViewFactory . shared
722+
723+ // When
724+ let view = viewFactory. makeMessageRepliesView (
725+ channel: ChatChannel . mockDMChannel ( ) ,
726+ message: message,
727+ replyCount: 2
728+ )
729+
730+ // Then
731+ XCTAssert ( view is MessageRepliesView < DefaultViewFactory > )
732+ }
718733}
719734
720735extension ChannelAction : Equatable {
You can’t perform that action at this time.
0 commit comments