Skip to content

Commit 70748c0

Browse files
committed
Added getUsername to UserAppScreenGateway
1 parent 38426a4 commit 70748c0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/main/java/appscreen/UserAppScreenGateway.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.ArrayList;
44

5-
public class UserAppScreenGateway {
5+
public class UserAppScreenGateway implements Username {
66

77
private final UserDataBase userDataBase;
88
private String username;
@@ -21,9 +21,18 @@ public UserAppScreenGateway(UserDataBase userDataBase){
2121
* @param user The current user
2222
*/
2323
public void login(User user){
24-
this.username = user.getUsername();
24+
this.username = getUsername(user);
2525
this.userChats = userDataBase.getUserChats(this.username);
2626
AppScreenLoader appScreenLoader = new AppScreenLoader(this.username, this.userChats);
2727
}
2828

29+
/**
30+
* Get the username of the user
31+
* @param user The current user
32+
* @return Username of the user
33+
*/
34+
@Override
35+
public String getUsername(User user) {
36+
return user.getUsername();
37+
}
2938
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package appscreen;
2+
3+
public interface Username {
4+
String getUsername(User user);
5+
}

0 commit comments

Comments
 (0)