Skip to content

Commit

Permalink
Merge pull request #6209 from ripcurlx/fix-matching-account-toggle
Browse files Browse the repository at this point in the history
Update matching account toggle state when tab is selected
  • Loading branch information
bisq-github-admin-3 authored May 18, 2022
2 parents 1a5dad0 + 0edfd17 commit 671263c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public void onTabSelected(boolean isSelected) {
if (isSelected) {
updateCurrencyComboBoxFromModel();
root.requestFocus();
updateCreateOfferButton();
matchingOffersToggle.setSelected(model.useOffersMatchingMyAccountsFilter);
}
updateCreateOfferButton();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,7 @@ public OfferBookViewModel(User user,
protected void activate() {
filteredItems.addListener(filterItemsListener);

if (user != null) {
disableMatchToggle.set(user.getPaymentAccounts() == null || user.getPaymentAccounts().isEmpty());
}
useOffersMatchingMyAccountsFilter = !disableMatchToggle.get() && isShowOffersMatchingMyAccounts();
updateMatchingAccountToggleState();

fillCurrencies();
updateSelectedTradeCurrency();
Expand Down Expand Up @@ -268,6 +265,7 @@ void onTabSelected(boolean isSelected) {
if (isTabSelected) {
updateSelectedTradeCurrency();
filterOffers();
updateMatchingAccountToggleState();
}
}

Expand Down Expand Up @@ -561,6 +559,13 @@ private void fillCurrencies() {
fillCurrencies(tradeCurrencies, allCurrencies);
}

private void updateMatchingAccountToggleState() {
if (user != null) {
disableMatchToggle.set(user.getPaymentAccounts() == null || user.getPaymentAccounts().isEmpty());
}
useOffersMatchingMyAccountsFilter = !disableMatchToggle.get() && isShowOffersMatchingMyAccounts();
}

abstract void fillCurrencies(ObservableList<TradeCurrency> tradeCurrencies,
ObservableList<TradeCurrency> allCurrencies);

Expand Down

0 comments on commit 671263c

Please sign in to comment.