mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 13:26:44 +00:00
auto open recent wallets
This commit is contained in:
parent
b43b25769e
commit
cda4e30e3f
6 changed files with 28 additions and 10 deletions
|
@ -252,8 +252,14 @@ public class AppController implements Initializable {
|
||||||
|
|
||||||
openTransactionIdItem.disableProperty().bind(onlineProperty.not());
|
openTransactionIdItem.disableProperty().bind(onlineProperty.not());
|
||||||
|
|
||||||
openWalletFile(new File("/Users/scy/.sparrow/wallets/sparta.json"));
|
List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
|
||||||
openWalletFile(new File("/Users/scy/.sparrow/wallets/sparta-test.json"));
|
if(recentWalletFiles != null) {
|
||||||
|
for(File walletFile : recentWalletFiles) {
|
||||||
|
if(walletFile.exists()) {
|
||||||
|
openWalletFile(walletFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ElectrumServer.ConnectionService createConnectionService() {
|
private ElectrumServer.ConnectionService createConnectionService() {
|
||||||
|
@ -1085,6 +1091,9 @@ public class AppController implements Initializable {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void openWallets(OpenWalletsEvent event) {
|
public void openWallets(OpenWalletsEvent event) {
|
||||||
|
List<File> walletFiles = event.getWalletsMap().values().stream().map(storage -> storage.getWalletFile()).collect(Collectors.toList());
|
||||||
|
Config.get().setRecentWalletFiles(walletFiles);
|
||||||
|
|
||||||
boolean usbWallet = false;
|
boolean usbWallet = false;
|
||||||
for(Map.Entry<Wallet, Storage> entry : event.getWalletsMap().entrySet()) {
|
for(Map.Entry<Wallet, Storage> entry : event.getWalletsMap().entrySet()) {
|
||||||
Wallet wallet = entry.getKey();
|
Wallet wallet = entry.getKey();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Currency;
|
import java.util.Currency;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
private static final Logger log = LoggerFactory.getLogger(Config.class);
|
private static final Logger log = LoggerFactory.getLogger(Config.class);
|
||||||
|
@ -22,6 +23,7 @@ public class Config {
|
||||||
private boolean groupByAddress = true;
|
private boolean groupByAddress = true;
|
||||||
private boolean includeMempoolChange = true;
|
private boolean includeMempoolChange = true;
|
||||||
private boolean notifyNewTransactions = true;
|
private boolean notifyNewTransactions = true;
|
||||||
|
private List<File> recentWalletFiles;
|
||||||
private Integer keyDerivationPeriod;
|
private Integer keyDerivationPeriod;
|
||||||
private File hwi;
|
private File hwi;
|
||||||
private String electrumServer;
|
private String electrumServer;
|
||||||
|
@ -133,6 +135,15 @@ public class Config {
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<File> getRecentWalletFiles() {
|
||||||
|
return recentWalletFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecentWalletFiles(List<File> recentWalletFiles) {
|
||||||
|
this.recentWalletFiles = recentWalletFiles;
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getKeyDerivationPeriod() {
|
public Integer getKeyDerivationPeriod() {
|
||||||
return keyDerivationPeriod;
|
return keyDerivationPeriod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,8 +272,6 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
createButton.setDisable(walletTransaction == null || label.getText().isEmpty());
|
createButton.setDisable(walletTransaction == null || label.getText().isEmpty());
|
||||||
});
|
});
|
||||||
|
|
||||||
address.setText("19Sp9dLinHy3dKo2Xxj53ouuZWAoVGGhg8");
|
|
||||||
|
|
||||||
addValidation();
|
addValidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<MenuItem fx:id="openTransactionIdItem" text="From ID..." onAction="#openTransactionFromId"/>
|
<MenuItem fx:id="openTransactionIdItem" text="From ID..." onAction="#openTransactionFromId"/>
|
||||||
<MenuItem text="From Text..." onAction="#openTransactionFromText"/>
|
<MenuItem text="From Text..." onAction="#openTransactionFromText"/>
|
||||||
<MenuItem text="From QR..." onAction="#openTransactionFromQR"/>
|
<MenuItem text="From QR..." onAction="#openTransactionFromQR"/>
|
||||||
<MenuItem text="Examples" onAction="#openExamples"/>
|
<!-- <MenuItem text="Examples" onAction="#openExamples"/> -->
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
<MenuItem fx:id="saveTransaction" mnemonicParsing="false" text="Save Transaction..." onAction="#saveTransaction"/>
|
<MenuItem fx:id="saveTransaction" mnemonicParsing="false" text="Save Transaction..." onAction="#saveTransaction"/>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</padding>
|
</padding>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints prefWidth="620" />
|
<ColumnConstraints prefWidth="620" />
|
||||||
<ColumnConstraints prefWidth="150" />
|
<ColumnConstraints prefWidth="140" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints />
|
<RowConstraints />
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
<Insets left="25.0" right="25.0" top="25.0" />
|
<Insets left="25.0" right="25.0" top="25.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints percentWidth="50" />
|
<ColumnConstraints prefWidth="385" />
|
||||||
<ColumnConstraints percentWidth="30" />
|
<ColumnConstraints prefWidth="225" />
|
||||||
<ColumnConstraints percentWidth="20" />
|
<ColumnConstraints prefWidth="140" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints />
|
<RowConstraints />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
||||||
<Fieldset inputGrow="SOMETIMES" text="Send">
|
<Fieldset inputGrow="ALWAYS" text="Send">
|
||||||
<Field text="Pay to:">
|
<Field text="Pay to:">
|
||||||
<CopyableTextField fx:id="address" styleClass="address-text-field"/>
|
<CopyableTextField fx:id="address" styleClass="address-text-field"/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
Loading…
Reference in a new issue