mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Merge pull request #1526 from ManfredKarrer/fix-startup-bug
Fix startup bug
This commit is contained in:
commit
e193199b8c
@ -45,7 +45,6 @@ import bisq.common.UserThread;
|
||||
import bisq.common.app.DevEnv;
|
||||
import bisq.common.setup.GracefulShutDownHandler;
|
||||
import bisq.common.setup.UncaughtExceptionHandler;
|
||||
import bisq.common.storage.Storage;
|
||||
import bisq.common.util.Profiler;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
@ -127,8 +126,6 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
|
||||
scene = createAndConfigScene(mainView, injector);
|
||||
setupStage(scene);
|
||||
|
||||
setDatabaseCorruptionHandler(mainView);
|
||||
|
||||
checkForCorrectOSArchitecture();
|
||||
|
||||
UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES);
|
||||
@ -249,16 +246,6 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
|
||||
return (MainView) viewLoader.load(MainView.class);
|
||||
}
|
||||
|
||||
private void setDatabaseCorruptionHandler(MainView mainView) {
|
||||
Storage.setDatabaseCorruptionHandler((String fileName) -> {
|
||||
corruptedDatabaseFiles.add(fileName);
|
||||
if (mainView != null)
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
});
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
}
|
||||
|
||||
|
||||
private void addSceneKeyEventHandler(Scene scene, Injector injector) {
|
||||
scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
|
||||
Utilities.isAltOrCtrlPressed(KeyCode.W, keyEvent);
|
||||
|
@ -83,8 +83,6 @@ import javafx.geometry.Pos;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static javafx.scene.layout.AnchorPane.setBottomAnchor;
|
||||
@ -149,7 +147,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
private Label splashP2PNetworkLabel;
|
||||
private ProgressBar btcSyncIndicator;
|
||||
private Label btcSplashInfo;
|
||||
private List<String> persistedFilesCorrupted;
|
||||
private Popup<?> p2PNetworkWarnMsgPopup, btcNetworkWarnMsgPopup;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@ -312,21 +309,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
if (newValue) {
|
||||
navigation.navigateToPreviousVisitedView();
|
||||
|
||||
if (!persistedFilesCorrupted.isEmpty()) {
|
||||
if (persistedFilesCorrupted.size() > 1 || !persistedFilesCorrupted.get(0).equals("ViewPathAsString")) {
|
||||
// show warning that some files has been corrupted
|
||||
new Popup<>()
|
||||
.warning(Res.get("popup.warning.incompatibleDB",
|
||||
persistedFilesCorrupted.toString(),
|
||||
model.getAppDateDir()))
|
||||
.useShutDownButton()
|
||||
.show();
|
||||
} else {
|
||||
log.debug("We detected incompatible data base file for Navigation. That is a minor issue happening with refactoring of UI classes " +
|
||||
"and we don't display a warning popup to the user.");
|
||||
}
|
||||
}
|
||||
|
||||
transitions.fadeOutAndRemove(splashScreen, 1500, actionEvent -> disposeSplashScreen());
|
||||
}
|
||||
});
|
||||
@ -464,10 +446,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPersistedFilesCorrupted(List<String> persistedFilesCorrupted) {
|
||||
this.persistedFilesCorrupted = persistedFilesCorrupted;
|
||||
}
|
||||
|
||||
private VBox createSplashScreen() {
|
||||
VBox vBox = new VBox();
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
|
@ -88,6 +88,7 @@ import bisq.common.app.Version;
|
||||
import bisq.common.crypto.CryptoException;
|
||||
import bisq.common.crypto.KeyRing;
|
||||
import bisq.common.crypto.SealedAndSigned;
|
||||
import bisq.common.storage.CorruptedDatabaseFilesHandler;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.Coin;
|
||||
@ -174,6 +175,7 @@ public class MainViewModel implements ViewModel {
|
||||
private final ClosedTradableManager closedTradableManager;
|
||||
private final AccountAgeWitnessService accountAgeWitnessService;
|
||||
final TorNetworkSettingsWindow torNetworkSettingsWindow;
|
||||
private final CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler;
|
||||
private final BSFormatter formatter;
|
||||
|
||||
// BTC network
|
||||
@ -248,7 +250,8 @@ public class MainViewModel implements ViewModel {
|
||||
DaoSetup daoSetup, EncryptionService encryptionService,
|
||||
KeyRing keyRing, BisqEnvironment bisqEnvironment, FailedTradesManager failedTradesManager,
|
||||
ClosedTradableManager closedTradableManager, AccountAgeWitnessService accountAgeWitnessService,
|
||||
TorNetworkSettingsWindow torNetworkSettingsWindow, BSFormatter formatter) {
|
||||
TorNetworkSettingsWindow torNetworkSettingsWindow,
|
||||
CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler, BSFormatter formatter) {
|
||||
this.walletsManager = walletsManager;
|
||||
this.walletsSetup = walletsSetup;
|
||||
this.btcWalletService = btcWalletService;
|
||||
@ -277,6 +280,7 @@ public class MainViewModel implements ViewModel {
|
||||
this.closedTradableManager = closedTradableManager;
|
||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||
this.torNetworkSettingsWindow = torNetworkSettingsWindow;
|
||||
this.corruptedDatabaseFilesHandler = corruptedDatabaseFilesHandler;
|
||||
this.formatter = formatter;
|
||||
|
||||
TxIdTextField.setPreferences(preferences);
|
||||
@ -707,6 +711,8 @@ public class MainViewModel implements ViewModel {
|
||||
if (walletsSetup.downloadPercentageProperty().get() == 1)
|
||||
checkForLockedUpFunds();
|
||||
|
||||
checkForCorruptedDataBaseFiles();
|
||||
|
||||
allBasicServicesInitialized = true;
|
||||
}
|
||||
|
||||
@ -1262,6 +1268,26 @@ public class MainViewModel implements ViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkForCorruptedDataBaseFiles() {
|
||||
List<String> files = corruptedDatabaseFilesHandler.getCorruptedDatabaseFiles();
|
||||
|
||||
if (files.size() == 0)
|
||||
return;
|
||||
|
||||
if (files.size() == 1 && files.get(0).equals("ViewPathAsString")) {
|
||||
log.debug("We detected incompatible data base file for Navigation. " +
|
||||
"That is a minor issue happening with refactoring of UI classes " +
|
||||
"and we don't display a warning popup to the user.");
|
||||
return;
|
||||
}
|
||||
|
||||
// show warning that some files have been corrupted
|
||||
new Popup<>()
|
||||
.warning(Res.get("popup.warning.incompatibleDB", files.toString(), getAppDateDir()))
|
||||
.useShutDownButton()
|
||||
.show();
|
||||
}
|
||||
|
||||
private void setupDevDummyPaymentAccounts() {
|
||||
if (user.getPaymentAccounts() != null && user.getPaymentAccounts().isEmpty()) {
|
||||
PerfectMoneyAccount perfectMoneyAccount = new PerfectMoneyAccount();
|
||||
|
Loading…
Reference in New Issue
Block a user