diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 36bb8f3d77a..573631e7e37 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -671,6 +671,15 @@ tradeFeedbackWindow.msg.part1=We'd love to hear back from you about your experie tradeFeedbackWindow.msg.part2=If you have any questions, or experienced any problems, please get in touch with other users and contributors via the Bisq forum at: tradeFeedbackWindow.msg.part3=Thanks for using Bisq! + +daoTestingFeedbackWindow.title=Thank you for testing the Bisq DAO +daoTestingFeedbackWindow.msg.part1=Can you spare 3 minutes to do a quick survey? We're offering 20 BSQ for completed surveys.\ + \nYour feedback is crucial to ensuring a smooth launch on mainnet. +daoTestingFeedbackWindow.surveyLinkLabel=Do survey +daoTestingFeedbackWindow.msg.part2=Questions, or other issues? Discuss with Bisq users and contributors on the forum: +daoTestingFeedbackWindow.forumLinkLabel=Visit forum +daoTestingFeedbackWindow.msg.part3=Thanks for using Bisq! + portfolio.pending.role=My role portfolio.pending.tradeInformation=Trade information portfolio.pending.remainingTime=Remaining time diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 916efe7dc5f..3e8d3615cd0 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -31,6 +31,7 @@ import bisq.desktop.main.dao.governance.PhasesView; import bisq.desktop.main.dao.governance.ProposalDisplay; import bisq.desktop.main.overlays.popups.Popup; +import bisq.desktop.main.overlays.windows.DAOTestingFeedbackWindow; import bisq.desktop.util.GUIUtil; import bisq.desktop.util.Layout; import bisq.desktop.util.validation.BsqValidator; @@ -48,14 +49,17 @@ import bisq.core.dao.state.model.blockchain.Block; import bisq.core.dao.state.model.governance.Ballot; import bisq.core.dao.state.model.governance.DaoPhase; +import bisq.core.dao.state.model.governance.DecryptedBallotsWithMerits; import bisq.core.dao.state.model.governance.EvaluatedProposal; import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; +import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.common.UserThread; import bisq.common.app.DevEnv; import bisq.common.util.Tuple2; import bisq.common.util.Tuple3; @@ -63,6 +67,7 @@ import org.bitcoinj.core.Coin; import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.Transaction; import javax.inject.Inject; @@ -101,6 +106,7 @@ import java.util.Comparator; import java.util.List; import java.util.Optional; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import javax.annotation.Nullable; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index d45be826cf9..633ec79181a 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -27,14 +27,19 @@ import bisq.desktop.main.dao.governance.PhasesView; import bisq.desktop.main.dao.governance.ProposalDisplay; import bisq.desktop.main.overlays.popups.Popup; +import bisq.desktop.main.overlays.windows.DAOTestingFeedbackWindow; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.GUIUtil; import bisq.desktop.util.Layout; import bisq.core.btc.wallet.BsqWalletService; import bisq.core.dao.DaoFacade; +import bisq.core.dao.governance.blindvote.BlindVote; +import bisq.core.dao.governance.blindvote.MyBlindVoteListService; import bisq.core.dao.governance.period.CycleService; import bisq.core.dao.governance.period.PeriodService; +import bisq.core.dao.governance.proposal.MyProposalList; +import bisq.core.dao.governance.proposal.MyProposalListService; import bisq.core.dao.governance.proposal.ProposalService; import bisq.core.dao.governance.voteresult.VoteResultException; import bisq.core.dao.governance.voteresult.VoteResultService; @@ -54,12 +59,15 @@ import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; +import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.util.BsqFormatter; +import bisq.common.UserThread; import bisq.common.util.Tuple2; import org.bitcoinj.core.Coin; +import org.bitcoinj.core.Transaction; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -104,6 +112,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @FxmlView @@ -119,6 +128,8 @@ public class VoteResultView extends ActivatableView implements D private final Preferences preferences; private final BsqFormatter bsqFormatter; private final Navigation navigation; + private MyProposalListService myProposalListService; + private MyBlindVoteListService myBlindVoteListService; private Button exportButton; private int gridRow = 0; @@ -155,7 +166,9 @@ public VoteResultView(DaoFacade daoFacade, BsqWalletService bsqWalletService, Preferences preferences, BsqFormatter bsqFormatter, - Navigation navigation) { + Navigation navigation, + MyProposalListService myProposalListService, + MyBlindVoteListService myBlindVoteListService) { this.daoFacade = daoFacade; this.phasesView = phasesView; this.daoStateService = daoStateService; @@ -167,6 +180,8 @@ public VoteResultView(DaoFacade daoFacade, this.preferences = preferences; this.bsqFormatter = bsqFormatter; this.navigation = navigation; + this.myProposalListService = myProposalListService; + this.myBlindVoteListService = myBlindVoteListService; } @Override @@ -358,9 +373,26 @@ private void fillCycleList() { }); Collections.reverse(cycleListItemList); + maybeShowDAOTestingFeedbackWindow(); + GUIUtil.setFitToRowsForTableView(cyclesTableView, 25, 28, 2, 4); } + private void maybeShowDAOTestingFeedbackWindow() { + String testingPopupKey = "daoTestingFeedbackPopup"; + if (DontShowAgainLookup.showAgain(testingPopupKey)) { + UserThread.runAfter(() -> { + if (myProposalListService.getList().stream().map(Proposal::getTxId) + .anyMatch(txId -> periodService.isTxInCorrectCycle(txId, daoStateService.getChainHeight())) || + myBlindVoteListService.getMyBlindVoteList().stream().map(BlindVote::getTxId) + .anyMatch(txId -> periodService.isTxInCorrectCycle(txId, daoStateService.getChainHeight()))) + new DAOTestingFeedbackWindow() + .dontShowAgainId(testingPopupKey) + .show(); + }, 4, TimeUnit.SECONDS); + } + } + /////////////////////////////////////////////////////////////////////////////////////////// // Create views: cyclesTableView diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/Overlay.java b/desktop/src/main/java/bisq/desktop/main/overlays/Overlay.java index c784f895b39..3aab67996e9 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/Overlay.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/Overlay.java @@ -172,7 +172,7 @@ protected enum Type { public Overlay() { } - public void show() { + public void show(boolean showAgainChecked) { if (dontShowAgainId == null || DontShowAgainLookup.showAgain(dontShowAgainId)) { createGridPane(); addHeadLine(); @@ -185,12 +185,16 @@ public void show() { addReportErrorButtons(); addButtons(); - addDontShowAgainCheckBox(); + addDontShowAgainCheckBox(showAgainChecked); applyStyles(); onShow(); } } + public void show() { + this.show(false); + } + protected void onShow() { } @@ -839,19 +843,25 @@ protected void addBusyAnimation() { gridPane.getChildren().add(busyAnimation); } - protected void addDontShowAgainCheckBox() { + protected void addDontShowAgainCheckBox(boolean isChecked) { if (dontShowAgainId != null) { // We might have set it and overridden the default, so we check if it is not set if (dontShowAgainText == null) dontShowAgainText = Res.get("popup.doNotShowAgain"); CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, dontShowAgainText, buttonDistance - 1); + dontShowAgainCheckBox.setSelected(isChecked); + DontShowAgainLookup.dontShowAgain(dontShowAgainId, isChecked); GridPane.setColumnIndex(dontShowAgainCheckBox, 0); GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT); dontShowAgainCheckBox.setOnAction(e -> DontShowAgainLookup.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected())); } } + protected void addDontShowAgainCheckBox() { + this.addDontShowAgainCheckBox(false); + } + protected void addButtons() { if (!hideCloseButton) { closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DAOTestingFeedbackWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DAOTestingFeedbackWindow.java new file mode 100644 index 00000000000..375d7686634 --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DAOTestingFeedbackWindow.java @@ -0,0 +1,91 @@ +/* + * This file is part of Bisq. + * + * Bisq 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. + * + * Bisq 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 Bisq. If not, see . + */ + +package bisq.desktop.main.overlays.windows; + +import bisq.desktop.components.AutoTooltipLabel; +import bisq.desktop.components.HyperlinkWithIcon; +import bisq.desktop.main.overlays.Overlay; + +import bisq.core.locale.Res; + +import com.google.inject.Inject; + +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Priority; + +import javafx.geometry.HPos; +import javafx.geometry.Insets; + +import lombok.extern.slf4j.Slf4j; + +import static bisq.desktop.util.FormBuilder.addHyperlinkWithIcon; + +@Slf4j +public class DAOTestingFeedbackWindow extends Overlay { + @Inject + public DAOTestingFeedbackWindow() { + type = Type.Confirmation; + } + + @Override + public void show() { + headLine(Res.get("daoTestingFeedbackWindow.title")); + message(Res.get("daoTestingFeedbackWindow.msg.part1")); + hideCloseButton(); + actionButtonText(Res.get("shared.close")); + super.show(true); + } + + @Override + protected void addMessage() { + super.addMessage(); + + HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, Res.get("daoTestingFeedbackWindow.surveyLinkLabel"), + "https://docs.google.com/forms/d/e/1FAIpQLSdS4YRE9Eox3bvuo4oSJJQCm5Yy54ZclKC_ThUt702PeU4rxw/viewform"); + GridPane.setMargin(survey, new Insets(-6, 0, 10, -4)); + + AutoTooltipLabel messageLabel2 = new AutoTooltipLabel(Res.get("daoTestingFeedbackWindow.msg.part2")); + messageLabel2.setMouseTransparent(true); + messageLabel2.setWrapText(true); + GridPane.setHalignment(messageLabel2, HPos.LEFT); + GridPane.setHgrow(messageLabel2, Priority.ALWAYS); + GridPane.setRowIndex(messageLabel2, ++rowIndex); + GridPane.setColumnIndex(messageLabel2, 0); + GridPane.setColumnSpan(messageLabel2, 2); + gridPane.getChildren().add(messageLabel2); + + HyperlinkWithIcon forum = addHyperlinkWithIcon(gridPane, ++rowIndex, Res.get("daoTestingFeedbackWindow.forumLinkLabel"), + "https://bisq.community", 40); + GridPane.setMargin(forum, new Insets(-6, 0, 10, -4)); + + AutoTooltipLabel messageLabel3 = new AutoTooltipLabel(Res.get("daoTestingFeedbackWindow.msg.part3")); + messageLabel3.setMouseTransparent(true); + messageLabel3.setWrapText(true); + GridPane.setHalignment(messageLabel3, HPos.LEFT); + GridPane.setHgrow(messageLabel3, Priority.ALWAYS); + GridPane.setRowIndex(messageLabel3, ++rowIndex); + GridPane.setColumnIndex(messageLabel3, 0); + GridPane.setColumnSpan(messageLabel3, 2); + gridPane.getChildren().add(messageLabel3); + } + + @Override + protected void onShow() { + display(); + } +}