From 4bef95172c5c34f3f1541319ae73f6229862a563 Mon Sep 17 00:00:00 2001 From: napoly Date: Fri, 17 Mar 2023 18:43:33 +0100 Subject: [PATCH] Update Signed Offers view in legacy UI --- .github/workflows/build.yml | 8 +- .../resources/i18n/displayStrings.properties | 1 + .../signedoffer/SignedOfferListItem.java | 48 ++ .../signedoffer}/SignedOfferView.fxml | 6 +- .../offer/signedoffer/SignedOfferView.java | 358 ++++++++++++++ .../signedoffer/SignedOffersDataModel.java | 70 +++ .../signedoffer/SignedOffersViewModel.java | 39 ++ .../desktop/main/support/SupportView.java | 2 +- .../dispute/agent/SignedOfferView.java | 438 ------------------ 9 files changed, 525 insertions(+), 445 deletions(-) create mode 100644 desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferListItem.java rename desktop/src/main/java/haveno/desktop/main/{support/dispute/agent => offer/signedoffer}/SignedOfferView.fxml (87%) create mode 100644 desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.java create mode 100644 desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOffersDataModel.java create mode 100644 desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOffersViewModel.java delete mode 100644 desktop/src/main/java/haveno/desktop/main/support/dispute/agent/SignedOfferView.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68d4af83..bf12e778 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,11 +14,11 @@ jobs: fail-fast: false runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: lfs: true - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '11' distribution: 'adopt' @@ -26,11 +26,11 @@ jobs: - name: Build with Gradle run: ./gradlew build --stacktrace --scan - name: cache nodes dependencies - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: cached-localnet path: .localnet - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: failure() with: name: gradlew-report diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 7f3830dd..e970949a 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -90,6 +90,7 @@ shared.usage=Usage shared.state=Status shared.tradeId=Trade ID shared.offerId=Offer ID +shared.traderId=Trader ID shared.bankName=Bank name shared.acceptedBanks=Accepted banks shared.amountMinMax=Amount (min - max) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferListItem.java b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferListItem.java new file mode 100644 index 00000000..7a1e2677 --- /dev/null +++ b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferListItem.java @@ -0,0 +1,48 @@ +/* + * This file is part of Haveno. + * + * Haveno 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. + * + * Haveno 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 Haveno. If not, see . + */ + +package haveno.desktop.main.offer.signedoffer; + +import org.apache.commons.lang3.StringUtils; + +import lombok.Getter; + +import haveno.core.offer.SignedOffer; +import haveno.desktop.util.filtering.FilterableListItem; + +class SignedOfferListItem implements FilterableListItem { + @Getter + private final SignedOffer signedOffer; + + SignedOfferListItem(SignedOffer signedOffer) { + this.signedOffer = signedOffer; + } + + @Override + public boolean match(String filterString) { + if (filterString.isEmpty()) { + return true; + } + if (StringUtils.containsIgnoreCase(String.valueOf(signedOffer.getTraderId()), filterString)) { + return true; + } + if (StringUtils.containsIgnoreCase(String.valueOf(signedOffer.getOfferId()), filterString)) { + return true; + } + return StringUtils.containsIgnoreCase(String.valueOf(signedOffer.getReserveTxKeyImages()), filterString); + } +} diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/SignedOfferView.fxml b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.fxml similarity index 87% rename from desktop/src/main/java/haveno/desktop/main/support/dispute/agent/SignedOfferView.fxml rename to desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.fxml index 38f839c5..a12a9799 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/SignedOfferView.fxml +++ b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.fxml @@ -17,17 +17,19 @@ ~ along with Haveno. If not, see . --> - - + + +