mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-25 07:10:48 -04:00
Add warning when using mainnet
This commit is contained in:
parent
9594ab96cf
commit
f24e539207
1 changed files with 36 additions and 1 deletions
|
@ -35,6 +35,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -95,8 +96,8 @@ public class NetworkSettingsView extends InitializableView {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSelectNetwork() {
|
void onSelectNetwork() {
|
||||||
preferences.setBitcoinNetwork(netWorkComboBox.getSelectionModel().getSelectedItem());
|
if (netWorkComboBox.getSelectionModel().getSelectedItem() != preferences.getBitcoinNetwork()) {
|
||||||
|
if (netWorkComboBox.getSelectionModel().getSelectedItem() == BitcoinNetwork.MAINNET) {
|
||||||
List<Action> actions = new ArrayList<>();
|
List<Action> actions = new ArrayList<>();
|
||||||
actions.add(new AbstractAction(BSResources.get("shared.no")) {
|
actions.add(new AbstractAction(BSResources.get("shared.no")) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,6 +115,40 @@ public class NetworkSettingsView extends InitializableView {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Action response = Popups.openConfirmPopup("Warning", "The application is under heavy development. " +
|
||||||
|
"Using the mainnet network with Bitcoin is not recommended at that stage.",
|
||||||
|
"Are you sure you want to switch to mainnet?", actions);
|
||||||
|
|
||||||
|
if (Popups.isYes(response))
|
||||||
|
selectNetwork();
|
||||||
|
else
|
||||||
|
Platform.runLater(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
selectNetwork();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectNetwork() {
|
||||||
|
preferences.setBitcoinNetwork(netWorkComboBox.getSelectionModel().getSelectedItem());
|
||||||
|
|
||||||
|
List<Action> actions = new ArrayList<>();
|
||||||
|
actions.add(new AbstractAction(BSResources.get("shared.no")) {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent actionEvent) {
|
||||||
|
getProperties().put("type", "NO");
|
||||||
|
org.controlsfx.dialog.Dialog.Actions.NO.handle(actionEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
actions.add(new AbstractAction(BSResources.get("shared.yes")) {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent actionEvent) {
|
||||||
|
getProperties().put("type", "YES");
|
||||||
|
org.controlsfx.dialog.Dialog.Actions.YES.handle(actionEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Action response = Popups.openConfirmPopup("Info", "You need to restart the application to apply the change of the Bitcoin network.",
|
Action response = Popups.openConfirmPopup("Info", "You need to restart the application to apply the change of the Bitcoin network.",
|
||||||
"Do you want to shutdown now?", actions);
|
"Do you want to shutdown now?", actions);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue