Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,6 @@ public void resetWaitForConfirm() {
public void saveToDBAndShowMessage(String s) {
messageService.saveToDBAndShowMessage(s);
}

public Group findGroup (String name) { return groupService.findGroup(name); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ public class GroupController {
this.cc = cc;
}

Group getGroupInfo(String groupName){
Group getGroupInfo(String groupId){
Group group = new Group();
try {
ServerResponse response = HTTPSRequest.getGroupInfo(groupName, token);

ServerResponse response = HTTPSRequest.getGroupInfo(groupId, token);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это старый метод. Надо реализовать по аналогии со строкой 78.

switch (response.getResponseCode()){
case 200:
System.out.println("получение информации о группе");
Expand Down Expand Up @@ -121,4 +122,20 @@ void addUserGroup(String group_id, String new_user_id) {
controllerLogger.error("HTTPSRequest.addUserGroup_error", e);
}
}

Group findGroup (String name) {

//заглушка до реализации поиска групп на сервере
Group group;
String groupId;
groupId = "5cc5c1284149c400016581d7"; //java
// groupId = "5cc5c3392d833c1640e24a5e"; //nodejs
group = getGroupInfo(groupId);
if (group == null) group.setGroup_name(name);
System.out.println(group.toString());
//конец заглушки

return group;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static ServerResponse getUserMessages(String token, String userId, int of
}

public static ServerResponse getGroupInfo(String id, String token) throws Exception {
HttpsURLConnection connection = getConnection("/v1/chats/" + id, "GET", token);
HttpsURLConnection connection = getConnection("/groups/%id=" + id, "GET", token);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это к старому бэкенду был. Сейчас переделываем и этот метод надо будет удалить.

return getServerResponse(connection, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ru.geekbrains.pocket.messenger.client.Main;
import ru.geekbrains.pocket.messenger.client.controller.ClientController;
import ru.geekbrains.pocket.messenger.client.controller.GroupController;
import ru.geekbrains.pocket.messenger.client.utils.Common;
import ru.geekbrains.pocket.messenger.client.utils.CustomTextArea;
import com.jfoenix.controls.*;
Expand Down Expand Up @@ -36,7 +37,10 @@
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import ru.geekbrains.pocket.messenger.client.view.customFX.*;
import ru.geekbrains.pocket.messenger.client.model.Group;
import ru.geekbrains.pocket.messenger.database.entity.Message;
import ru.geekbrains.pocket.messenger.database.entity.User;
import ru.geekbrains.pocket.messenger.database.entity.UserProfile;

import java.awt.*;
import java.io.File;
Expand Down Expand Up @@ -112,7 +116,7 @@ public class ChatViewController implements Initializable {
private JFXListView<?> groupListView;

@FXML
private JFXListView<?> groupSearchListView;
private JFXListView<CFXListElement> groupSearchListView;

@FXML
private JFXListView<CFXListElement> listViewAddToGroup;
Expand Down Expand Up @@ -769,6 +773,15 @@ public void handleGroupCreateButton(){

@FXML
public void findContact(KeyEvent keyEvent) {
if (chats.isSelected()) {
groupSearchListView.getItems().clear();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А не может быть случая groupSearchListView == null...? ;)

Group findGroup = clientController.getGroupInfo(tfSearchInput.getText());
findGroup.setGroup_name(tfSearchInput.getText());
CFXListElement temp = new CFXListElement();
temp.setUser(new User (null, new UserProfile(findGroup.getGid(), findGroup.getGroup_name(), null, null)));
groupSearchListView.getItems().add(temp);
return;
}
if (tfSearchInput.getText().length()>0) {
searchObsList.clear();
contactsViewPane.setVisible(false);
Expand Down