mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #6527 from yonson2023/disk_space_warning
Warn user when free disk space is too low.
This commit is contained in:
commit
74e1078318
@ -78,6 +78,7 @@ public class BisqHeadlessApp implements HeadlessApp {
|
||||
bisqSetup.setDisplayTorNetworkSettingsHandler(show -> log.info("onDisplayTorNetworkSettingsHandler: show={}", show));
|
||||
bisqSetup.setSpvFileCorruptedHandler(msg -> log.error("onSpvFileCorruptedHandler: msg={}", msg));
|
||||
bisqSetup.setChainFileLockedExceptionHandler(msg -> log.error("onChainFileLockedExceptionHandler: msg={}", msg));
|
||||
bisqSetup.setDiskSpaceWarningHandler(msg -> log.error("onDiskSpaceWarningHandler: msg={}", msg));
|
||||
bisqSetup.setLockedUpFundsHandler(msg -> log.info("onLockedUpFundsHandler: msg={}", msg));
|
||||
bisqSetup.setShowFirstPopupIfResyncSPVRequestedHandler(() -> log.info("onShowFirstPopupIfResyncSPVRequestedHandler"));
|
||||
bisqSetup.setRequestWalletPasswordHandler(aesKeyHandler -> log.info("onRequestWalletPasswordHandler"));
|
||||
|
@ -107,6 +107,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.core.util.FormattingUtils.formatBytes;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class BisqSetup {
|
||||
@ -162,7 +164,7 @@ public class BisqSetup {
|
||||
filterWarningHandler, displaySecurityRecommendationHandler, displayLocalhostHandler,
|
||||
wrongOSArchitectureHandler, displaySignedByArbitratorHandler,
|
||||
displaySignedByPeerHandler, displayPeerLimitLiftedHandler, displayPeerSignerHandler,
|
||||
rejectedTxErrorMessageHandler;
|
||||
rejectedTxErrorMessageHandler, diskSpaceWarningHandler;
|
||||
@Setter
|
||||
@Nullable
|
||||
private Consumer<Boolean> displayTorNetworkSettingsHandler;
|
||||
@ -462,8 +464,10 @@ public class BisqSetup {
|
||||
walletPasswordHandler,
|
||||
() -> {
|
||||
if (allBasicServicesInitialized) {
|
||||
// the following are called each time a block is received
|
||||
checkForLockedUpFunds();
|
||||
checkForInvalidMakerFeeTxs();
|
||||
checkFreeDiskSpace();
|
||||
}
|
||||
},
|
||||
() -> walletInitialized.set(true));
|
||||
@ -547,6 +551,18 @@ public class BisqSetup {
|
||||
});
|
||||
}
|
||||
|
||||
private void checkFreeDiskSpace() {
|
||||
long TWO_GIGABYTES = 2147483648L;
|
||||
long usableSpace = new File(Config.appDataDir(), VERSION_FILE_NAME).getUsableSpace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLastBisqVersion() {
|
||||
File versionFile = getVersionFile();
|
||||
|
@ -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]
|
||||
@ -3204,6 +3203,10 @@ 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=You have less than 2 GB free disk space left.\n\
|
||||
Free space={0}, required space={1}.\n\n\
|
||||
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 \
|
||||
refunded to you.\n\nPlease note: if you're creating a new offer, Bisq needs to be running for another trader to take \
|
||||
|
@ -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,6 +393,13 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||
bisqSetup.setChainFileLockedExceptionHandler(msg -> new Popup().warning(msg)
|
||||
.useShutDownButton()
|
||||
.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)));
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user