Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve navigation structure #6135

Merged
merged 35 commits into from Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
98f355d
Adapt navigational structure and offerbook handling to buy and sell d…
ripcurlx Apr 1, 2022
875e5f4
Adapt offer book chart view to new navigational structure
ripcurlx Apr 1, 2022
5781e3b
Add payment account filtering for remaining payment methods
ripcurlx Apr 1, 2022
810a29b
Add missing payment account filtering
ripcurlx Apr 1, 2022
e3ceb80
Show all payment methods
ripcurlx Apr 1, 2022
924e92a
Adapt take offer process to new navigation structure
ripcurlx Apr 4, 2022
a8189d7
Adapt create offer process to new navigation structure
ripcurlx Apr 6, 2022
497158a
Fix rebase errors with master
ripcurlx Apr 7, 2022
33725c2
Adapt navigation labels back to currency code
ripcurlx Apr 8, 2022
b70d102
Fix BSQ swap labels
ripcurlx Apr 8, 2022
98285da
Move OfferViewUtil
ripcurlx Apr 11, 2022
b734420
Fix navigation to specific offer book view
ripcurlx Apr 11, 2022
5b67766
Properly rename main navigation
ripcurlx Apr 11, 2022
1712f74
Use BSQ Swap as default when BSQ offer is created
ripcurlx Apr 11, 2022
492ff35
Adapt amount and volume description for take offer
ripcurlx Apr 11, 2022
63ea054
Adapt amount and volume description for create offer
ripcurlx Apr 11, 2022
9a3ed33
Use Offer.isFiat helper method
ripcurlx Apr 11, 2022
542cc4d
Remove close button duplication in DetailsWindows
ripcurlx Apr 11, 2022
098ece2
Only show BSQ accounts
ripcurlx Apr 11, 2022
2055cc5
Fix wrong check to show BSQ swap as default for create offer
ripcurlx Apr 11, 2022
fce247c
Fix a couple of issues regarding default currencies
ripcurlx Apr 13, 2022
348d147
Fix broken option for BSQ Altcoin and BSQ Altcoin Instant
ripcurlx Apr 19, 2022
e43bad1
Fix offer count for Altcoins
ripcurlx Apr 19, 2022
d41235c
Fix storage of crypto screen currency
ripcurlx Apr 19, 2022
be16166
Fix sorting issue for Altcoins
ripcurlx Apr 20, 2022
7ecd159
Fix BSQ swap create offer handling (again)
ripcurlx Apr 20, 2022
108255b
Move supported currencies into payment accounts
ripcurlx Apr 20, 2022
e43a8ae
Fix handling of preferred currency
ripcurlx Apr 20, 2022
0894037
Add safeguard for already stored crypto currencies in preferences by …
ripcurlx Apr 20, 2022
89926d1
Improve help icon
ripcurlx Apr 20, 2022
3ce374e
Unify tab handling
ripcurlx Apr 21, 2022
2233f73
Fix Codacy complaints
ripcurlx Apr 21, 2022
4ce861a
Add create and take offer title
ripcurlx Apr 22, 2022
4447435
Switch to open offers after creating a new offer
ripcurlx Apr 22, 2022
7ad2dd0
Set preferred currency as top altcoin
ripcurlx Apr 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -21,7 +21,7 @@
import bisq.core.locale.TradeCurrency;
import bisq.core.payment.AdvancedCashAccount;
import bisq.core.payment.AliPayAccount;
import bisq.core.payment.AustraliaPayid;
import bisq.core.payment.AustraliaPayidAccount;
import bisq.core.payment.CapitualAccount;
import bisq.core.payment.CashDepositAccount;
import bisq.core.payment.ClearXchangeAccount;
Expand Down Expand Up @@ -81,7 +81,8 @@
import static bisq.apitest.config.ApiTestConfig.USD;
import static bisq.apitest.config.BisqAppConfig.alicedaemon;
import static bisq.cli.table.builder.TableType.PAYMENT_ACCOUNT_TBL;
import static bisq.core.locale.CurrencyUtil.*;
import static bisq.core.locale.CurrencyUtil.getAllSortedFiatCurrencies;
import static bisq.core.locale.CurrencyUtil.getTradeCurrency;
import static bisq.core.payment.payload.PaymentMethod.*;
import static java.util.Comparator.comparing;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -117,7 +118,7 @@ public void testCreateAdvancedCashAccount(TestInfo testInfo) {
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, ADVANCED_CASH_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Advanced Cash Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NR, "0000 1111 2222");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllAdvancedCashCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, AdvancedCashAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -126,7 +127,7 @@ public void testCreateAdvancedCashAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
AdvancedCashAccount paymentAccount = (AdvancedCashAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllAdvancedCashCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(AdvancedCashAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -166,7 +167,7 @@ public void testCreateAustraliaPayidAccount(TestInfo testInfo) {
COMPLETED_FORM_MAP.put(PROPERTY_NAME_BANK_ACCOUNT_NAME, "Credit Union Australia");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_SALT, encodeToHex("Restored Australia Pay ID Acct Salt"));
String jsonString = getCompletedFormAsJsonString();
AustraliaPayid paymentAccount = (AustraliaPayid) createPaymentAccount(aliceClient, jsonString);
AustraliaPayidAccount paymentAccount = (AustraliaPayidAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountSingleTradeCurrency("AUD", paymentAccount);
verifyCommonFormEntries(paymentAccount);
Expand All @@ -185,7 +186,7 @@ public void testCreateCapitualAccount(TestInfo testInfo) {
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, CAPITUAL_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Capitual Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NR, "1111 2222 3333-4");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllCapitualCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, CapitualAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -194,7 +195,7 @@ public void testCreateCapitualAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
CapitualAccount paymentAccount = (CapitualAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllCapitualCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(CapitualAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -491,7 +492,7 @@ public void testCreateMoneyGramAccount(TestInfo testInfo) {
PROPERTY_NAME_STATE);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, MONEY_GRAM_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Money Gram Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllMoneyGramCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, MoneyGramAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -504,7 +505,7 @@ public void testCreateMoneyGramAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
MoneyGramAccount paymentAccount = (MoneyGramAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllMoneyGramCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(MoneyGramAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -544,7 +545,7 @@ public void testCreatePaxumAccount(TestInfo testInfo) {
PROPERTY_NAME_EMAIL);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, PAXUM_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Paxum Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllPaxumCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, PaxumAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -554,7 +555,7 @@ public void testCreatePaxumAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
PaxumAccount paymentAccount = (PaxumAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllPaxumCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(PaxumAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand All @@ -570,7 +571,7 @@ public void testCreatePayseraAccount(TestInfo testInfo) {
PROPERTY_NAME_EMAIL);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, PAYSERA_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Paysera Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllPayseraCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, PayseraAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -580,7 +581,7 @@ public void testCreatePayseraAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
PayseraAccount paymentAccount = (PayseraAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllPayseraCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(PayseraAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -638,7 +639,7 @@ public void testCreateRevolutAccount(TestInfo testInfo) {
PROPERTY_NAME_USERNAME);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, REVOLUT_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Revolut Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllRevolutCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, RevolutAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -648,7 +649,7 @@ public void testCreateRevolutAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
RevolutAccount paymentAccount = (RevolutAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllRevolutCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(RevolutAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -959,7 +960,7 @@ public void testCreateTransferwiseAccountWithSupportedTradeCurrencies(TestInfo t
PROPERTY_NAME_EMAIL);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, TRANSFERWISE_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Transferwise Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllTransferwiseCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, TransferwiseAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -969,7 +970,7 @@ public void testCreateTransferwiseAccountWithSupportedTradeCurrencies(TestInfo t
String jsonString = getCompletedFormAsJsonString();
TransferwiseAccount paymentAccount = (TransferwiseAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllTransferwiseCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(TransferwiseAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down Expand Up @@ -1024,7 +1025,7 @@ public void testCreateUpholdAccount(TestInfo testInfo) {
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, UPHOLD_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "Uphold Acct");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_ID, "UA 9876");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, getAllUpholdCurrencies()
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, UpholdAccount.SUPPORTED_CURRENCIES
.stream()
.map(TradeCurrency::getCode)
.collect(Collectors.joining(",")));
Expand All @@ -1033,7 +1034,7 @@ public void testCreateUpholdAccount(TestInfo testInfo) {
String jsonString = getCompletedFormAsJsonString();
UpholdAccount paymentAccount = (UpholdAccount) createPaymentAccount(aliceClient, jsonString);
verifyUserPayloadHasPaymentAccountWithId(aliceClient, paymentAccount.getId());
verifyAccountTradeCurrencies(getAllUpholdCurrencies(), paymentAccount);
verifyAccountTradeCurrencies(UpholdAccount.SUPPORTED_CURRENCIES, paymentAccount);
assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY),
paymentAccount.getSelectedTradeCurrency().getCode());
verifyCommonFormEntries(paymentAccount);
Expand Down
Expand Up @@ -52,8 +52,10 @@
import static bisq.common.util.ReflectionUtils.*;
import static bisq.common.util.Utilities.decodeFromHex;
import static bisq.core.locale.CountryUtil.findCountryByCode;
import static bisq.core.locale.CurrencyUtil.*;
import static bisq.core.payment.payload.PaymentMethod.*;
import static bisq.core.locale.CurrencyUtil.getCurrencyByCountryCode;
import static bisq.core.locale.CurrencyUtil.getTradeCurrenciesInList;
import static bisq.core.locale.CurrencyUtil.getTradeCurrency;
import static bisq.core.payment.payload.PaymentMethod.MONEY_GRAM_ID;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format;
import static java.util.Arrays.stream;
Expand Down Expand Up @@ -377,30 +379,7 @@ private boolean didReadTradeCurrenciesField(JsonReader in,

private Optional<List<TradeCurrency>> getReconciledTradeCurrencies(List<String> currencyCodes,
PaymentAccount account) {
if (account.hasPaymentMethodWithId(ADVANCED_CASH_ID))
return getTradeCurrenciesInList(currencyCodes, getAllAdvancedCashCurrencies());
else if (account.hasPaymentMethodWithId(AMAZON_GIFT_CARD_ID))
return getTradeCurrenciesInList(currencyCodes, getAllAmazonGiftCardCurrencies());
else if (account.hasPaymentMethodWithId(CAPITUAL_ID))
return getTradeCurrenciesInList(currencyCodes, getAllCapitualCurrencies());
else if (account.hasPaymentMethodWithId(MONEY_GRAM_ID))
return getTradeCurrenciesInList(currencyCodes, getAllMoneyGramCurrencies());
else if (account.hasPaymentMethodWithId(PAXUM_ID))
return getTradeCurrenciesInList(currencyCodes, getAllPaxumCurrencies());
else if (account.hasPaymentMethodWithId(PAYSERA_ID))
return getTradeCurrenciesInList(currencyCodes, getAllPayseraCurrencies());
else if (account.hasPaymentMethodWithId(REVOLUT_ID))
return getTradeCurrenciesInList(currencyCodes, getAllRevolutCurrencies());
else if (account.hasPaymentMethodWithId(SWIFT_ID))
return getTradeCurrenciesInList(currencyCodes,
new ArrayList<>(getAllSortedFiatCurrencies(
comparing(TradeCurrency::getCode))));
else if (account.hasPaymentMethodWithId(TRANSFERWISE_ID))
return getTradeCurrenciesInList(currencyCodes, getAllTransferwiseCurrencies());
else if (account.hasPaymentMethodWithId(UPHOLD_ID))
return getTradeCurrenciesInList(currencyCodes, getAllUpholdCurrencies());
else
return Optional.empty();
return getTradeCurrenciesInList(currencyCodes, account.getSupportedCurrencies());
}

private boolean didReadSelectedTradeCurrencyField(JsonReader in,
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/bisq/core/locale/CountryUtil.java
Expand Up @@ -21,6 +21,7 @@
import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -61,7 +62,7 @@ public static List<Country> getAllAmazonGiftCardCountries() {
String[] codes = {"AU", "CA", "FR", "DE", "IT", "NL", "ES", "GB", "IN", "JP",
"SA", "SE", "SG", "TR", "US"};
populateCountryListByCodes(list, codes);
list.sort((a, b) -> a.name.compareTo(b.name));
list.sort(Comparator.comparing(a -> a.name));

return list;
}
Expand Down