Rename MentionSuggestionsProcessor to SuggestionsProcessor since it's not only used for mentions.

This commit is contained in:
Benoit Marty 2024-08-22 13:24:57 +02:00
parent b112713d69
commit 48ea516639
5 changed files with 29 additions and 29 deletions

View file

@ -29,17 +29,17 @@ import io.element.android.libraries.textcomposer.model.SuggestionType
import javax.inject.Inject
/**
* This class is responsible for processing mention suggestions when `@`, `/` or `#` are type in the composer.
* This class is responsible for processing suggestions when `@`, `/` or `#` are type in the composer.
*/
class MentionSuggestionsProcessor @Inject constructor() {
class SuggestionsProcessor @Inject constructor() {
/**
* Process the mention suggestions.
* Process the suggestion.
* @param suggestion The current suggestion input
* @param roomMembersState The room members state, it contains the current users in the room
* @param roomAliasSuggestions The available room alias suggestions
* @param currentUserId The current user id
* @param canSendRoomMention Should return true if the current user can send room mentions
* @return The list of mentions to display
* @return The list of suggestions to display
*/
suspend fun process(
suggestion: Suggestion?,

View file

@ -40,7 +40,7 @@ import im.vector.app.features.analytics.plan.Interaction
import io.element.android.features.messages.impl.attachments.Attachment
import io.element.android.features.messages.impl.attachments.preview.error.sendAttachmentError
import io.element.android.features.messages.impl.draft.ComposerDraftService
import io.element.android.features.messages.impl.mentions.MentionSuggestionsProcessor
import io.element.android.features.messages.impl.mentions.SuggestionsProcessor
import io.element.android.features.messages.impl.timeline.TimelineController
import io.element.android.features.messages.impl.utils.TextPillificationHelper
import io.element.android.libraries.architecture.Presenter
@ -126,7 +126,7 @@ class MessageComposerPresenter @Inject constructor(
private val mentionSpanProvider: MentionSpanProvider,
private val pillificationHelper: TextPillificationHelper,
private val roomMemberProfilesCache: RoomMemberProfilesCache,
private val mentionSuggestionsProcessor: MentionSuggestionsProcessor,
private val suggestionsProcessor: SuggestionsProcessor,
) : Presenter<MessageComposerState> {
private val cameraPermissionPresenter = permissionsPresenterFactory.create(Manifest.permission.CAMERA)
private var pendingEvent: MessageComposerEvents? = null
@ -235,7 +235,7 @@ class MessageComposerPresenter @Inject constructor(
merge(mentionStartTrigger, mentionCompletionTrigger)
.combine(room.membersStateFlow) { suggestion, roomMembersState ->
suggestions.clear()
val result = mentionSuggestionsProcessor.process(
val result = suggestionsProcessor.process(
suggestion = suggestion,
roomMembersState = roomMembersState,
roomAliasSuggestions = if (isRoomAliasSuggestionsEnabled) roomAliasSuggestions else emptyList(),