From 0c213294ad8e7e9562683d75ab043c7cc9fde523 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 24 Oct 2022 14:00:20 +0200 Subject: [PATCH] request user attention via taskbar when soroban communication requires action --- .../sparrowwallet/sparrow/soroban/CounterpartyController.java | 4 ++++ .../sparrowwallet/sparrow/soroban/InitiatorController.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java index 825bd32b..866ea4a6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java @@ -32,6 +32,7 @@ import org.controlsfx.glyphfont.Glyph; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.awt.Taskbar; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -247,6 +248,7 @@ public class CounterpartyController extends SorobanController { .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .subscribe(responseMessage -> { + Taskbar.getTaskbar().requestUserAttention(true, false); if(accepted) { startCounterpartyCollaboration(counterpartyCahootsWallet, paymentCodeInitiator, cahootsType); followPaymentCode(paymentCodeInitiator); @@ -254,10 +256,12 @@ public class CounterpartyController extends SorobanController { }, error -> { log.error("Error sending meeting response", error); mixingPartner.setVisible(false); + Taskbar.getTaskbar().requestUserAttention(true, false); }); }, error -> { log.error("Failed to receive meeting request", error); mixingPartner.setVisible(false); + Taskbar.getTaskbar().requestUserAttention(true, false); }); } catch(Exception e) { log.error("Error sending meeting response", e); diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java index 6d55ca9f..eccadb03 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java @@ -56,6 +56,7 @@ import org.controlsfx.validation.decoration.StyleClassValidationDecoration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.awt.Taskbar; import java.util.*; import java.util.function.UnaryOperator; @@ -423,6 +424,7 @@ public class InitiatorController extends SorobanController { .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .subscribe(sorobanResponse -> { + Taskbar.getTaskbar().requestUserAttention(true, false); if(sorobanResponse.isAccept()) { sorobanProgressBar.setProgress(0.1); sorobanProgressLabel.setText("Mix partner accepted!"); @@ -436,12 +438,14 @@ public class InitiatorController extends SorobanController { step2Desc.setText(getErrorMessage(error)); sorobanProgressLabel.setVisible(false); meetingFail.setVisible(true); + Taskbar.getTaskbar().requestUserAttention(true, false); }); }, error -> { log.error("Error sending meeting request", error); step2Desc.setText(getErrorMessage(error)); sorobanProgressLabel.setVisible(false); meetingFail.setVisible(true); + Taskbar.getTaskbar().requestUserAttention(true, false); }); } catch(Exception e) { log.error("Error sending meeting request", e);