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

Added feedback popup for DAO test users #2521

Merged
merged 3 commits into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,21 +49,25 @@
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;
import bisq.common.util.Tuple4;

import org.bitcoinj.core.Coin;
import org.bitcoinj.core.InsufficientMoneyException;
import org.bitcoinj.core.Transaction;

import javax.inject.Inject;

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -119,6 +128,8 @@ public class VoteResultView extends ActivatableView<GridPane, Void> 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;
Expand Down Expand Up @@ -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;
Expand All @@ -167,6 +180,8 @@ public VoteResultView(DaoFacade daoFacade,
this.preferences = preferences;
this.bsqFormatter = bsqFormatter;
this.navigation = navigation;
this.myProposalListService = myProposalListService;
this.myBlindVoteListService = myBlindVoteListService;
}

@Override
Expand Down Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions desktop/src/main/java/bisq/desktop/main/overlays/Overlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -185,12 +185,16 @@ public void show() {
addReportErrorButtons();

addButtons();
addDontShowAgainCheckBox();
addDontShowAgainCheckBox(showAgainChecked);
applyStyles();
onShow();
}
}

public void show() {
this.show(false);
}

protected void onShow() {
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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<DAOTestingFeedbackWindow> {
@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();
}
}