Skip to content

Commit

Permalink
Fix connection updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zapek committed Nov 16, 2024
1 parent ee300d1 commit 7301fd1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,8 @@ private void updateContactConnection(long profileId, long locationId, Availabili
return;
}

if (existing.getValue().availability() != availability) // Avoid useless refreshes
// XXX: we do need to comment out the next one otherwise a new location is not detected! how to filter the double refresh problem though?
//if (existing.getValue().availability() != availability) // Avoid useless refreshes
{
if (existing.isLeaf())
{
Expand All @@ -778,11 +779,11 @@ private void updateContactConnection(long profileId, long locationId, Availabili
{
// There are children, we need to use a different algorithm then.
profileClient.findById(profileId)
.doOnSuccess(profile -> {
.doOnSuccess(profile -> Platform.runLater(() -> {
existing.setValue(Contact.withAvailability(existing.getValue(), profile.getLocations().stream()
.anyMatch(Location::isConnected) ? Availability.AVAILABLE : Availability.OFFLINE));
refreshContactIfNeeded(existing);
})
}))
.subscribe();
}
}
Expand Down

0 comments on commit 7301fd1

Please sign in to comment.