Skip to content

Commit 37a55e1

Browse files
made quoted message header injectable
1 parent 4a48cc9 commit 37a55e1

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
4141
public var body: some View {
4242
VStack(spacing: 0) {
4343
if quotedMessage != nil {
44-
QuotedMessageHeaderView(
44+
factory.makeQuotedMessageHeaderView(
4545
quotedMessage: $quotedMessage
4646
)
4747
}

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ extension ViewFactory {
478478
onActionExecuted: onActionExecuted
479479
)
480480
}
481+
482+
public func makeQuotedMessageHeaderView(
483+
quotedMessage: Binding<ChatMessage?>
484+
) -> some View {
485+
QuotedMessageHeaderView(quotedMessage: quotedMessage)
486+
}
481487
}
482488

483489
/// Default class conforming to `ViewFactory`, used throughout the SDK.

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public protocol ViewFactory: AnyObject {
436436
message: ChatMessage
437437
) -> MessageReactionViewType
438438

439-
associatedtype ReactionsOverlayViewType
439+
associatedtype ReactionsOverlayViewType: View
440440
/// Creates the reactions overlay view.
441441
/// - Parameters:
442442
/// - channel: the channel of the message.
@@ -452,4 +452,13 @@ public protocol ViewFactory: AnyObject {
452452
onBackgroundTap: @escaping () -> Void,
453453
onActionExecuted: @escaping (MessageActionInfo) -> Void
454454
) -> ReactionsOverlayViewType
455+
456+
associatedtype QuotedMessageHeaderViewType: View
457+
/// Creates the quoted message header view in the composer.
458+
/// - Parameters:
459+
/// - quotedMessage: the optional quoted message.
460+
/// - Returns: view displayed in the slot for quoted message in the composer.
461+
func makeQuotedMessageHeaderView(
462+
quotedMessage: Binding<ChatMessage?>
463+
) -> QuotedMessageHeaderViewType
455464
}

0 commit comments

Comments
 (0)