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 {
166
166
. accessibilityIdentifier ( " MessageView " )
167
167
168
168
if message. replyCount > 0 && !isInThread {
169
- MessageRepliesView (
170
- factory: factory,
169
+ factory. makeMessageRepliesView (
171
170
channel: channel,
172
171
message: message,
173
172
replyCount: message. replyCount
Original file line number Diff line number Diff line change @@ -442,6 +442,19 @@ extension ViewFactory {
442
442
GiphyBadgeView ( )
443
443
}
444
444
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
+
445
458
public func makeMessageComposerViewType(
446
459
with channelController: ChatChannelController ,
447
460
messageController: ChatMessageController ? ,
Original file line number Diff line number Diff line change @@ -455,6 +455,19 @@ public protocol ViewFactory: AnyObject {
455
455
availableWidth: CGFloat
456
456
) -> GiphyBadgeViewType
457
457
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
+
458
471
associatedtype MessageComposerViewType : View
459
472
/// Creates the message composer view.
460
473
/// - Parameters:
Original file line number Diff line number Diff line change @@ -715,6 +715,21 @@ class ViewFactory_Tests: StreamChatTestCase {
715
715
// Then
716
716
XCTAssert ( view is EmojiTextView < DefaultViewFactory > )
717
717
}
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
+ }
718
733
}
719
734
720
735
extension ChannelAction : Equatable {
You can’t perform that action at this time.
0 commit comments