mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
ignore script type change warning when replacing wallet in settings
This commit is contained in:
parent
c9c0c35964
commit
cff731dec7
1 changed files with 5 additions and 1 deletions
|
@ -99,6 +99,7 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
|
|
||||||
private boolean initialising = true;
|
private boolean initialising = true;
|
||||||
private boolean reverting;
|
private boolean reverting;
|
||||||
|
private boolean ignoreScriptTypeChange;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
@ -145,7 +146,7 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
|
|
||||||
scriptType.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
scriptType.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if(newValue != null) {
|
if(newValue != null) {
|
||||||
if(oldValue != null && !reverting && walletForm.getWallet().getKeystores().stream().anyMatch(keystore -> keystore.getExtendedPublicKey() != null)) {
|
if(oldValue != null && !ignoreScriptTypeChange && !reverting && walletForm.getWallet().getKeystores().stream().anyMatch(keystore -> keystore.getExtendedPublicKey() != null)) {
|
||||||
Optional<ButtonType> optType = showWarningDialog("Clear keystores?",
|
Optional<ButtonType> optType = showWarningDialog("Clear keystores?",
|
||||||
"You are changing the script type on a wallet with existing key information. Usually this means the keys need to be re-imported using a different derivation path.\n\n" +
|
"You are changing the script type on a wallet with existing key information. Usually this means the keys need to be re-imported using a different derivation path.\n\n" +
|
||||||
"Do you want to clear the current key information?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
|
"Do you want to clear the current key information?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
|
||||||
|
@ -471,7 +472,10 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
totalKeystores.setValue(0);
|
totalKeystores.setValue(0);
|
||||||
walletForm.setWallet(editedWallet);
|
walletForm.setWallet(editedWallet);
|
||||||
initialising = true;
|
initialising = true;
|
||||||
|
ignoreScriptTypeChange = true;
|
||||||
setFieldsFromWallet(editedWallet);
|
setFieldsFromWallet(editedWallet);
|
||||||
|
ignoreScriptTypeChange = false;
|
||||||
|
initialising = false;
|
||||||
|
|
||||||
EventManager.get().post(new SettingsChangedEvent(editedWallet, SettingsChangedEvent.Type.POLICY));
|
EventManager.get().post(new SettingsChangedEvent(editedWallet, SettingsChangedEvent.Type.POLICY));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue