Add trading popups

This commit is contained in:
Manfred Karrer 2016-03-02 20:05:24 +01:00
parent 29aac699f8
commit 1958de2be9
38 changed files with 472 additions and 298 deletions

View file

@ -217,7 +217,7 @@ public class WalletService {
// reduce for mainnet testing
// TODO revert later when tested enough
FeePolicy.setSecurityDeposit(Coin.parseCoin("0.01")); // 4 EUR @ 400 EUR/BTC
Restrictions.setMaxTradeAmount(Coin.parseCoin("0.01")); // 4 EUR @ 400 EUR/BTC
Restrictions.setMaxTradeAmount(Coin.parseCoin("0.1")); // 40 EUR @ 400 EUR/BTC
// Checkpoints are block headers that ship inside our app: for a new user, we pick the last header
// in the checkpoints file and then download the rest from the network. It makes things much faster.

View file

@ -1,29 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.user;
public class PopupId {
// We don't use an enum because it would break updates if we add a new item in a new version
public static final String TRADE_WALLET = "tradeWallet";
public static final String SEND_PAYMENT_INFO = "sendPaymentInfo";
public static final String PAYMENT_SENT = "paymentSent";
public static final String PAYMENT_RECEIVED = "paymentReceived";
}

View file

@ -96,8 +96,6 @@ public final class Preferences implements Persistable {
private final ArrayList<CryptoCurrency> cryptoCurrencies;
private BlockChainExplorer blockChainExplorerMainNet;
private BlockChainExplorer blockChainExplorerTestNet;
private boolean showNotifications = true;
private boolean showInstructions = true;
private String backupDirectory;
private boolean autoSelectArbitrators = true;
private final Map<String, Boolean> showAgainMap;
@ -146,8 +144,6 @@ public final class Preferences implements Persistable {
if (blockChainExplorerMainNet == null)
setBlockChainExplorerTestNet(blockChainExplorersMainNet.get(0));
showNotifications = persisted.getShowNotifications();
showInstructions = persisted.getShowInstructions();
backupDirectory = persisted.getBackupDirectory();
autoSelectArbitrators = persisted.getAutoSelectArbitrators();
showAgainMap = persisted.getShowAgainMap();
@ -175,11 +171,6 @@ public final class Preferences implements Persistable {
setBlockChainExplorerMainNet(blockChainExplorersMainNet.get(0));
showAgainMap = new HashMap<>();
showAgainMap.put(PopupId.TRADE_WALLET, true);
showAgainMap.put(PopupId.SEND_PAYMENT_INFO, true);
showAgainMap.put(PopupId.PAYMENT_SENT, true);
showAgainMap.put(PopupId.PAYMENT_RECEIVED, true);
preferredLocale = getDefaultLocale();
preferredTradeCurrency = getDefaultTradeCurrency();
@ -219,8 +210,22 @@ public final class Preferences implements Persistable {
tradeCurrenciesAsObservable.addAll(cryptoCurrencies);
}
public void dontShowAgain(String id) {
showAgainMap.put(id, false);
public void dontShowAgain(String key) {
showAgainMap.put(key, false);
storage.queueUpForSave(2000);
}
public void resetDontShowAgainForType() {
showAgainMap.clear();
storage.queueUpForSave(2000);
}
public void removeDontShowAgainForType(String type) {
showAgainMap.keySet().stream().forEach(key -> {
if (key.startsWith(type + "_"))
showAgainMap.put(key, true);
});
storage.queueUpForSave(2000);
}
@ -317,16 +322,6 @@ public final class Preferences implements Persistable {
setBlockChainExplorerTestNet(blockChainExplorer);
}
public void setShowNotifications(boolean showNotifications) {
this.showNotifications = showNotifications;
storage.queueUpForSave(2000);
}
public void setShowInstructions(boolean showInstructions) {
this.showInstructions = showInstructions;
storage.queueUpForSave(2000);
}
public void setTacAccepted(boolean tacAccepted) {
this.tacAccepted = tacAccepted;
storage.queueUpForSave();
@ -430,14 +425,6 @@ public final class Preferences implements Persistable {
return blockChainExplorersTestNet;
}
public boolean getShowNotifications() {
return showNotifications;
}
public boolean getShowInstructions() {
return showInstructions;
}
public String getBackupDirectory() {
return backupDirectory;
}