Commit 4911dd33 authored by William Sha's avatar William Sha
Browse files

Merge branch 'fix/v2/userListsOnLogin' into 'int/v2'

Fix display users List on login

See merge request !55
parents c38886df fee799a5
......@@ -4,6 +4,7 @@ import common.dataModel.*;
import common.interfaces.client.IComToData;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
......@@ -87,6 +88,14 @@ public class ComToDataClientImpl implements IComToData {
public void receivePlayersnGames(List<UserLight> players, List<GameLight> gamesAvailable) {
dataCoreClient.setListConnectedUsers(players);
dataCoreClient.setListGameLight(gamesAvailable);
// the current user will not be sent to the model view
Iterator<UserLight> iterator = players.iterator();
while (iterator.hasNext()) {
UserLight user = iterator.next();
if(dataCoreClient.getLocalUserLight().getId().equals(user.getId())) {
iterator.remove();
}
}
dataCoreClient.getDataToMain().sendLists(players, gamesAvailable);
}
......
......@@ -134,20 +134,8 @@ public class FXConnection {
// identification attempt
ClientApp.mainCore.getMainToData().identify(this.loginTextFieldIdentifier.getText(), this.loginPasswordFieldPassword.getText(), hostname);
// wait for response
do {
Thread.sleep(500);
} while (this.getModel().getUserLight() == null && System.currentTimeMillis() - start < 30000);
// if the model has been filled by data layer
if (this.getModel().getUserLight() != null) {
FXHome fxHome = new FXHome();
fxHome.initialize("../fxml/home.fxml", this.stage);
} else {
this.loginTextConnectionError.setVisible(true);
throw new TimeoutException("Cannot resolve the process. Please retry later.");
}
FXHome fxHome = new FXHome();
fxHome.initialize("../fxml/home.fxml", this.stage);
} catch (TimeoutException exception) {
System.out.println("TimeoutException caught: " + exception.getMessage());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment