19
19
import SwiftUI
20
20
import WireFoundation
21
21
22
- public final class MessageCell : UITableViewCell {
22
+ public final class MessageCell : UITableViewCell { // TODO: this probably has to be moved out of WireConversationUI (no generics supported)
23
23
24
24
public var message = Message ( ) {
25
25
didSet {
@@ -51,18 +51,23 @@ public final class MessageCell: UITableViewCell {
51
51
52
52
private func updateContent( ) {
53
53
contentConfiguration = UIHostingConfiguration {
54
- MessageContentView ( message: message, layout: messageLayout)
55
- . swipeActions ( edge: . leading) {
56
- Button {
57
- print ( " swipe " )
58
- } label: {
59
- Label ( " Favorite " , systemImage: " arrowshape.turn.up.backward.fill " )
60
- }
54
+ MessageContentView (
55
+ message: message,
56
+ layout: messageLayout,
57
+ accountImageViewContent: { Circle ( ) . fill ( . red) }
58
+ )
59
+ . swipeActions ( edge: . leading) {
60
+ Button {
61
+ print ( " swipe " )
62
+ } label: {
63
+ Label ( " Favorite " , systemImage: " arrowshape.turn.up.backward.fill " )
61
64
}
62
- . environment ( \. wireAccentColor, wireAccentColor)
63
- . environment ( \. wireAccentColorMapping, wireAccentColorMapping)
65
+ }
66
+ . environment ( \. wireAccentColor, wireAccentColor)
67
+ . environment ( \. wireAccentColorMapping, wireAccentColorMapping)
64
68
}
65
69
}
70
+
66
71
}
67
72
68
73
@@ -81,14 +86,16 @@ public func MessageCellPreview() -> UIViewController {
81
86
) { tableView, indexPath, itemID in
82
87
let cell = tableView. dequeueReusableCell ( withIdentifier: " MessageCell " , for: indexPath)
83
88
if let cell = cell as? MessageCell {
89
+ cell. messageLayout = . groupConversation
84
90
cell. message = Message (
85
91
id: . init( itemID) ,
86
- attributedText: AttributedString ( " Hello, World ! " )
92
+ attributedText: AttributedString ( " Hello, \n World !" )
87
93
)
88
94
}
89
95
return cell
90
96
}
91
97
tableViewController. tableView. dataSource = dataSource
98
+ tableViewController. tableView. separatorStyle = . none
92
99
93
100
var snapshot = dataSource. snapshot ( )
94
101
snapshot. appendSections ( [ . single] )
0 commit comments