diff --git a/CHANGELOG.md b/CHANGELOG.md index 72af0528..2a3dd0ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). # Upcoming ### ✅ Added -- Configuration for highlighted composer border color +- Config for highlighted composer border color +- Config for enforcing unique reactions ### 🐞 Fixed - Improved loading of gallery images diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift index 9cefffe1..15491767 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift @@ -26,7 +26,8 @@ public struct MessageListConfig { scrollingAnchor: UnitPoint = .bottom, showNewMessagesSeparator: Bool = true, handleTabBarVisibility: Bool = true, - messageListAlignment: MessageListAlignment = .standard + messageListAlignment: MessageListAlignment = .standard, + uniqueReactionsEnabled: Bool = false ) { self.messageListType = messageListType self.typingIndicatorPlacement = typingIndicatorPlacement @@ -46,6 +47,7 @@ public struct MessageListConfig { self.showNewMessagesSeparator = showNewMessagesSeparator self.handleTabBarVisibility = handleTabBarVisibility self.messageListAlignment = messageListAlignment + self.uniqueReactionsEnabled = uniqueReactionsEnabled } public let messageListType: MessageListType @@ -66,6 +68,7 @@ public struct MessageListConfig { public let showNewMessagesSeparator: Bool public let handleTabBarVisibility: Bool public let messageListAlignment: MessageListAlignment + public let uniqueReactionsEnabled: Bool } /// Contains information about the message paddings. diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayViewModel.swift index b8d6815d..9c7dd48a 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayViewModel.swift @@ -33,7 +33,10 @@ open class ReactionsOverlayViewModel: ObservableObject, ChatMessageControllerDel messageController?.deleteReaction(reaction) } else { // reaction should be added - messageController?.addReaction(reaction) + messageController?.addReaction( + reaction, + enforceUnique: utils.messageListConfig.uniqueReactionsEnabled + ) } }