Skip to content

Commit dd97bbc

Browse files
committed
Minor changes
1 parent aa10e64 commit dd97bbc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package screens.login_screen;
2+
import interface_adapters.appscreen.AppScreenLoader;
3+
import interface_adapters.login_interface_adapters.UserChatsPresenter;
24
import interface_adapters.login_interface_adapters.UserLoginViewI;
35
import screens.appscreen.AppScreen;
46
import use_cases.user_login_use_cases.UserLoginOutputBoundary;
57

68
import java.util.ArrayList;
79

810
public class AppScreenCreator implements UserLoginViewI {
9-
private String username ;
10-
private ArrayList<String> chats;
1111
private boolean userNotExists;
1212
private boolean passNotMatched;
13-
AppScreen appScreen;
13+
AppScreenLoader appScreenLoader;
1414
public AppScreenCreator(){
1515
}
1616
@Override
@@ -19,7 +19,8 @@ public void display() {
1919
showUnableToLogin();
2020
}else{
2121
/*this.appScreen = new AppScreen(username, chats);*/
22-
System.out.println(username);
22+
//Could be null pointer exception if setChatsPresenter is not called before the below
23+
appScreenLoader.openScreen();
2324
}
2425
}
2526

@@ -28,10 +29,11 @@ private void showUnableToLogin() {
2829
}
2930
@Override
3031
public void setChatsPresenter(UserLoginOutputBoundary chatsPresenter){
31-
this.username = chatsPresenter.getUsername();
32-
this.chats = (ArrayList<String>) chatsPresenter.getChats();
32+
String username = chatsPresenter.getUsername();
33+
ArrayList<String> chats = (ArrayList<String>) chatsPresenter.getChats();
3334
this.userNotExists = chatsPresenter.isNotExists();
3435
this.passNotMatched = chatsPresenter.isNotMatched();
36+
appScreenLoader = new AppScreenLoader(username, chats);
3537
}
3638

3739
}

src/main/java/use_cases/user_login_use_cases/UserLoginInteractor2.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ public UserLoginInteractor2(Database database, UserLoginOutputBoundary chatPrese
2020
public void login(String username, String password) {
2121
//will update this.chatPresenter
2222
//TODO: change below, as its just temporary
23-
chatPresenter.setChats(new ArrayList<>());
24-
chatPresenter.setUsername(username);
25-
chatPresenter.setUserNotExists(false);
26-
chatPresenter.setPasswordNotMatched(false);
23+
user = database.getUser(username);
24+
2725

2826
}
2927

0 commit comments

Comments
 (0)