Skip to content

Commit 3deda77

Browse files
committed
Added some notes and improved demo on readme
1 parent 55fb007 commit 3deda77

File tree

8 files changed

+30
-14
lines changed

8 files changed

+30
-14
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ Each of us have created one or more PRs and most of these have been merged into
1515
- By Parmis
1616
- Implemented by UserSearchUI, which allows a user to type in a user's username to view their features (user and username so far).
1717
- User information is captured using ChangeController interface, which uses UserDatabse interfaces to retrieve the user of interest:
18-
![img.png](img.png)
18+
- ![img.png](img.png)
1919
- Here, Alex123 is not a user of the chat system:
20-
![img_1.png](img_1.png)
20+
- ![img_1.png](img_1.png)
2121
- parmis is a user of the chat system though:
22-
![img_2.png](img_2.png)
22+
- ![img_2.png](img_2.png)
2323

2424
### Profile feature modification
2525
- By Parmis
2626
- Implemented by UserMdoificationUI, which allows a user to verify their authority to access their account by confirming their username and password, and then choosing the feature they wish to modify, and enter the new value for it.
2727
- User information is captured using UserPresenter interface, which uses UserAuthenticationI to confirm user's authority to make the change, then uses Changeable interface (use case) to make the changes to the User entity, and finally uses UserModificationGateway to relay the changed info to UserDatabase:
28-
![img_3.png](img_3.png)
28+
- ![img_3.png](img_3.png)
2929
- Here: Parmis's password is actually 123, so she doesn't get the chance to change her email:
30-
![img_4.png](img_4.png)
30+
- ![img_4.png](img_4.png)
3131
- as you can see, her email is unchanged.
3232
- now she enters the right password and tries again:
33-
![img_5.png](img_5.png)
33+
- ![img_5.png](img_5.png)
3434
- This time, change was successful. She could use this tool to similarly change her username or password too:
35-
![img_6.png](img_6.png)
35+
- ![img_6.png](img_6.png)
3636

3737

3838
### App Screen UI

src/main/java/data_access/UserDatabase.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public boolean UserExists(String username, String email) {
4141
return false;
4242
}
4343

44+
/**
45+
* Checks if a user with given Username exists.
46+
*/
4447
@Override
4548
public boolean UserExists(String username) {
4649
for(User user: this.accountList){
@@ -71,6 +74,9 @@ public void createUser(String username, String password, String email, String ty
7174
}
7275
}
7376

77+
/**
78+
* getUser retrieves a User object based on passed username.
79+
*/
7480
@Override
7581
// To be edited to get user from the array format rather than the serialized format.
7682
public User getUser(String username) {
@@ -107,6 +113,9 @@ public List<User> getList() {
107113
}
108114
}
109115

116+
/**
117+
* modifyUser updates the serialized database with modified user information.
118+
*/
110119
@Override
111120
public void modifyUser(String oldUsername, User modified){
112121
// swap in modified user to accountList

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import interface_adapters.login_interface_adapters.Login;
66
import use_cases.user_attribute_modification_use_case.Changeable;
77
import interface_adapters.app_screen_interface_adapters.UserAppScreenGateway;
8-
import entities.chat;
8+
import entities.chat.*;
99

1010
import java.io.Serializable;
1111
import java.util.ArrayList;

src/main/java/interface_adapters/User_search_IA/UserRetriever.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import interface_adapters.user_registration_interface_adapters.UserExists;
44
import entities.user_entities.User;
5-
5+
// gives access to user entity.
66
public interface UserRetriever extends UserExists {
77
User getUser(String username);
88
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package interface_adapters.profile_modification_IA;
22

3+
/**
4+
* To make a change to User entity.
5+
*/
36
public interface ChangeController {
47
public boolean reportChange(String username, String password, String feature, String newFeature);
58
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package interface_adapters.profile_modification_IA;
22

3-
// allows for ChangeController to authenticate user's username and password.
4-
3+
/**
4+
* allows for ChangeController to authenticate user's username and password.
5+
*/
56
public interface UserAuthenticationI {
67
public Boolean PasswordMatch(String attempt);
78
}

src/main/java/screens/Profile_screen/UserSearchUI.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public void actionPerformed(ActionEvent e) {
3838
frame.setVisible(true);
3939
}
4040

41-
// User_search_IA.UserPresenter makes UI implement showProfile to invert the use-case --> UI dependency
41+
/**
42+
* User_search_IA.UserPresenter makes UI implement showProfile to invert the use-case --> UI dependency
43+
*/
4244
@Override
4345
public String showProfile(String username) {
4446
// setting up access to the database of users:

src/main/java/screens/profile_update_screen/UserModificationUI.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ public void actionPerformed(ActionEvent e) {
7474

7575
frame.setVisible(true);
7676
}
77-
78-
// profile_modification_IA.ChangeController makes UI implement reportChange to invert the use-case --> UI dependency
77+
/**
78+
* profile_modification_IA.ChangeController makes UI implement reportChange to invert the use-case --> UI dependency
79+
*/
7980
@Override
8081
public boolean reportChange(String username, String password, String feature, String newFeature) {
8182
UserDatabase db = new UserDatabase();

0 commit comments

Comments
 (0)