Commit e80b198f authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Handle selected user from the spotlight.

parent 850c58c6
......@@ -60,6 +60,8 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
private static final String HOSTNAME = "hostname";
public SidebarMainFragment() {}
/**
* create SidebarMainFragment with hostname.
*/
......@@ -141,11 +143,21 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
public void onItemClick(Spotlight spotlight) {
searchView.setQuery(null, false);
searchView.clearFocus();
methodCallHelper.joinRoom(spotlight.getId())
.onSuccessTask(task -> {
presenter.onSpotlightSelected(spotlight);
return null;
});
if (spotlight.getType().equals("d")) {
String username = spotlight.getName();
methodCallHelper.createDirectMessage(username)
.onSuccessTask(task -> {
presenter.onSpotlightSelected(spotlight);
return null;
});
} else {
methodCallHelper.joinRoom(spotlight.getId())
.onSuccessTask(task -> {
presenter.onSpotlightSelected(spotlight);
return null;
});
}
}
});
......
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