Replies: 1 comment
-
Hi @zeroarst , You can achieve something like this by utilising the // Instantiate the default user handler that is used by the SDK
val delegate = DefaultUserLookupHandler(
chatClient = ChatClient.instance(),
channelCid = channelId,
)
// Create your own handler, which wraps the default one
val handler = UserLookupHandler { query ->
// Use the default one to fetch the original results
val defaultResults = delegate.handleUserLookup(query)
// Filter the results, so that the current user is excluded from the results
defaultResults.filter { it.id != ChatClient.instance().getCurrentUser()?.id }
}
// Pass the new UserLookupHandler to the ViewModelFactory
val viewModelFactory = MessagesViewModelFactory(
context = this,
channelId = channelId,
userLookupHandler = handler,
// other setup
) Or you can do something similar, by providing a custom val delegateFilter: QueryFilter<User> = DefaultQueryFilter { it.name.ifBlank { it.id } }
val filter: QueryFilter<User> = QueryFilter { items, query ->
delegateFilter
.filter(items, query)
.filter { it.id != ChatClient.instance().getCurrentUser()?.id }
}
val handler = DefaultUserLookupHandler(
chatClient = ChatClient.instance(),
channelCid = channelId,
localFilter = filter,
)
MessagesViewModelFactory(
context = this,
channelId = channelId,
userLookupHandler = handler,
// Other setup
) Note: This is a simple implementation based on the default handler + applying filter - you can also play around with your fully custom Let me know if this will fit your use-case! Best regards, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After type "@", it shows the user self in the list. Is there a way to disable it?

Version: 6.5.1
Beta Was this translation helpful? Give feedback.
All reactions