Skip to content

Commit d30fdf3

Browse files
authored
Make the commandsHandler and the mention methods public to allow customization of the mention command handler (#979)
* Make the `commandsHandler` and the mention methods public to allow customization of the mention command handler. * Update change log
1 parent 46c632d commit d30fdf3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6+
### ✅ Added
7+
- Make the commandsHandler and the mention methods public to allow customization of the mention command handler [#979](https://github.com/GetStream/stream-chat-swiftui/pull/979)
8+
69
### 🐞 Fixed
710
- Fix openChannel not working when searching or another chat shown [#975](https://github.com/GetStream/stream-chat-swiftui/pull/975)
811
- Fix crash when using a font that does not support bold or italic trait [#976](https://github.com/GetStream/stream-chat-swiftui/pull/976)

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ open class MessageComposerViewModel: ObservableObject {
219219
}
220220

221221
private var cancellables = Set<AnyCancellable>()
222-
private lazy var commandsHandler = utils
222+
public lazy var commandsHandler = utils
223223
.commandsConfig
224224
.makeCommandsHandler(
225225
with: channelController
@@ -690,7 +690,7 @@ open class MessageComposerViewModel: ObservableObject {
690690
}
691691
}
692692

693-
private func checkForMentionedUsers(
693+
public func checkForMentionedUsers(
694694
commandId: String?,
695695
extraData: [String: Any]
696696
) {
@@ -701,7 +701,7 @@ open class MessageComposerViewModel: ObservableObject {
701701
mentionedUsers.insert(user)
702702
}
703703

704-
private func clearRemovedMentions() {
704+
public func clearRemovedMentions() {
705705
for user in mentionedUsers {
706706
if !text.contains("@\(user.mentionText)") {
707707
mentionedUsers.remove(user)
@@ -742,7 +742,7 @@ open class MessageComposerViewModel: ObservableObject {
742742
clearInputData()
743743
}
744744

745-
private func clearInputData() {
745+
public func clearInputData() {
746746
addedAssets = []
747747
addedFileURLs = []
748748
addedVoiceRecordings = []
@@ -806,7 +806,7 @@ open class MessageComposerViewModel: ObservableObject {
806806
.store(in: &cancellables)
807807
}
808808

809-
private func checkChannelCooldown() {
809+
public func checkChannelCooldown() {
810810
let duration = channelController.channel?.cooldownDuration ?? 0
811811
if duration > 0 && timer == nil && !isSlowModeDisabled {
812812
cooldownDuration = duration

0 commit comments

Comments
 (0)