mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-16 11:18:55 +03:00
Command parser is not a static object anymore
This commit is contained in:
parent
491044b0c5
commit
eb4475b4d9
2 changed files with 4 additions and 2 deletions
|
@ -23,8 +23,9 @@ import org.matrix.android.sdk.api.MatrixPatterns
|
|||
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
|
||||
import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
object CommandParser {
|
||||
class CommandParser @Inject constructor() {
|
||||
|
||||
/**
|
||||
* Convert the text message into a Slash command.
|
||||
|
|
|
@ -66,6 +66,7 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
private val session: Session,
|
||||
private val stringProvider: StringProvider,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val commandParser: CommandParser,
|
||||
private val rainbowGenerator: RainbowGenerator,
|
||||
private val voiceMessageHelper: VoiceMessageHelper,
|
||||
private val voicePlayerHelper: VoicePlayerHelper
|
||||
|
@ -183,7 +184,7 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
withState { state ->
|
||||
when (state.sendMode) {
|
||||
is SendMode.Regular -> {
|
||||
when (val slashCommandResult = CommandParser.parseSlashCommand(action.text)) {
|
||||
when (val slashCommandResult = commandParser.parseSlashCommand(action.text)) {
|
||||
is ParsedCommand.ErrorNotACommand -> {
|
||||
// Send the text message to the room
|
||||
room.sendTextMessage(action.text, autoMarkdown = action.autoMarkdown)
|
||||
|
|
Loading…
Add table
Reference in a new issue