ask for displaying seed words without password protection, remember selected subview in account

This commit is contained in:
Manfred Karrer 2016-03-09 14:23:48 +01:00
parent d015df43cb
commit 7612e53271
7 changed files with 62 additions and 15 deletions

View File

@ -86,6 +86,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
Tuple3<Button, ProgressIndicator, Label> tuple = addButtonWithStatus(root, ++gridRow, "", 0);
pwButton = tuple.first;
ProgressIndicator progressIndicator = tuple.second;
progressIndicator.setVisible(false);
Label deriveStatusLabel = tuple.third;
pwButton.setDisable(true);

View File

@ -27,6 +27,7 @@ import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow;
import io.bitsquare.gui.util.Layout;
import io.bitsquare.user.Preferences;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener;
@ -55,6 +56,7 @@ import static javafx.beans.binding.Bindings.createBooleanBinding;
public class SeedWordsView extends ActivatableView<GridPane, Void> {
private final WalletService walletService;
private final WalletPasswordWindow walletPasswordWindow;
private Preferences preferences;
private Button restoreButton;
private TextArea seedWordsTextArea;
@ -75,9 +77,10 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private SeedWordsView(WalletService walletService, WalletPasswordWindow walletPasswordWindow) {
private SeedWordsView(WalletService walletService, WalletPasswordWindow walletPasswordWindow, Preferences preferences) {
this.walletService = walletService;
this.walletPasswordWindow = walletPasswordWindow;
this.preferences = preferences;
}
@Override
@ -106,24 +109,45 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
datePicker.setDisable(true);
askForPassword();
} else {
showSeedScreen(keyChainSeed);
String key = "showSeedWordsWarning";
if (preferences.showAgain(key)) {
new Popup().warning("You have not setup a wallet password which would protect the display of the seed words.\n\n" +
"Do you want to display the seed words?")
.closeButtonText("Yes, and don't ask me again")
.onClose(() -> {
preferences.dontShowAgain(key, true);
showSeedScreen(keyChainSeed);
})
.actionButtonText("No")
.show();
} else {
showSeedScreen(keyChainSeed);
}
}
}
@Override
protected void deactivate() {
seedWordsValid.removeListener(seedWordsValidChangeListener);
seedWordsTextArea.textProperty().removeListener(seedWordsTextAreaChangeListener);
dateValid.removeListener(datePickerChangeListener);
datePicker.valueProperty().removeListener(dateChangeListener);
if (seedWordsTextAreaChangeListener != null)
seedWordsTextArea.textProperty().removeListener(seedWordsTextAreaChangeListener);
seedWordsTextArea.setText("");
datePicker.setValue(null);
restoreButton.disableProperty().unbind();
seedWordsTextArea.getStyleClass().remove("validation_error");
datePicker.getStyleClass().remove("validation_error");
}
if (dateChangeListener != null)
datePicker.valueProperty().removeListener(dateChangeListener);
datePicker.setValue(null);
datePicker.getStyleClass().remove("validation_error");
restoreButton.disableProperty().unbind();
if (seedWordsValid != null && seedWordsValidChangeListener != null)
seedWordsValid.removeListener(seedWordsValidChangeListener);
if (dateValid != null && datePickerChangeListener != null)
dateValid.removeListener(datePickerChangeListener);
}
private void askForPassword() {
walletPasswordWindow.onAesKey(aesKey -> {

View File

@ -71,7 +71,8 @@ public class AccountSettingsView extends ActivatableViewAndModel {
if (viewPath.size() != 4 || viewPath.indexOf(AccountSettingsView.class) != 2)
return;
loadView(viewPath.tip());
selectedViewClass = viewPath.tip();
loadView(selectedViewClass);
};
ToggleGroup toggleGroup = new ToggleGroup();
@ -98,7 +99,14 @@ public class AccountSettingsView extends ActivatableViewAndModel {
ViewPath viewPath = navigation.getCurrentPath();
if (viewPath.size() == 3 && viewPath.indexOf(AccountSettingsView.class) == 2 ||
viewPath.size() == 2 && viewPath.indexOf(AccountView.class) == 1) {
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
if (selectedViewClass == null)
selectedViewClass = FiatAccountsView.class;
loadView(selectedViewClass);
/* navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
else
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, selectedViewClass);*/
} else if (viewPath.size() == 4 && viewPath.indexOf(AccountSettingsView.class) == 2) {
selectedViewClass = viewPath.get(3);
loadView(selectedViewClass);

View File

@ -76,6 +76,7 @@ public abstract class Overlay<T extends Overlay> {
private Button actionButton;
protected Label headLineLabel;
protected String dontShowAgainId;
protected String dontShowAgainText;
private Preferences preferences;
protected ChangeListener<Number> positionListener;
protected Timer centerTime;
@ -273,6 +274,11 @@ public abstract class Overlay<T extends Overlay> {
return (T) this;
}
public T dontShowAgainText(String dontShowAgainText) {
this.dontShowAgainText = dontShowAgainText;
return (T) this;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
@ -624,7 +630,9 @@ public abstract class Overlay<T extends Overlay> {
protected void addDontShowAgainCheckBox() {
if (dontShowAgainId != null && preferences != null) {
CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, "Don't show again", buttonDistance - 1);
if (dontShowAgainText == null)
dontShowAgainText = "Don't show again";
CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, dontShowAgainText, buttonDistance - 1);
GridPane.setColumnIndex(dontShowAgainCheckBox, 0);
GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT);
dontShowAgainCheckBox.setOnAction(e -> preferences.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected()));

View File

@ -18,6 +18,7 @@
package io.bitsquare.gui.main.overlays.windows;
import com.google.common.base.Joiner;
import io.bitsquare.btc.FeePolicy;
import io.bitsquare.common.crypto.KeyRing;
import io.bitsquare.common.util.Tuple3;
import io.bitsquare.gui.Navigation;
@ -195,7 +196,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
}
}
rows = 3;
rows = 4;
String paymentMethodCountryCode = offer.getPaymentMethodCountryCode();
if (paymentMethodCountryCode != null)
rows++;
@ -205,6 +206,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
addTitledGroupBg(gridPane, ++rowIndex, rows, "Details", Layout.GROUP_DISTANCE);
addLabelTextField(gridPane, rowIndex, "Offer ID:", offer.getId(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, "Creation date:", formatter.formatDateTime(offer.getDate()));
addLabelTextField(gridPane, ++rowIndex, "Security deposit:", formatter.formatCoinWithCode(FeePolicy.getSecurityDeposit()));
if (paymentMethodCountryCode != null)
addLabelTextField(gridPane, ++rowIndex, "Offerers country of bank:",

View File

@ -18,6 +18,7 @@
package io.bitsquare.gui.main.overlays.windows;
import io.bitsquare.arbitration.DisputeManager;
import io.bitsquare.btc.FeePolicy;
import io.bitsquare.gui.main.overlays.Overlay;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.Layout;
@ -114,7 +115,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
addLabelTextField(gridPane, ++rowIndex, "Currency:", offer.getCurrencyCode());
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(offer.getPaymentMethod().getId()));
rows = 4;
rows = 5;
PaymentAccountContractData buyerPaymentAccountContractData = null;
PaymentAccountContractData sellerPaymentAccountContractData = null;
@ -152,6 +153,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
addTitledGroupBg(gridPane, ++rowIndex, rows, "Details", Layout.GROUP_DISTANCE);
addLabelTextField(gridPane, rowIndex, "Trade ID:", trade.getId(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, "Trade date:", formatter.formatDateTime(trade.getDate()));
addLabelTextField(gridPane, ++rowIndex, "Security deposit:", formatter.formatCoinWithCode(FeePolicy.getSecurityDeposit()));
addLabelTextField(gridPane, ++rowIndex, "Selected arbitrator:", trade.getArbitratorNodeAddress().getFullAddress());
if (contract != null) {

View File

@ -72,6 +72,7 @@ public class BuyerStep2View extends TradeStepView {
String message = "";
if (paymentAccountContractData instanceof BlockChainAccountContractData)
message = "Your trade has reached at least one blockchain confirmation.\n\n" +
"You can wait for more confirmations if you want - 6 confirmations are considered as very secure.\n\n" +
"Please transfer from your external " +
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()) + " wallet\n" +
model.formatter.formatFiatWithCode(trade.getTradeVolume()) + " to the bitcoin seller.\n\n" +
@ -80,6 +81,7 @@ public class BuyerStep2View extends TradeStepView {
"You can copy & paste the values from the main screen after closing that popup.";
else if (paymentAccountContractData != null)
message = "Your trade has reached at least one blockchain confirmation.\n\n" +
"You can wait for more confirmations if you want - 6 confirmations are considered as very secure.\n\n" +
"Please go to your online banking web page and pay " +
model.formatter.formatFiatWithCode(trade.getTradeVolume()) + " to the bitcoin seller.\n\n" +
"Here are the payment account details of the bitcoin seller:\n" +