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

Conversation

ripcurlx
Copy link
Contributor

@ripcurlx ripcurlx commented Apr 6, 2022

Based on #6092 this is the PR that implements all required changes.
I hope I have covered everything, but it is a lot of testing.

Bildschirmfoto 2022-04-06 um 18 03 16

Bildschirmfoto 2022-04-06 um 18 02 33

Bildschirmfoto 2022-04-06 um 18 02 28

Bildschirmfoto 2022-04-06 um 18 02 24

Bildschirmfoto 2022-04-06 um 18 02 19

Anyone who wants to give it a shot and provide feedback is more than welcome.
This PR also includes improvements in other areas as well (e.g. only Payment methods are shown in filter for selected currency) and many more.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed only small part of this pull request for now. Let me know what do you think about proposed changes. I'm okay if you disagree with them, however I will be very pleased if they will be introduced :)

@@ -502,6 +506,114 @@ public static void setBaseCurrencyCode(String baseCurrencyCode) {
return currencies;
}

public static List<TradeCurrency> getAllInteracETransferIdCurrencies() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about creating static field with supported currencies in InteracETransferAccount instead:

//...
public final class InteracETransferAccount extends PaymentAccount {
    public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("CAD"))
//...

also for other account types (Strike, TikkieId etc.).

As a alternative add SUPPORTED_CURRENCIES into PaymentMethod instead of PaymentAccount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that it would make more sense to move this information closer to the Domain. I didn't spend too much time yet on bigger refactorings to prevent too many unexpected side effects by changing too much. But yes, I think moving it the PaymentMethod would make sense. Although it is a 1:1 relationship all the time AFAIK, but I think it would be a better fit for the PaymentMethod, which is used by the Payment Account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at the code, I revert my opinion and also think adding it to the concrete account implementation is the better way to do this.

@@ -106,6 +113,114 @@ public static boolean isPaymentAccountValidForOffer(Offer offer, PaymentAccount
return acceptedCountryCodes;
}

public static List<TradeCurrency> getTradeCurrencies(PaymentMethod paymentMethod) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method breaks open-closed principle. Refactoring steps suggestion:

  1. make PaymentMethod abstract class, and create dedicated classes, f.e.:
public class SepaPaymentMethod extends PaymentMethod {
    public SepaPaymentMethod () {
        super("SEPA", 6 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK);
    }
}
  1. use created classes in constructors of every PaymentAccount, f.e.:
public SepaAccount() {
    super(new SepaPaymentMethod());
}
  1. To generate list of supported payment methods use similar approach like in AssetRegistry:
static {
    for (PaymentAccount account : ServiceLoader.load(PaymentAccount.class)) {
        registeredAccounts.add(account);
    }
}
    
public Stream<PaymentMethod> getAvailablePaymentMethods() {
    return registeredAccounts.stream().map(account -> account.getPaymentMethod());
}
  • maybe instead loading PaymentAccount instances we should load PaymentMethod instances - see point 5
  1. Add List<TradeCurrency> getSupportedCurrencies() into PaymentMethod

  2. PaymentMethod <-> PaymentAccount seems to be 1:1 relationship. I think it could be used to additional refactoring. f.e. to replace PaymentAccountFactory (which also breaks open-closed principle) with paymentMethod.createAccountInstance()

WDYT ? It could be big refactoring, I didn't analyzed how many changes in codebase it could induce.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree in general with your comment, but this will be a hell of a refactoring and testing. I'd keep it for a separate effort to not completely blow this PR out of proportion.

@ripcurlx ripcurlx force-pushed the improve-navigation-structure branch from eb010e7 to a8189d7 Compare April 7, 2022 18:49
@ripcurlx
Copy link
Contributor Author

ripcurlx commented Apr 8, 2022

take-offer-to-sell-bsq.mov
create-offer-to-buy-xmr.mov
basic-navigation-walk-through.mov

@ghost
Copy link

ghost commented Apr 8, 2022

Checked it out, looks good! (Some niggles need ironing out).

  • Creating BSQ swap offer it somehow is mixing BSQ Swap with Altcoin, because the offer that gets created has a security deposit Tx and gets displayed like an altcoin offer even though it says "BSQ Swap" as offer type. When that offer gets taken the trade fails with "hash of payment account is invalid". This is a clean build from your current branch, run on a fresh regtest env with no altcoin accounts.

  • Clicking on an offer in Market View does not always take me to the market containing that offer. e.g. There is only one offer in the market a Buy BSQ offer. In Market View click on the offer. It takes me to Sell BTC for Fiat, and has BSQ selected in the currency drop down. No offer is shown.

@ripcurlx
Copy link
Contributor Author

Checked it out, looks good! (Some niggles need ironing out).

  • Creating BSQ swap offer it somehow is mixing BSQ Swap with Altcoin, because the offer that gets created has a security deposit Tx and gets displayed like an altcoin offer even though it says "BSQ Swap" as offer type. When that offer gets taken the trade fails with "hash of payment account is invalid". This is a clean build from your current branch, run on a fresh regtest env with no altcoin accounts.
  • Clicking on an offer in Market View does not always take me to the market containing that offer. e.g. There is only one offer in the market a Buy BSQ offer. In Market View click on the offer. It takes me to Sell BTC for Fiat, and has BSQ selected in the currency drop down. No offer is shown.

Thanks for testing - I'll look at the BSQ Swap issue you experienced in more detail. It did work for me, so it is kind of weird. I'll post an update today as soon as I'm through with my testing.

@Market View: It can be that there is an issue. I only fixed the behavior on the buy/sell buttons, but not on the triggers in each row. Quite a bit of changes this change caused in the end 😅

