From 7301fd13c255a60b6398216d926b49b504f44f92 Mon Sep 17 00:00:00 2001 From: David Gerber Date: Sat, 16 Nov 2024 22:33:13 +0100 Subject: [PATCH] Fix connection updates --- .../xeres/ui/controller/contact/ContactViewController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/main/java/io/xeres/ui/controller/contact/ContactViewController.java b/ui/src/main/java/io/xeres/ui/controller/contact/ContactViewController.java index f4f5bd5a..7c465e4a 100644 --- a/ui/src/main/java/io/xeres/ui/controller/contact/ContactViewController.java +++ b/ui/src/main/java/io/xeres/ui/controller/contact/ContactViewController.java @@ -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()) { @@ -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(); } }