Apply code review suggestions.

This commit is contained in:
yonson2023 2023-01-23 20:28:53 -06:00
parent fc2166e1a6
commit f3a19b9d00
No known key found for this signature in database
GPG Key ID: 653F31AF4087E2F2
4 changed files with 17 additions and 7 deletions

View File

@ -552,10 +552,10 @@ public class BisqSetup {
}
private void checkFreeDiskSpace() {
long REQUIRED_FREE_DISK_SPACE = 2147483648L;
long TWO_GIGABYTES = 2147483648L;
long usableSpace = new File(Config.appDataDir(), VERSION_FILE_NAME).getUsableSpace();
if (usableSpace < REQUIRED_FREE_DISK_SPACE) {
String message = Res.get("popup.warning.diskSpace", formatBytes(usableSpace), formatBytes(REQUIRED_FREE_DISK_SPACE));
if (usableSpace < TWO_GIGABYTES) {
String message = Res.get("popup.warning.diskSpace", formatBytes(usableSpace), formatBytes(TWO_GIGABYTES));
log.warn(message);
if (diskSpaceWarningHandler != null) {
diskSpaceWarningHandler.accept(message);

View File

@ -1,4 +1,3 @@
# Keep display strings organized by domain
# Naming convention: We use camelCase and dot separated name spaces.
# Use as many sub spaces as required to make the structure clear, but as little as possible.
# E.g.: [main-view].[component].[description]
@ -3202,9 +3201,9 @@ popup.warning.openOfferWithInvalidMakerFeeTx=The maker fee transaction for offer
Please go to \"Settings/Network info\" and do a SPV resync.\n\
For further help please contact the Bisq support channel at the Bisq Matrix Space.
popup.warning.diskSpace=Your free disk space is critically low.\n\
popup.warning.diskSpace=You have less than 2 GB free disk space left.\n\
Free space={0}, required space={1}.\n\n\
Please immediately free up disk space to avoid corrupting your Bisq configuration.
Please free up some disk space to continue running Bisq.
popup.info.securityDepositInfo=To ensure both traders follow the trade protocol, both traders need to pay a security \
deposit.\n\nThis deposit is kept in your trade wallet until your trade has been successfully completed, and then it's \

View File

@ -27,6 +27,7 @@ import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.notifications.Notification;
import bisq.desktop.main.overlays.notifications.NotificationCenter;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.popups.PopupManager;
import bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow;
import bisq.desktop.main.overlays.windows.TacWindow;
import bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow;
@ -392,7 +393,13 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
bisqSetup.setChainFileLockedExceptionHandler(msg -> new Popup().warning(msg)
.useShutDownButton()
.show());
bisqSetup.setDiskSpaceWarningHandler(msg -> new Popup().warning(msg).show());
bisqSetup.setDiskSpaceWarningHandler(msg -> {
if (PopupManager.isNoPopupDisplayed()) {
new Popup().warning(msg).show();
}
});
bisqSetup.setLockedUpFundsHandler(msg -> {
// repeated popups of the same message text can be stopped by selecting the "Dont show again" checkbox
String key = Hex.encode(Hash.getSha256Ripemd160hash(msg.getBytes(Charsets.UTF_8)));

View File

@ -40,6 +40,10 @@ public class PopupManager {
displayNext();
}
public static boolean isNoPopupDisplayed() {
return displayedPopup == null;
}
public static void onHidden(Popup popup) {
if (displayedPopup == null || displayedPopup == popup) {
displayedPopup = null;