@ripcurlx
Copy link
Contributor Author

ripcurlx commented Apr 11, 2022

@jmacxx I just tested it again to create a Buy BSQ and a Sell BSQ offer using BSQ Swaps and it worked as expected for me. Is there a specific flow you used to generate this issue?

The only case where this could happen IMO is that BSQ Swap didn't switch to the BsqSwapCreateOfferView in your case using the regular CreateOfferView.

@ripcurlx
Copy link
Contributor Author

I'll try it with a fresh account without any Altcoin accounts next. Maybe that causes this weird behavior.

Otherwise it would display the old 'Buy BTC' and 'Sell BTC' navigation
@ripcurlx
Copy link
Contributor Author

Ok - now I'm able to reproduce the issue. It is as I expected caused with a fresh account with only one BSQ account.

@ripcurlx
Copy link
Contributor Author

ripcurlx commented Apr 11, 2022

@jmacxx Just fixed your issue with 1712f74

@ripcurlx ripcurlx closed this Apr 11, 2022
@ripcurlx ripcurlx reopened this Apr 11, 2022
@ripcurlx
Copy link
Contributor Author

Adapted the amount and volume description so it matches the fiat case.

Fiat
Bildschirmfoto 2022-04-11 um 12 14 33

Altcoin
Bildschirmfoto 2022-04-11 um 12 14 15

@ripcurlx
Copy link
Contributor Author

I'm probably already quite blind by all these changes, but I haven't found anything obvious anymore comparing it with v1.8.4 on Mainnet. I'll proceed with the one open refactoring and might do some performance optimizations and clean-ups (and create some new bugs of course 🤪 )

@ghost
Copy link

ghost commented Apr 20, 2022

Found one "not obvious" kind of issue - preferred currency set to crypto has impact to fiat logic:

  • go to Settings -> Preferences
  • switch preferred currency to ETH, XMR, BSQ
  • go to Buy->Bitcoin or Sell->Bitcoin tab
  • see strange behavior (crypto offers visible on list, not possible to create offer)

Sorry for being pain 🥺

@ripcurlx
Copy link
Contributor Author

Found one "not obvious" kind of issue - preferred currency set to crypto has impact to fiat logic:

  • go to Settings -> Preferences
  • switch preferred currency to ETH, XMR, BSQ
  • go to Buy->Bitcoin or Sell->Bitcoin tab
  • see strange behavior (crypto offers visible on list, not possible to create offer)

Sorry for being pain 🥺

No worries! Better you find the bug than users. Should be fixed now.

@ripcurlx
Copy link
Contributor Author

After doing some Mainnet tests I found some more edge cases with the preferred currency, which needs some minor improvements - will do it tomorrow.

@ripcurlx ripcurlx force-pushed the improve-navigation-structure branch from de9be4c to 89926d1 Compare April 20, 2022 20:34
@ripcurlx
Copy link
Contributor Author

I think it is now in a state ready for a final review testing @jmacxx @xyzmaker123

There is one UX problem IMO opinion that needs to get solved which we have already for a long time and I'm not 100% sure how we want to solve it best.

Let's assume you want to buy XMR.

Bildschirmfoto 2022-04-21 um 10 17 41

But all those offers doesn't fit your need and you want to create an own offer to buy XMR.

Bildschirmfoto 2022-04-21 um 10 19 58

Bildschirmfoto 2022-04-21 um 10 20 14

Bildschirmfoto 2022-04-21 um 10 20 28

Bildschirmfoto 2022-04-21 um 10 20 33

So what would you expect now? ATM for a new user we close the popup show a notification that you can manage your offers in portfolio. If you close this notification and/or are an existing user it will bring you back to the list of XMR offers that can be bought. But of course there is not your offer visible as it is under Sell > XMR as you created an offer to buy XMR.

Shall we navigate the user instead to the buy XMR offers under Sell > XMR instead?

@UX-P What is your take on this?

@ripcurlx ripcurlx mentioned this pull request Apr 21, 2022
@UX-P
Copy link

UX-P commented Apr 21, 2022

@ripcurlx looks good!
The user should land on the Portfolio screen 'My open offers'. This provides them with immediate access to review and undo their action.

Also, in regards to the create offer screen, instead of 'choose trading account' could the header text read ' Create offer' so that it is clear to the user they are now creating an offer.

@ghost
Copy link

ghost commented Apr 21, 2022

ACK - I created a few offers on regtest, took them etc. and everything worked okay. Also tested scenarios that has issues before, and now everything is okay. Good job!

@ripcurlx
Copy link
Contributor Author

Also, in regards to the create offer screen, instead of 'choose trading account' could the header text read ' Create offer' so that it is clear to the user they are now creating an offer.

Sure - I can do the same for "Take offer" as well. I'll adapt the navigational behavior as well.

@ripcurlx ripcurlx force-pushed the improve-navigation-structure branch from 389aeb9 to 4447435 Compare April 22, 2022 08:01
@ripcurlx
Copy link
Contributor Author

@UX-P It will now look like this:
Bildschirmfoto 2022-04-22 um 10 02 18
Bildschirmfoto 2022-04-22 um 09 53 11

If it is a crypto currency and not a fiat currency
@ripcurlx
Copy link
Contributor Author

The user can now adapt the forth tab by setting a crypto currency as his preferred currency. If no crypto currency is set it will default to XMR.

Example with ETH
Bildschirmfoto 2022-04-22 um 10 39 07
XMR as default Altcoin
Bildschirmfoto 2022-04-22 um 10 39 49

Copy link
Contributor

@bisq-github-admin-3 bisq-github-admin-3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK - based on #6135 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants