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