Skip to content

Commit 98cf54e

Browse files
committed
do not show duplicate popups
1 parent 223988c commit 98cf54e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

desktop/src/main/java/haveno/desktop/main/overlays/popups/PopupManager.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ public class PopupManager {
3232
private static Popup displayedPopup;
3333

3434
public static void queueForDisplay(Popup popup) {
35+
if (hasDuplicatePopup(popup)) {
36+
log.warn("The popup is already in the queue or displayed.\n\t" +
37+
"New popup not added=" + popup);
38+
return;
39+
}
3540
boolean result = popups.offer(popup);
3641
if (!result)
3742
log.warn("The capacity is full with popups in the queue.\n\t" +
38-
"Not added new popup=" + popup);
43+
"New popup not added=" + popup);
3944
displayNext();
4045
}
4146

@@ -57,4 +62,16 @@ private static void displayNext() {
5762
}
5863
}
5964
}
65+
66+
private static boolean hasDuplicatePopup(Popup popup) {
67+
if (displayedPopup != null && displayedPopup.toString().equals(popup.toString())) {
68+
return true;
69+
}
70+
for (Popup p : popups) {
71+
if (p.toString().equals(popup.toString())) {
72+
return true;
73+
}
74+
}
75+
return false;
76+
}
6077
}

0 commit comments

Comments
 (0)