diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java index ea5a76681..c953d2218 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java @@ -280,8 +280,13 @@ public class CallsListController extends BaseController implements SearchView.On adapter.updateDataSet(callItems, true); - Collections.sort(callItems, (callItem, t1) -> - Long.compare(t1.getModel().getLastPing(), callItem.getModel().getLastPing())); + if (currentUser.hasSpreedCapabilityWithName("last-room-activity")) { + Collections.sort(callItems, (callItem, t1) -> + Long.compare(t1.getModel().getLastActivity(), callItem.getModel().getLastActivity())); + } else { + Collections.sort(callItems, (callItem, t1) -> + Long.compare(t1.getModel().getLastPing(), callItem.getModel().getLastPing())); + } if (searchItem != null) { searchItem.setVisible(callItems.size() > 0); diff --git a/app/src/main/java/com/nextcloud/talk/models/json/rooms/Room.java b/app/src/main/java/com/nextcloud/talk/models/json/rooms/Room.java index 3df58326d..615b17b17 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/rooms/Room.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/rooms/Room.java @@ -65,6 +65,8 @@ public class Room { public String password; @JsonField(name = "isFavorite") public boolean isFavorite; + @JsonField(name = "lastActivity") + public long lastActivity; public boolean isPublic() { return (RoomType.ROOM_PUBLIC_CALL.equals(type));