mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-05 05:04:15 -04:00
repurpose delete spv button to rescan outputs (hidden w/o implementation)
This commit is contained in:
parent
b87bf74453
commit
37c6f36868
22 changed files with 23 additions and 187 deletions
|
@ -328,16 +328,11 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
|
|||
torNetworkSettingsWindow.hide();
|
||||
}
|
||||
});
|
||||
havenoSetup.setSpvFileCorruptedHandler(msg -> new Popup().warning(msg)
|
||||
.actionButtonText(Res.get("settings.net.reSyncSPVChainButton"))
|
||||
.onAction(() -> GUIUtil.reSyncSPVChain(preferences))
|
||||
.show());
|
||||
|
||||
havenoSetup.setChainFileLockedExceptionHandler(msg -> new Popup().warning(msg)
|
||||
.useShutDownButton()
|
||||
.show());
|
||||
havenoSetup.setLockedUpFundsHandler(msg -> new Popup().width(850).warning(msg).show());
|
||||
havenoSetup.setShowFirstPopupIfResyncSPVRequestedHandler(this::showFirstPopupIfResyncSPVRequested);
|
||||
|
||||
havenoSetup.setDisplayUpdateHandler((alert, key) -> new DisplayUpdateDownloadWindow(alert, config)
|
||||
.actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater"))
|
||||
|
@ -531,28 +526,6 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
|
|||
});
|
||||
}
|
||||
|
||||
private void showFirstPopupIfResyncSPVRequested() {
|
||||
Popup firstPopup = new Popup();
|
||||
firstPopup.information(Res.get("settings.net.reSyncSPVAfterRestart")).show();
|
||||
if (havenoSetup.getBtcSyncProgress().get() == 1) {
|
||||
showSecondPopupIfResyncSPVRequested(firstPopup);
|
||||
} else {
|
||||
havenoSetup.getBtcSyncProgress().addListener((observable, oldValue, newValue) -> {
|
||||
if ((double) newValue == 1)
|
||||
showSecondPopupIfResyncSPVRequested(firstPopup);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showSecondPopupIfResyncSPVRequested(Popup firstPopup) {
|
||||
firstPopup.hide();
|
||||
HavenoSetup.setResyncSpvSemaphore(false);
|
||||
new Popup().information(Res.get("settings.net.reSyncSPVAfterRestartCompleted"))
|
||||
.hideCloseButton()
|
||||
.useShutDownButton()
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showPopupIfInvalidBtcConfig() {
|
||||
preferences.setMoneroNodesOptionOrdinal(0);
|
||||
new Popup().warning(Res.get("settings.net.warn.invalidBtcConfig"))
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
</VBox>
|
||||
|
||||
<VBox GridPane.rowIndex="4">
|
||||
<AutoTooltipLabel fx:id="reSyncSPVChainLabel" styleClass="small-text"/>
|
||||
<AutoTooltipButton fx:id="reSyncSPVChainButton"/>
|
||||
<AutoTooltipLabel fx:id="rescanOutputsLabel" styleClass="small-text"/>
|
||||
<AutoTooltipButton fx:id="rescanOutputsButton"/>
|
||||
</VBox>
|
||||
|
||||
<TitledGroupBg fx:id="p2pHeader" GridPane.rowIndex="5" GridPane.rowSpan="5">
|
||||
|
|
|
@ -97,9 +97,9 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
TableColumn<MoneroNetworkListItem, String> moneroPeerAddressColumn, moneroPeerVersionColumn,
|
||||
moneroPeerSubVersionColumn, moneroPeerHeightColumn;
|
||||
@FXML
|
||||
Label reSyncSPVChainLabel;
|
||||
Label rescanOutputsLabel;
|
||||
@FXML
|
||||
AutoTooltipButton reSyncSPVChainButton, openTorSettingsButton;
|
||||
AutoTooltipButton rescanOutputsButton, openTorSettingsButton;
|
||||
|
||||
private final Preferences preferences;
|
||||
private final XmrNodes xmrNodes;
|
||||
|
@ -167,8 +167,8 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
useProvidedNodesRadio.setText(Res.get("settings.net.useProvidedNodesRadio"));
|
||||
useCustomNodesRadio.setText(Res.get("settings.net.useCustomNodesRadio"));
|
||||
usePublicNodesRadio.setText(Res.get("settings.net.usePublicNodesRadio"));
|
||||
reSyncSPVChainLabel.setText(Res.get("settings.net.reSyncSPVChainLabel"));
|
||||
reSyncSPVChainButton.updateText(Res.get("settings.net.reSyncSPVChainButton"));
|
||||
rescanOutputsLabel.setText(Res.get("settings.net.rescanOutputsLabel"));
|
||||
rescanOutputsButton.updateText(Res.get("settings.net.rescanOutputsButton"));
|
||||
p2PPeersLabel.setText(Res.get("settings.net.p2PPeersLabel"));
|
||||
onionAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.onionAddressColumn")));
|
||||
onionAddressColumn.getStyleClass().add("first-column");
|
||||
|
@ -184,6 +184,10 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
peerTypeColumn.getStyleClass().add("last-column");
|
||||
openTorSettingsButton.updateText(Res.get("settings.net.openTorSettingsButton"));
|
||||
|
||||
// TODO: hiding button to rescan outputs until supported
|
||||
rescanOutputsLabel.setVisible(false);
|
||||
rescanOutputsButton.setVisible(false);
|
||||
|
||||
GridPane.setMargin(moneroPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(moneroPeersLabel, VPos.TOP);
|
||||
|
||||
|
@ -283,7 +287,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
}
|
||||
});
|
||||
|
||||
reSyncSPVChainButton.setOnAction(event -> GUIUtil.reSyncSPVChain(preferences));
|
||||
rescanOutputsButton.setOnAction(event -> GUIUtil.rescanOutputs(preferences));
|
||||
|
||||
moneroPeersSubscription = EasyBind.subscribe(connectionManager.peerConnectionsProperty(),
|
||||
this::updateMoneroPeersTable);
|
||||
|
|
|
@ -39,7 +39,6 @@ import haveno.common.util.Utilities;
|
|||
import haveno.core.account.witness.AccountAgeWitness;
|
||||
import haveno.core.account.witness.AccountAgeWitnessService;
|
||||
import haveno.core.api.CoreMoneroConnectionsService;
|
||||
import haveno.core.app.HavenoSetup;
|
||||
import haveno.core.locale.Country;
|
||||
import haveno.core.locale.CountryUtil;
|
||||
import haveno.core.locale.CurrencyUtil;
|
||||
|
@ -56,7 +55,6 @@ import haveno.core.util.FormattingUtils;
|
|||
import haveno.core.util.coin.CoinFormatter;
|
||||
import haveno.core.xmr.wallet.XmrWalletService;
|
||||
import haveno.desktop.Navigation;
|
||||
import haveno.desktop.app.HavenoApp;
|
||||
import haveno.desktop.components.AutoTooltipLabel;
|
||||
import haveno.desktop.components.HavenoTextArea;
|
||||
import haveno.desktop.components.InfoAutoTooltipLabel;
|
||||
|
@ -118,7 +116,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
@ -766,19 +763,18 @@ public class GUIUtil {
|
|||
UserThread.execute(node::requestFocus);
|
||||
}
|
||||
|
||||
public static void reSyncSPVChain(Preferences preferences) {
|
||||
public static void rescanOutputs(Preferences preferences) {
|
||||
try {
|
||||
new Popup().information(Res.get("settings.net.reSyncSPVSuccess"))
|
||||
.useShutDownButton()
|
||||
.actionButtonText(Res.get("shared.shutDown"))
|
||||
new Popup().information(Res.get("settings.net.rescanOutputsSuccess"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
HavenoSetup.setResyncSpvSemaphore(true);
|
||||
UserThread.runAfter(HavenoApp.getShutDownHandler(), 100, TimeUnit.MILLISECONDS);
|
||||
throw new RuntimeException("Rescanning wallet outputs not yet implemented");
|
||||
//UserThread.runAfter(HavenoApp.getShutDownHandler(), 100, TimeUnit.MILLISECONDS);
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show();
|
||||
} catch (Throwable t) {
|
||||
new Popup().error(Res.get("settings.net.reSyncSPVFailed", t)).show();
|
||||
new Popup().error(Res.get("settings.net.rescanOutputsFailed", t)).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue