File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed
Sources/StreamChatSwiftUI
StreamChatSwiftUITests/Tests/Utils Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,7 @@ public struct MessageView<Factory: ViewFactory>: View {
88
88
}
89
89
} else {
90
90
if message. shouldRenderAsJumbomoji {
91
- EmojiTextView (
92
- factory: factory,
91
+ factory. makeEmojiTextView (
93
92
message: message,
94
93
scrolledId: $scrolledId,
95
94
isFirst: isFirst
Original file line number Diff line number Diff line change @@ -395,6 +395,19 @@ extension ViewFactory {
395
395
SystemMessageView ( message: message. text)
396
396
}
397
397
398
+ public func makeEmojiTextView(
399
+ message: ChatMessage ,
400
+ scrolledId: Binding < String ? > ,
401
+ isFirst: Bool
402
+ ) -> some View {
403
+ EmojiTextView (
404
+ factory: self ,
405
+ message: message,
406
+ scrolledId: scrolledId,
407
+ isFirst: isFirst
408
+ )
409
+ }
410
+
398
411
public func makeCustomAttachmentViewType(
399
412
for message: ChatMessage ,
400
413
isFirst: Bool ,
Original file line number Diff line number Diff line change @@ -393,6 +393,18 @@ public protocol ViewFactory: AnyObject {
393
393
/// - Returns: view displayed when a system message appears.
394
394
func makeSystemMessageView( message: ChatMessage ) -> SystemMessageViewType
395
395
396
+ associatedtype EmojiTextViewType : View
397
+ /// Creates the view displaying emojis.
398
+ /// - Parameters:
399
+ /// - message: the deleted message that will be displayed with indicator.
400
+ /// - scrolledId: Identifier for the message that should be scrolled to.
401
+ /// - isFirst: whether it is first in the group (latest creation date).
402
+ func makeEmojiTextView(
403
+ message: ChatMessage ,
404
+ scrolledId: Binding < String ? > ,
405
+ isFirst: Bool
406
+ ) -> EmojiTextViewType
407
+
396
408
associatedtype CustomAttachmentViewType : View
397
409
/// Creates custom attachment view.
398
410
/// If support for more than one custom view is needed, just do if-else check inside the view.
Original file line number Diff line number Diff line change @@ -700,6 +700,21 @@ class ViewFactory_Tests: StreamChatTestCase {
700
700
// Then
701
701
XCTAssert ( view is EmptyView )
702
702
}
703
+
704
+ func test_viewFactory_makeEmojiTextView( ) {
705
+ // Given
706
+ let viewFactory = DefaultViewFactory . shared
707
+
708
+ // When
709
+ let view = viewFactory. makeEmojiTextView (
710
+ message: message,
711
+ scrolledId: . constant( nil ) ,
712
+ isFirst: true
713
+ )
714
+
715
+ // Then
716
+ XCTAssert ( view is EmojiTextView < DefaultViewFactory > )
717
+ }
703
718
}
704
719
705
720
extension ChannelAction : Equatable {
You can’t perform that action at this time.
0 commit comments