diff --git a/Documentation/Chat_in_Channel/MessageList.md b/Documentation/Chat_in_Channel/MessageList.md index e9e1b01..57a17cc 100644 --- a/Documentation/Chat_in_Channel/MessageList.md +++ b/Documentation/Chat_in_Channel/MessageList.md @@ -112,18 +112,35 @@ MessageList(messages) { message in } menuContent: { highlightMessage in // menu content MessageMenu { - Button("Copy", action: copy) - .buttonStyle(MessageMenuButtonStyle(symbol: "doc.on.doc")) + // Copy action + Button(action: copy) { + HStack { + Text("Copy") + + Spacer() + + Image(systemName: "doc.on.doc") + } + .padding(.horizontal, 16) + .foregroundColor(appearance.primary) + } + .frame(height: 44) Divider() - Button("Reply", action: reply) - .buttonStyle(MessageMenuButtonStyle(symbol: "arrowshape.turn.up.right")) - - Divider() - - Button("Delete", action: delete) - .buttonStyle(MessageMenuButtonStyle(symbol: "trash")) + // Delete action + Button(action: delete) { + HStack { + Text("Delete") + + Spacer() + + Image(systemName: "trash") + } + .padding(.horizontal, 16) + .foregroundColor(appearance.primary) + } + .frame(height: 44) } .padding(.top, 12) } diff --git a/Sources/ChatUI/ChatInChannel/MessageList.swift b/Sources/ChatUI/ChatInChannel/MessageList.swift index e1be225..597488c 100644 --- a/Sources/ChatUI/ChatInChannel/MessageList.swift +++ b/Sources/ChatUI/ChatInChannel/MessageList.swift @@ -208,18 +208,33 @@ public struct MessageList some View { HStack { configuration.label + .frame(height: 44) + Spacer() Image(systemName: symbol) } .padding(.horizontal, 16) .foregroundColor(appearance.primary) .background(configuration.isPressed ? appearance.secondaryBackground : Color.clear) - .frame(height: 44) } public init(symbol: String) { diff --git a/Sources/ChatUI/ChatInChannel/MessageRow.swift b/Sources/ChatUI/ChatInChannel/MessageRow.swift index 199a218..e260f74 100644 --- a/Sources/ChatUI/ChatInChannel/MessageRow.swift +++ b/Sources/ChatUI/ChatInChannel/MessageRow.swift @@ -138,7 +138,7 @@ public struct MessageRow: View { } } .onReceive(highlightMessagePublisher) { highlightMessage in - isSelected = message.id == highlightMessage.id + isSelected = message.id == highlightMessage?.id } } diff --git a/Sources/ChatUI/Publishers/HighlightMessagePublisher.swift b/Sources/ChatUI/Publishers/HighlightMessagePublisher.swift index ab5d47a..eb6bf0d 100644 --- a/Sources/ChatUI/Publishers/HighlightMessagePublisher.swift +++ b/Sources/ChatUI/Publishers/HighlightMessagePublisher.swift @@ -10,4 +10,4 @@ import Combine /** The publisher that send highlight message. */ -public var highlightMessagePublisher = PassthroughSubject() +public var highlightMessagePublisher = PassthroughSubject<(any MessageProtocol)?, Never>()