Skip to content

Commit d0bc75a

Browse files
committed
Made some changes to adhere to clean architecture and changed some import statements
1 parent 8d8f9f4 commit d0bc75a

File tree

3 files changed

+11
-37
lines changed

3 files changed

+11
-37
lines changed

src/main/java/entities/user_entities/User.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import data_access.UserDatabase;
44
import entities.chat.Chat;
5-
import interface_adapters.appscreen.UserAppScreenGateway;
65
import interface_adapters.profile_modification_IA.UserAuthenticationI;
76
import interface_adapters.login_interface_adapters.Login;
87
import use_cases.user_attribute_modification_use_case.Changeable;
8+
import interface_adapters.appscreen.UserAppScreenGateway;
99

1010
import java.io.File;
1111
import java.io.Serializable;
@@ -41,16 +41,12 @@ public ArrayList<Chat> getUserChats(){
4141
@Override
4242
// from Changeable
4343
public void changeFeature(String feature, String newFeature){
44-
switch (feature) {
45-
case "Username":
46-
this.username = newFeature;
47-
break;
48-
case "Password":
49-
this.password = newFeature;
50-
break;
51-
case "Email":
52-
this.email = newFeature;
53-
break;
44+
if (feature == "Username"){
45+
this.username = newFeature;
46+
} else if (feature == "Password"){
47+
this.password = newFeature;
48+
} else if (feature == "Email"){
49+
this.email = newFeature;
5450
}
5551
}
5652

@@ -60,7 +56,7 @@ public Boolean PasswordMatch(String attempt){
6056
}
6157

6258
public void login(){
63-
UserAppScreenGateway appScreenGateway = new UserAppScreenGateway(this.getUsername(), new UserDatabase(new File("user_accounts")));
59+
UserAppScreenGateway appScreenGateway = new UserAppScreenGateway(this.getUsername());
6460
appScreenGateway.login();
6561
}
6662

src/main/java/screens/appscreen/AppScreen.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
import interface_adapters.appscreen.AppScreenController;
77
import interface_adapters.appscreen.AppScreenPresenter;
88
import interface_adapters.appscreen.Refresh;
9-
import screens.Profile_screen.UserSearchUI;
109
import screens.chat_screen.ChatController;
1110
import screens.chat_screen.ChatView;
12-
import screens.profile_update_screen.UserModificationUI;
1311
import use_cases.appscreen.*;
1412
import use_cases.chat_initiation_use_case.ChatInputBoundry;
1513
import use_cases.chat_initiation_use_case.ChatInteractor;
@@ -29,8 +27,8 @@ public class AppScreen implements AppScreenPresenter {
2927

3028
/**
3129
Create an AppScreen object
32-
@param chats This is a list o most recent chats at the end of the list)
33-
f chats given by the user (the list will always come as sorted with the
30+
@param chats This is a list of chats given by the user (the list will always come as sorted with the
31+
most recent chats at the end of the list)
3432
*/
3533
public AppScreen(String currentUsername, ArrayList<Chat> chats) {
3634
this.currentUsername = currentUsername;
@@ -50,24 +48,6 @@ public AppScreen(String currentUsername, ArrayList<Chat> chats) {
5048
addPrivateChat.setPreferredSize(new Dimension(40, 30));
5149
addGroupChat.setPreferredSize(new Dimension(40, 30));
5250

53-
// menu panel containing the buttons for searching for users or accessing profile settings
54-
JPanel menuPanel = new JPanel();
55-
menuPanel.setLayout(new GridLayout(1,2));
56-
57-
JButton searchUsers = new JButton("Search Users");
58-
JButton profileSettings = new JButton("Profile Settings");
59-
60-
searchUsers.setPreferredSize(new Dimension(40, 30));
61-
profileSettings.setPreferredSize(new Dimension(30, 30));
62-
63-
64-
// adding the action listeners for the Search Users button
65-
searchUsers.addActionListener(e -> new UserSearchUI());
66-
67-
// adding the action listeners for the Profile Settings button
68-
profileSettings.addActionListener(e -> new UserModificationUI());
69-
70-
7151
// adding the action listeners for the +private-chat and +group-chat buttons
7252
addPrivateChat.addActionListener(e -> {
7353
PrivateChatfactory privateChatfactory = new CommonPrivatechat();
@@ -85,10 +65,7 @@ public AppScreen(String currentUsername, ArrayList<Chat> chats) {
8565

8666
topPanel.add(addPrivateChat);
8767
topPanel.add(addGroupChat);
88-
menuPanel.add(searchUsers);
89-
menuPanel.add(profileSettings);
9068
jFrame.add(topPanel, BorderLayout.NORTH);
91-
jFrame.add(menuPanel, BorderLayout.SOUTH);
9269

9370
this.chats = chats;
9471
openScreen();

src/main/java/use_cases/chat_initiation_use_case/ChatInteractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import entities.chat.PrivateChat;
55
import entities.chat.PrivateChatfactory;
6+
import use_cases.appscreen.AppScreenStatus;
67

78
import java.util.UUID;
89

0 commit comments

Comments
 (0)