From 917d27da6bd38181acec8e10ddfb6a7d3850f32c Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 5 Apr 2018 10:59:01 +0200 Subject: [PATCH 1/5] Revert "Enable Travis CI Gradle dependency caching" This reverts commit 92ec88f1fc6712c1315959cc073bdec68add08e8. --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c83f08631f..ed2abf26c06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,5 @@ language: java jdk: oraclejdk8 -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ notifications: slack: on_success: change From 2848e7527e92d0eb797c89d6905b8b8ab581bfac Mon Sep 17 00:00:00 2001 From: sqrrm Date: Thu, 5 Apr 2018 21:03:05 +0200 Subject: [PATCH 2/5] Refactor move Phase to Cycles --- .../components/SeparatedPhaseBars.java | 6 +++--- .../main/dao/proposal/BaseProposalView.java | 7 ++++--- .../main/dao/proposal/ProposalListItem.java | 5 +++-- .../proposal/active/ActiveProposalsView.java | 5 +++-- .../dashboard/ProposalDashboardView.java | 19 ++++++++++--------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java b/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java index e68b155d851..7e3c2cfa8d5 100644 --- a/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java +++ b/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java @@ -17,7 +17,7 @@ package bisq.desktop.components; -import bisq.core.dao.vote.PeriodService; +import bisq.core.dao.vote.Cycles; import bisq.core.locale.Res; import bisq.common.UserThread; @@ -139,7 +139,7 @@ private void adjustWidth(double availableWidth) { @Getter public static class SeparatedPhaseBarsItem { - private final PeriodService.Phase phase; + private final Cycles.Phase phase; private final boolean showBlocks; private final IntegerProperty startValueProperty = new SimpleIntegerProperty(); private final IntegerProperty endValueProperty = new SimpleIntegerProperty(); @@ -150,7 +150,7 @@ public static class SeparatedPhaseBarsItem { @Setter private Label titleLabel; - public SeparatedPhaseBarsItem(PeriodService.Phase phase, boolean showBlocks) { + public SeparatedPhaseBarsItem(Cycles.Phase phase, boolean showBlocks) { this.phase = phase; this.showBlocks = showBlocks; } diff --git a/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java b/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java index 371fe77ba31..4a9a628553d 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java @@ -29,6 +29,7 @@ import bisq.core.dao.blockchain.BsqBlockChain; import bisq.core.dao.blockchain.ReadableBsqBlockChain; import bisq.core.dao.blockchain.vo.BsqBlock; +import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.proposal.Proposal; import bisq.core.dao.vote.proposal.ProposalPayload; @@ -86,9 +87,9 @@ public abstract class BaseProposalView extends ActivatableView i protected GridPane detailsGridPane, gridPane; protected ProposalListItem selectedProposalListItem; protected ListChangeListener proposalListChangeListener; - protected ChangeListener phaseChangeListener; + protected ChangeListener phaseChangeListener; protected final PeriodService periodService; - protected PeriodService.Phase currentPhase; + protected Cycles.Phase currentPhase; protected Subscription phaseSubscription; private ScrollPane proposalDisplayView; @@ -236,7 +237,7 @@ protected void onSelectProposal(ProposalListItem item) { hideProposalDisplay(); } - protected void onPhaseChanged(PeriodService.Phase phase) { + protected void onPhaseChanged(Cycles.Phase phase) { if (!phase.equals(this.currentPhase)) { this.currentPhase = phase; onSelectProposal(selectedProposalListItem); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java b/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java index 99903701125..dcf156b8147 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java @@ -27,6 +27,7 @@ import bisq.core.dao.blockchain.ReadableBsqBlockChain; import bisq.core.dao.blockchain.vo.BsqBlock; import bisq.core.dao.blockchain.vo.Tx; +import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.proposal.Proposal; import bisq.core.dao.vote.proposal.ProposalService; @@ -72,7 +73,7 @@ public class ProposalListItem implements BsqBlockChain.Listener { private TxConfidenceListener txConfidenceListener; private Tooltip tooltip = new Tooltip(Res.get("confidence.unknown")); private Transaction walletTransaction; - private ChangeListener phaseChangeListener; + private ChangeListener phaseChangeListener; private AutoTooltipButton actionButton; private ImageView actionButtonIconView; @Setter @@ -122,7 +123,7 @@ public class ProposalListItem implements BsqBlockChain.Listener { proposal.getVoteResultProperty().addListener(voteResultChangeListener); } - public void applyState(PeriodService.Phase newValue, VoteResult voteResult) { + public void applyState(Cycles.Phase newValue, VoteResult voteResult) { actionButton.setText(""); actionButton.setVisible(false); actionButton.setOnAction(null); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java b/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java index 268c08d4fe8..f0d8b6df22a 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java @@ -32,6 +32,7 @@ import bisq.core.btc.wallet.BsqWalletService; import bisq.core.btc.wallet.InsufficientBsqException; import bisq.core.dao.blockchain.ReadableBsqBlockChain; +import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.blindvote.BlindVoteService; import bisq.core.dao.vote.proposal.Proposal; @@ -251,10 +252,10 @@ private void onCancelVote() { } @Override - protected void onPhaseChanged(PeriodService.Phase phase) { + protected void onPhaseChanged(Cycles.Phase phase) { super.onPhaseChanged(phase); - changeVoteViewItemsVisibility(phase == PeriodService.Phase.BLIND_VOTE); + changeVoteViewItemsVisibility(phase == Cycles.Phase.BLIND_VOTE); if (removeButton != null) { removeButton.setManaged(false); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java index 197be5c2535..3b2facb11df 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java @@ -23,6 +23,7 @@ import bisq.desktop.util.Layout; import bisq.core.btc.wallet.BsqWalletService; +import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.locale.Res; @@ -49,7 +50,7 @@ public class ProposalDashboardView extends ActivatableView { private List phaseBarsItems; private final BsqWalletService bsqWalletService; private final PeriodService periodService; - private PeriodService.Phase currentPhase; + private Cycles.Phase currentPhase; private Subscription phaseSubscription; private GridPane gridPane; private int gridRow = 0; @@ -97,14 +98,14 @@ public void initialize() { private SeparatedPhaseBars createSeparatedPhaseBars() { phaseBarsItems = Arrays.asList( - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.PROPOSAL, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK1, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BLIND_VOTE, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK2, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.VOTE_REVEAL, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK3, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.ISSUANCE, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK4, false)); + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.PROPOSAL, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK1, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BLIND_VOTE, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK2, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.VOTE_REVEAL, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK3, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.ISSUANCE, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK4, false)); return new SeparatedPhaseBars(phaseBarsItems); } From 3a553b1d1103ca3275c20b437ac185e7889500c9 Mon Sep 17 00:00:00 2001 From: sqrrm Date: Fri, 6 Apr 2018 01:06:38 +0200 Subject: [PATCH 3/5] Fix phase calculation --- .../main/dao/proposal/dashboard/ProposalDashboardView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java index 3b2facb11df..98ba599034c 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java @@ -147,7 +147,7 @@ private void onChainHeightChanged(int height) { item.setStartAndEnd(startBlock, endBlock); double progress = 0; if (height >= startBlock && height <= endBlock) { - progress = (double) (height - startBlock + 1) / (double) item.getPhase().getDurationInBlocks(); + progress = (double) (height - startBlock + 1) / (double) periodService.getCycle(height).getPhaseDuration(item.getPhase()); } else if (height < startBlock) { progress = 0; } else if (height > endBlock) { From 405a07447afe03bcf38f5cc394df9d8ee5fb8dfd Mon Sep 17 00:00:00 2001 From: sqrrm Date: Sat, 7 Apr 2018 15:12:46 +0200 Subject: [PATCH 4/5] Refactor Phase back to PeriodService --- .../components/SeparatedPhaseBars.java | 6 +++--- .../main/dao/proposal/BaseProposalView.java | 7 +++---- .../main/dao/proposal/ProposalListItem.java | 5 ++--- .../proposal/active/ActiveProposalsView.java | 5 ++--- .../dashboard/ProposalDashboardView.java | 19 +++++++++---------- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java b/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java index 7e3c2cfa8d5..e68b155d851 100644 --- a/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java +++ b/src/main/java/bisq/desktop/components/SeparatedPhaseBars.java @@ -17,7 +17,7 @@ package bisq.desktop.components; -import bisq.core.dao.vote.Cycles; +import bisq.core.dao.vote.PeriodService; import bisq.core.locale.Res; import bisq.common.UserThread; @@ -139,7 +139,7 @@ private void adjustWidth(double availableWidth) { @Getter public static class SeparatedPhaseBarsItem { - private final Cycles.Phase phase; + private final PeriodService.Phase phase; private final boolean showBlocks; private final IntegerProperty startValueProperty = new SimpleIntegerProperty(); private final IntegerProperty endValueProperty = new SimpleIntegerProperty(); @@ -150,7 +150,7 @@ public static class SeparatedPhaseBarsItem { @Setter private Label titleLabel; - public SeparatedPhaseBarsItem(Cycles.Phase phase, boolean showBlocks) { + public SeparatedPhaseBarsItem(PeriodService.Phase phase, boolean showBlocks) { this.phase = phase; this.showBlocks = showBlocks; } diff --git a/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java b/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java index 4a9a628553d..371fe77ba31 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/BaseProposalView.java @@ -29,7 +29,6 @@ import bisq.core.dao.blockchain.BsqBlockChain; import bisq.core.dao.blockchain.ReadableBsqBlockChain; import bisq.core.dao.blockchain.vo.BsqBlock; -import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.proposal.Proposal; import bisq.core.dao.vote.proposal.ProposalPayload; @@ -87,9 +86,9 @@ public abstract class BaseProposalView extends ActivatableView i protected GridPane detailsGridPane, gridPane; protected ProposalListItem selectedProposalListItem; protected ListChangeListener proposalListChangeListener; - protected ChangeListener phaseChangeListener; + protected ChangeListener phaseChangeListener; protected final PeriodService periodService; - protected Cycles.Phase currentPhase; + protected PeriodService.Phase currentPhase; protected Subscription phaseSubscription; private ScrollPane proposalDisplayView; @@ -237,7 +236,7 @@ protected void onSelectProposal(ProposalListItem item) { hideProposalDisplay(); } - protected void onPhaseChanged(Cycles.Phase phase) { + protected void onPhaseChanged(PeriodService.Phase phase) { if (!phase.equals(this.currentPhase)) { this.currentPhase = phase; onSelectProposal(selectedProposalListItem); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java b/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java index dcf156b8147..99903701125 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/ProposalListItem.java @@ -27,7 +27,6 @@ import bisq.core.dao.blockchain.ReadableBsqBlockChain; import bisq.core.dao.blockchain.vo.BsqBlock; import bisq.core.dao.blockchain.vo.Tx; -import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.proposal.Proposal; import bisq.core.dao.vote.proposal.ProposalService; @@ -73,7 +72,7 @@ public class ProposalListItem implements BsqBlockChain.Listener { private TxConfidenceListener txConfidenceListener; private Tooltip tooltip = new Tooltip(Res.get("confidence.unknown")); private Transaction walletTransaction; - private ChangeListener phaseChangeListener; + private ChangeListener phaseChangeListener; private AutoTooltipButton actionButton; private ImageView actionButtonIconView; @Setter @@ -123,7 +122,7 @@ public class ProposalListItem implements BsqBlockChain.Listener { proposal.getVoteResultProperty().addListener(voteResultChangeListener); } - public void applyState(Cycles.Phase newValue, VoteResult voteResult) { + public void applyState(PeriodService.Phase newValue, VoteResult voteResult) { actionButton.setText(""); actionButton.setVisible(false); actionButton.setOnAction(null); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java b/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java index f0d8b6df22a..268c08d4fe8 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/active/ActiveProposalsView.java @@ -32,7 +32,6 @@ import bisq.core.btc.wallet.BsqWalletService; import bisq.core.btc.wallet.InsufficientBsqException; import bisq.core.dao.blockchain.ReadableBsqBlockChain; -import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.dao.vote.blindvote.BlindVoteService; import bisq.core.dao.vote.proposal.Proposal; @@ -252,10 +251,10 @@ private void onCancelVote() { } @Override - protected void onPhaseChanged(Cycles.Phase phase) { + protected void onPhaseChanged(PeriodService.Phase phase) { super.onPhaseChanged(phase); - changeVoteViewItemsVisibility(phase == Cycles.Phase.BLIND_VOTE); + changeVoteViewItemsVisibility(phase == PeriodService.Phase.BLIND_VOTE); if (removeButton != null) { removeButton.setManaged(false); diff --git a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java index 98ba599034c..4b06d9bc1ec 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java @@ -23,7 +23,6 @@ import bisq.desktop.util.Layout; import bisq.core.btc.wallet.BsqWalletService; -import bisq.core.dao.vote.Cycles; import bisq.core.dao.vote.PeriodService; import bisq.core.locale.Res; @@ -50,7 +49,7 @@ public class ProposalDashboardView extends ActivatableView { private List phaseBarsItems; private final BsqWalletService bsqWalletService; private final PeriodService periodService; - private Cycles.Phase currentPhase; + private PeriodService.Phase currentPhase; private Subscription phaseSubscription; private GridPane gridPane; private int gridRow = 0; @@ -98,14 +97,14 @@ public void initialize() { private SeparatedPhaseBars createSeparatedPhaseBars() { phaseBarsItems = Arrays.asList( - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.PROPOSAL, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK1, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BLIND_VOTE, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK2, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.VOTE_REVEAL, true), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK3, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.ISSUANCE, false), - new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK4, false)); + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.PROPOSAL, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK1, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BLIND_VOTE, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK2, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.VOTE_REVEAL, true), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK3, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.ISSUANCE, false), + new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK4, false)); return new SeparatedPhaseBars(phaseBarsItems); } From c5b01a0ed455d9a56c2253a222fecf261ca1bece Mon Sep 17 00:00:00 2001 From: sqrrm Date: Sat, 7 Apr 2018 15:42:16 +0200 Subject: [PATCH 5/5] Rename StartBlock to FirstBlock, EndBlock to LastBlock --- .../main/dao/proposal/dashboard/ProposalDashboardView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java index 4b06d9bc1ec..2bc5eb0e01a 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/dashboard/ProposalDashboardView.java @@ -141,12 +141,13 @@ protected void deactivate() { private void onChainHeightChanged(int height) { phaseBarsItems.forEach(item -> { - int startBlock = periodService.getAbsoluteStartBlockOfPhase(height, item.getPhase()); - int endBlock = periodService.getAbsoluteEndBlockOfPhase(height, item.getPhase()); + int startBlock = periodService.getFirstBlockOfPhase(periodService.getCycle(height), item.getPhase()); + int endBlock = periodService.getLastBlockOfPhase(periodService.getCycle(height), item.getPhase()); item.setStartAndEnd(startBlock, endBlock); double progress = 0; if (height >= startBlock && height <= endBlock) { - progress = (double) (height - startBlock + 1) / (double) periodService.getCycle(height).getPhaseDuration(item.getPhase()); + progress = (double) (height - startBlock + 1) / + (double) periodService.getCycle(height).getPhaseDuration(item.getPhase()); } else if (height < startBlock) { progress = 0; } else if (height > endBlock) {