Lazy load notSupportedThreadsCommands to improve performance
This commit is contained in:
parent
3253a252fb
commit
cb3501ea17
|
@ -64,12 +64,7 @@ class CommandParser @Inject constructor() {
|
||||||
val message = textMessage.substring(slashCommand.length).trim()
|
val message = textMessage.substring(slashCommand.length).trim()
|
||||||
|
|
||||||
if (isInThreadTimeline) {
|
if (isInThreadTimeline) {
|
||||||
val notSupportedCommandsInThreads = Command.values().filter {
|
if (notSupportedThreadsCommands.contains(slashCommand)) {
|
||||||
!it.isThreadCommand
|
|
||||||
}.map {
|
|
||||||
it.command
|
|
||||||
}
|
|
||||||
if (notSupportedCommandsInThreads.contains(slashCommand)) {
|
|
||||||
return ParsedCommand.ErrorCommandNotSupportedInThreads(slashCommand)
|
return ParsedCommand.ErrorCommandNotSupportedInThreads(slashCommand)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,6 +406,14 @@ class CommandParser @Inject constructor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val notSupportedThreadsCommands: List<String> by lazy {
|
||||||
|
Command.values().filter {
|
||||||
|
!it.isThreadCommand
|
||||||
|
}.map {
|
||||||
|
it.command
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun trimParts(message: CharSequence, messageParts: List<String>): String? {
|
private fun trimParts(message: CharSequence, messageParts: List<String>): String? {
|
||||||
val partsSize = messageParts.sumOf { it.length }
|
val partsSize = messageParts.sumOf { it.length }
|
||||||
val gapsNumber = messageParts.size - 1
|
val gapsNumber = messageParts.size - 1
|
||||||
|
|
Loading…
Reference in New Issue