Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#1966 friend in game indicator #2034

Conversation

Atrocyte
Copy link
Contributor

@Atrocyte Atrocyte commented Nov 13, 2020

Looks up online friends and matches these to the players inside the game lobby.
Games with friends are highlighted and have a smiley
fixes #1966

Looks up online friends and matches these to the players inside the
game lobby.
Games with friends are highlighted

Fixes FAForever#1966
@@ -110,6 +112,8 @@ public void setGame(Game game) {
));

lockIconLabel.visibleProperty().bind(game.passwordProtectedProperty());
friendsLabel.visibleProperty().bind(new SimpleBooleanProperty(!playerService.friendsInGame(game).isEmpty()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that updated if a friend joins a game?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you can follow friends when they hop from lobby to lobby

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern was if setGame is called again if a new player joins or if you add a new friend... the later I doubt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern was if setGame is called again if a new player joins or if you add a new friend... the later I doubt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And binding makes no sense if the BooleanProperty
is never updated!!!

.flatMap(Collection::stream)
.collect(Collectors.toList());
List<Player> friendsInGame = this.friendsOnline().stream()
.filter(e -> playersInGame.contains(e.getUsername()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will result in some false positives

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axel1200 I may be missing something here, I am unable to find the false positives in the logic you mention.
This weekend I ran some tests and I did not see any false positives occur when running multiple hours with 1000+ users online.
Could you elaborate on the false positives?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will have false positives as each username is assumed to be unique and this checks if the username is in the list correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea that's right

src/main/resources/theme/style.css Outdated Show resolved Hide resolved
@Sheikah45
Copy link
Member

Is this being worked on? If not will close

@Atrocyte
Copy link
Contributor Author

Hey @Sheikah45 I'll get on with it again this month, did not have time to contribute to FAF in December.

Looks up online friends and matches these to the players inside the
game lobby.
Games with friends are highlighted

Fixes FAForever#1966
@Marc-Spector
Copy link
Collaborator

Hi @Atrocyte
Is there any progress? I can help you finish your PR or implement it my own way. :)

@Atrocyte
Copy link
Contributor Author

hey @ivan-gryzunov! The PR is stuck on a comment that my methods friendsOnline and friendInGame in the PlayerService cause false positives. I can't find any false positives in logic and in testing, so could you please comment/help on that?

Apart from that bit the change is ready to go IMO, thank you for participating :)

@Sheikah45
Copy link
Member

@Atrocyte it looks like there are also still open issues with the changing of the id rather than state as well

…icator' into feature/#1966_friend_in_game_indicator

# Conflicts:
#	src/main/java/com/faforever/client/game/GameTileController.java
#	src/main/java/com/faforever/client/game/GamesTableController.java
#	src/main/resources/theme/style.css
…icator

# Conflicts:
#	src/main/resources/theme/play/games_table.fxml
#	src/test/java/com/faforever/client/game/GamesTableControllerTest.java
@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #2034 (53a383a) into develop (e2a41ba) will increase coverage by 0.01%.
The diff coverage is 69.56%.

@@              Coverage Diff              @@
##             develop    #2034      +/-   ##
=============================================
+ Coverage      54.82%   54.84%   +0.01%     
- Complexity      3730     3739       +9     
=============================================
  Files            573      573              
  Lines          19883    19906      +23     
  Branches        1148     1152       +4     
=============================================
+ Hits           10901    10917      +16     
  Misses          8385     8385              
- Partials         597      604       +7     
Impacted Files Coverage Δ Complexity Δ
.../com/faforever/client/game/GameTileController.java 92.30% <0.00%> (-3.70%) 14.00 <0.00> (ø)
...om/faforever/client/game/GamesTableController.java 73.60% <50.00%> (-1.19%) 52.00 <5.00> (+5.00) ⬇️
...ava/com/faforever/client/player/PlayerService.java 63.50% <86.66%> (+1.87%) 39.00 <4.00> (+4.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2a41ba...7548da5. Read the comment docs.

@Atrocyte Atrocyte requested a review from 1-alex98 March 9, 2021 10:28
@@ -110,6 +112,8 @@ public void setGame(Game game) {
));

lockIconLabel.visibleProperty().bind(game.passwordProtectedProperty());
friendsLabel.visibleProperty().bind(new SimpleBooleanProperty(!playerService.friendsInGame(game).isEmpty()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern was if setGame is called again if a new player joins or if you add a new friend... the later I doubt

@@ -110,6 +112,8 @@ public void setGame(Game game) {
));

lockIconLabel.visibleProperty().bind(game.passwordProtectedProperty());
friendsLabel.visibleProperty().bind(new SimpleBooleanProperty(!playerService.friendsInGame(game).isEmpty()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern was if setGame is called again if a new player joins or if you add a new friend... the later I doubt

@@ -110,6 +112,8 @@ public void setGame(Game game) {
));

lockIconLabel.visibleProperty().bind(game.passwordProtectedProperty());
friendsLabel.visibleProperty().bind(new SimpleBooleanProperty(!playerService.friendsInGame(game).isEmpty()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And binding makes no sense if the BooleanProperty
is never updated!!!

Comment on lines +136 to +137
friendsColumn.setCellValueFactory(param -> new SimpleBooleanProperty(!playerService.friendsInGame(param.getValue()).isEmpty()));
friendsColumn.setCellFactory(param -> friendsCell());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here not updated

.collect(Collectors.toList());
}

public List<Player> friendsInGame(Game game) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be an Observable list so you can Listen for changes

@1-alex98
Copy link
Member

1-alex98 commented Mar 9, 2021

Some of my comments are marked as resolved but they are not no idea how that happend

@Sheikah45
Copy link
Member

Is this still being worked on?

@Sheikah45
Copy link
Member

Gonna close if not being worked on

@Sheikah45
Copy link
Member

Stale

@Sheikah45 Sheikah45 closed this May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indicate that a game include friends of your
4 participants