Commit 87c6493c authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Uses the spotlight function for search for users intead of the user.list...

Uses the spotlight function for search for users intead of the user.list (already removed from the Kotlin SDK).
parent 68fb66e8
...@@ -11,7 +11,7 @@ import chat.rocket.common.model.RoomType ...@@ -11,7 +11,7 @@ import chat.rocket.common.model.RoomType
import chat.rocket.common.util.ifNull import chat.rocket.common.util.ifNull
import chat.rocket.core.RocketChatClient import chat.rocket.core.RocketChatClient
import chat.rocket.core.internal.rest.createChannel import chat.rocket.core.internal.rest.createChannel
import chat.rocket.core.internal.rest.searchUser import chat.rocket.core.internal.rest.spotlight
import javax.inject.Inject import javax.inject.Inject
class CreateChannelPresenter @Inject constructor( class CreateChannelPresenter @Inject constructor(
...@@ -54,8 +54,8 @@ class CreateChannelPresenter @Inject constructor( ...@@ -54,8 +54,8 @@ class CreateChannelPresenter @Inject constructor(
fun searchUser(query: String) { fun searchUser(query: String) {
launchUI(strategy) { launchUI(strategy) {
try { try {
val users = client.searchUser(query, count = 5) val users = client.spotlight(query).users
val memberViewModelMapper = mapper.mapToViewModelList(users.result) val memberViewModelMapper = mapper.mapToViewModelList(users)
view.showUserSuggestion(memberViewModelMapper) view.showUserSuggestion(memberViewModelMapper)
} catch (ex: RocketChatException) { } catch (ex: RocketChatException) {
ex.message?.let { ex.message?.let {
......
...@@ -112,7 +112,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback ...@@ -112,7 +112,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
with(activity as MainActivity) { with(activity as MainActivity) {
setCheckedNavDrawerItem(R.id.action_chat_rooms) setCheckedNavDrawerItem(R.id.action_chat_rooms)
openDrawer() openDrawer()
getDrawerLayout().postDelayed(600) { getDrawerLayout().postDelayed(1000) {
closeDrawer() closeDrawer()
createChannelPresenter.toChatList() createChannelPresenter.toChatList()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment