support wallet seed tab showing seed phrase

disable wallet info tab
This commit is contained in:
woodser 2022-07-13 08:58:41 -04:00
parent 83c5d505c3
commit c71c61d1bb
4 changed files with 15 additions and 28 deletions

View file

@ -28,6 +28,7 @@ import bisq.desktop.components.AutoTooltipLabel;
import bisq.desktop.components.AutoTooltipToggleButton; import bisq.desktop.components.AutoTooltipToggleButton;
import bisq.desktop.components.BusyAnimation; import bisq.desktop.components.BusyAnimation;
import bisq.desktop.main.account.AccountView; import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.funds.FundsView;
import bisq.desktop.main.market.MarketView; import bisq.desktop.main.market.MarketView;
import bisq.desktop.main.market.offerbook.OfferBookChartView; import bisq.desktop.main.market.offerbook.OfferBookChartView;
import bisq.desktop.main.offer.BuyOfferView; import bisq.desktop.main.offer.BuyOfferView;
@ -173,7 +174,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
ToggleButton buyButton = new NavButton(BuyOfferView.class, Res.get("mainView.menu.buy").toUpperCase()); ToggleButton buyButton = new NavButton(BuyOfferView.class, Res.get("mainView.menu.buy").toUpperCase());
ToggleButton sellButton = new NavButton(SellOfferView.class, Res.get("mainView.menu.sell").toUpperCase()); ToggleButton sellButton = new NavButton(SellOfferView.class, Res.get("mainView.menu.sell").toUpperCase());
ToggleButton portfolioButton = new NavButton(PortfolioView.class, Res.get("mainView.menu.portfolio").toUpperCase()); ToggleButton portfolioButton = new NavButton(PortfolioView.class, Res.get("mainView.menu.portfolio").toUpperCase());
// ToggleButton fundsButton = new NavButton(FundsView.class, Res.get("mainView.menu.funds").toUpperCase()); ToggleButton fundsButton = new NavButton(FundsView.class, Res.get("mainView.menu.funds").toUpperCase());
ToggleButton supportButton = new NavButton(SupportView.class, Res.get("mainView.menu.support")); ToggleButton supportButton = new NavButton(SupportView.class, Res.get("mainView.menu.support"));
ToggleButton settingsButton = new NavButton(SettingsView.class, Res.get("mainView.menu.settings")); ToggleButton settingsButton = new NavButton(SettingsView.class, Res.get("mainView.menu.settings"));

View file

@ -49,11 +49,6 @@
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/> AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</Tab> </Tab>
<Tab fx:id="walletInfoTab" closable="false">
<ScrollPane fitToWidth="true" hbarPolicy="NEVER"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</Tab>
<Tab fx:id="backupTab" closable="false"/> <Tab fx:id="backupTab" closable="false"/>
</JFXTabPane> </JFXTabPane>

View file

@ -103,7 +103,7 @@ public class AccountView extends ActivatableView<TabPane, Void> {
notificationTab.setText(Res.get("account.menu.notifications").toUpperCase()); notificationTab.setText(Res.get("account.menu.notifications").toUpperCase());
passwordTab.setText(Res.get("account.menu.password").toUpperCase()); passwordTab.setText(Res.get("account.menu.password").toUpperCase());
seedWordsTab.setText(Res.get("account.menu.seedWords").toUpperCase()); seedWordsTab.setText(Res.get("account.menu.seedWords").toUpperCase());
walletInfoTab.setText(Res.get("account.menu.walletInfo").toUpperCase()); //walletInfoTab.setText(Res.get("account.menu.walletInfo").toUpperCase());
backupTab.setText(Res.get("account.menu.backup").toUpperCase()); backupTab.setText(Res.get("account.menu.backup").toUpperCase());
navigationListener = (viewPath, data) -> { navigationListener = (viewPath, data) -> {

View file

@ -24,8 +24,8 @@ import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.WalletPasswordWindow; import bisq.desktop.main.overlays.windows.WalletPasswordWindow;
import bisq.desktop.util.Layout; import bisq.desktop.util.Layout;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsManager; import bisq.core.btc.wallet.WalletsManager;
import bisq.core.btc.wallet.XmrWalletService;
import bisq.core.locale.Res; import bisq.core.locale.Res;
import bisq.core.offer.OpenOfferManager; import bisq.core.offer.OpenOfferManager;
import bisq.core.user.DontShowAgainLookup; import bisq.core.user.DontShowAgainLookup;
@ -39,7 +39,6 @@ import org.bitcoinj.wallet.DeterministicSeed;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import javafx.scene.control.Button; import javafx.scene.control.Button;
@ -54,13 +53,11 @@ import javafx.beans.value.ChangeListener;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import static bisq.desktop.util.FormBuilder.*; import static bisq.desktop.util.FormBuilder.*;
@ -70,7 +67,7 @@ import static javafx.beans.binding.Bindings.createBooleanBinding;
public class SeedWordsView extends ActivatableView<GridPane, Void> { public class SeedWordsView extends ActivatableView<GridPane, Void> {
private final WalletsManager walletsManager; private final WalletsManager walletsManager;
private final OpenOfferManager openOfferManager; private final OpenOfferManager openOfferManager;
private final BtcWalletService btcWalletService; private final XmrWalletService xmrWalletService;
private final WalletPasswordWindow walletPasswordWindow; private final WalletPasswordWindow walletPasswordWindow;
private final File storageDir; private final File storageDir;
@ -94,12 +91,12 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
@Inject @Inject
private SeedWordsView(WalletsManager walletsManager, private SeedWordsView(WalletsManager walletsManager,
OpenOfferManager openOfferManager, OpenOfferManager openOfferManager,
BtcWalletService btcWalletService, XmrWalletService xmrWalletService,
WalletPasswordWindow walletPasswordWindow, WalletPasswordWindow walletPasswordWindow,
@Named(Config.STORAGE_DIR) File storageDir) { @Named(Config.STORAGE_DIR) File storageDir) {
this.walletsManager = walletsManager; this.walletsManager = walletsManager;
this.openOfferManager = openOfferManager; this.openOfferManager = openOfferManager;
this.btcWalletService = btcWalletService; this.xmrWalletService = xmrWalletService;
this.walletPasswordWindow = walletPasswordWindow; this.walletPasswordWindow = walletPasswordWindow;
this.storageDir = storageDir; this.storageDir = storageDir;
} }
@ -109,8 +106,8 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
addTitledGroupBg(root, gridRow, 2, Res.get("account.seed.backup.title")); addTitledGroupBg(root, gridRow, 2, Res.get("account.seed.backup.title"));
displaySeedWordsTextArea = addTopLabelTextArea(root, gridRow, Res.get("seed.seedWords"), "", Layout.FIRST_ROW_DISTANCE).second; displaySeedWordsTextArea = addTopLabelTextArea(root, gridRow, Res.get("seed.seedWords"), "", Layout.FIRST_ROW_DISTANCE).second;
displaySeedWordsTextArea.getStyleClass().add("wallet-seed-words"); displaySeedWordsTextArea.getStyleClass().add("wallet-seed-words");
displaySeedWordsTextArea.setPrefHeight(40); displaySeedWordsTextArea.setPrefHeight(70);
displaySeedWordsTextArea.setMaxHeight(40); displaySeedWordsTextArea.setMaxHeight(70);
displaySeedWordsTextArea.setEditable(false); displaySeedWordsTextArea.setEditable(false);
datePicker = addTopLabelDatePicker(root, ++gridRow, Res.get("seed.date"), 10).second; datePicker = addTopLabelDatePicker(root, ++gridRow, Res.get("seed.date"), 10).second;
@ -182,10 +179,7 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
} }
private void showSeedPhrase() { private void showSeedPhrase() {
DeterministicSeed keyChainSeed = btcWalletService.getKeyChainSeed(); if (xmrWalletService.isWalletEncrypted()) {
// wallet creation date is not encrypted
walletCreationDate = Instant.ofEpochSecond(walletsManager.getChainSeedCreationTimeSeconds()).atZone(ZoneId.systemDefault()).toLocalDate();
if (keyChainSeed.isEncrypted()) {
askForPassword(); askForPassword();
} else { } else {
String key = "showSeedWordsWarning"; String key = "showSeedWordsWarning";
@ -194,13 +188,13 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
.actionButtonText(Res.get("account.seed.warn.noPw.yes")) .actionButtonText(Res.get("account.seed.warn.noPw.yes"))
.onAction(() -> { .onAction(() -> {
DontShowAgainLookup.dontShowAgain(key, true); DontShowAgainLookup.dontShowAgain(key, true);
initSeedWords(keyChainSeed); initSeedWords(xmrWalletService.getWallet().getMnemonic());
showSeedScreen(); showSeedScreen();
}) })
.closeButtonText(Res.get("shared.no")) .closeButtonText(Res.get("shared.no"))
.show(); .show();
} else { } else {
initSeedWords(keyChainSeed); initSeedWords(xmrWalletService.getWallet().getMnemonic());
showSeedScreen(); showSeedScreen();
} }
} }
@ -225,16 +219,13 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
private void askForPassword() { private void askForPassword() {
walletPasswordWindow.headLine(Res.get("account.seed.enterPw")).onAesKey(aesKey -> { walletPasswordWindow.headLine(Res.get("account.seed.enterPw")).onAesKey(aesKey -> {
initSeedWords(walletsManager.getDecryptedSeed(aesKey, btcWalletService.getKeyChainSeed(), btcWalletService.getKeyCrypter())); initSeedWords(xmrWalletService.getWallet().getMnemonic());
showSeedScreen(); showSeedScreen();
}).hideForgotPasswordButton().show(); }).hideForgotPasswordButton().show();
} }
private void initSeedWords(DeterministicSeed seed) { private void initSeedWords(String seed) {
List<String> mnemonicCode = seed.getMnemonicCode(); seedWordText = seed;
if (mnemonicCode != null) {
seedWordText = Joiner.on(" ").join(mnemonicCode);
}
} }
private void showSeedScreen() { private void showSeedScreen() {