mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-07 22:22:24 -04:00
do not show duplicate popups
This commit is contained in:
parent
9f55c5d648
commit
79dbe34359
1 changed files with 18 additions and 1 deletions
|
@ -32,10 +32,15 @@ public class PopupManager {
|
||||||
private static Popup displayedPopup;
|
private static Popup displayedPopup;
|
||||||
|
|
||||||
public static void queueForDisplay(Popup popup) {
|
public static void queueForDisplay(Popup popup) {
|
||||||
|
if (hasDuplicatePopup(popup)) {
|
||||||
|
log.warn("The popup is already in the queue or displayed.\n\t" +
|
||||||
|
"New popup not added=" + popup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean result = popups.offer(popup);
|
boolean result = popups.offer(popup);
|
||||||
if (!result)
|
if (!result)
|
||||||
log.warn("The capacity is full with popups in the queue.\n\t" +
|
log.warn("The capacity is full with popups in the queue.\n\t" +
|
||||||
"Not added new popup=" + popup);
|
"New popup not added=" + popup);
|
||||||
displayNext();
|
displayNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,4 +62,16 @@ public class PopupManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean hasDuplicatePopup(Popup popup) {
|
||||||
|
if (displayedPopup != null && displayedPopup.toString().equals(popup.toString())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (Popup p : popups) {
|
||||||
|
if (p.toString().equals(popup.toString())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue