mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Add flags for deactivating dao and dao phase 2 features
This commit is contained in:
parent
224de8a65a
commit
362b0f9793
10 changed files with 73 additions and 39 deletions
|
@ -19,4 +19,7 @@ public class DevEnv {
|
||||||
// offers are filled with default values. Intended to make dev testing faster.
|
// offers are filled with default values. Intended to make dev testing faster.
|
||||||
@SuppressWarnings("PointlessBooleanExpression")
|
@SuppressWarnings("PointlessBooleanExpression")
|
||||||
public static final boolean DEV_MODE = STRESS_TEST_MODE || true;
|
public static final boolean DEV_MODE = STRESS_TEST_MODE || true;
|
||||||
|
|
||||||
|
public static final boolean DAO_ACTIVATED = false;
|
||||||
|
public static final boolean DAO_PHASE2_ACTIVATED = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package io.bisq.core.dao;
|
package io.bisq.core.dao;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.handlers.ErrorMessageHandler;
|
import io.bisq.common.handlers.ErrorMessageHandler;
|
||||||
import io.bisq.core.btc.provider.squ.BsqUtxoFeedService;
|
import io.bisq.core.btc.provider.squ.BsqUtxoFeedService;
|
||||||
import io.bisq.core.dao.blockchain.BsqBlockchainManager;
|
import io.bisq.core.dao.blockchain.BsqBlockchainManager;
|
||||||
|
@ -54,12 +55,14 @@ public class DaoManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAllServicesInitialized(ErrorMessageHandler errorMessageHandler) {
|
public void onAllServicesInitialized(ErrorMessageHandler errorMessageHandler) {
|
||||||
|
if (DevEnv.DAO_ACTIVATED) {
|
||||||
daoPeriodService.onAllServicesInitialized();
|
daoPeriodService.onAllServicesInitialized();
|
||||||
bsqUtxoFeedService.onAllServicesInitialized();
|
bsqUtxoFeedService.onAllServicesInitialized();
|
||||||
voteManager.onAllServicesInitialized();
|
voteManager.onAllServicesInitialized();
|
||||||
compensationRequestManager.onAllServicesInitialized();
|
compensationRequestManager.onAllServicesInitialized();
|
||||||
bsqBlockchainManager.onAllServicesInitialized(errorMessageHandler);
|
bsqBlockchainManager.onAllServicesInitialized(errorMessageHandler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package io.bisq.core.dao.blockchain;
|
package io.bisq.core.dao.blockchain;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.handlers.ErrorMessageHandler;
|
import io.bisq.common.handlers.ErrorMessageHandler;
|
||||||
import io.bisq.core.dao.DaoOptionKeys;
|
import io.bisq.core.dao.DaoOptionKeys;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -42,6 +43,7 @@ public class BsqBlockchainManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
public void addBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||||
|
if (DevEnv.DAO_ACTIVATED)
|
||||||
bsqNode.addBsqChainStateListener(bsqChainStateListener);
|
bsqNode.addBsqChainStateListener(bsqChainStateListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ public class BsqBlockchainManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
public void removeBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||||
|
if (DevEnv.DAO_ACTIVATED)
|
||||||
bsqNode.removeBsqChainStateListener(bsqChainStateListener);
|
bsqNode.removeBsqChainStateListener(bsqChainStateListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package io.bisq.core.dao.compensation;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.proto.persistable.PersistableList;
|
import io.bisq.common.proto.persistable.PersistableList;
|
||||||
import io.bisq.common.proto.persistable.PersistedDataHost;
|
import io.bisq.common.proto.persistable.PersistedDataHost;
|
||||||
import io.bisq.common.storage.Storage;
|
import io.bisq.common.storage.Storage;
|
||||||
|
@ -81,6 +82,7 @@ public class CompensationRequestManager implements PersistedDataHost {
|
||||||
|
|
||||||
observableList = FXCollections.observableArrayList(model.getList());
|
observableList = FXCollections.observableArrayList(model.getList());
|
||||||
|
|
||||||
|
if (DevEnv.DAO_ACTIVATED) {
|
||||||
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
|
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAdded(ProtectedStorageEntry data) {
|
public void onAdded(ProtectedStorageEntry data) {
|
||||||
|
@ -102,13 +104,16 @@ public class CompensationRequestManager implements PersistedDataHost {
|
||||||
addToList((CompensationRequestPayload) storagePayload, false);
|
addToList((CompensationRequestPayload) storagePayload, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readPersisted() {
|
public void readPersisted() {
|
||||||
|
if (DevEnv.DAO_ACTIVATED) {
|
||||||
PersistableList<CompensationRequest> persisted = compensationRequestsStorage.initAndGetPersistedWithFileName("CompensationRequests");
|
PersistableList<CompensationRequest> persisted = compensationRequestsStorage.initAndGetPersistedWithFileName("CompensationRequests");
|
||||||
if (persisted != null)
|
if (persisted != null)
|
||||||
model.setPersistedCompensationRequest(persisted.getList());
|
model.setPersistedCompensationRequest(persisted.getList());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onAllServicesInitialized() {
|
public void onAllServicesInitialized() {
|
||||||
/*if (daoPeriodService.getPhase() == DaoPeriodService.Phase.OPEN_FOR_COMPENSATION_REQUESTS) {
|
/*if (daoPeriodService.getPhase() == DaoPeriodService.Phase.OPEN_FOR_COMPENSATION_REQUESTS) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ package io.bisq.core.dao.vote;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.app.Version;
|
import io.bisq.common.app.Version;
|
||||||
import io.bisq.common.proto.ProtoUtil;
|
import io.bisq.common.proto.ProtoUtil;
|
||||||
import io.bisq.common.proto.persistable.PersistableList;
|
import io.bisq.common.proto.persistable.PersistableList;
|
||||||
|
@ -92,10 +93,12 @@ public class VotingManager implements PersistedDataHost {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readPersisted() {
|
public void readPersisted() {
|
||||||
|
if (DevEnv.DAO_ACTIVATED) {
|
||||||
PersistableList<VoteItemsList> persisted = voteItemCollectionsStorage.initAndGetPersistedWithFileName("VoteItemCollections");
|
PersistableList<VoteItemsList> persisted = voteItemCollectionsStorage.initAndGetPersistedWithFileName("VoteItemCollections");
|
||||||
if (persisted != null)
|
if (persisted != null)
|
||||||
voteItemsLists.addAll(persisted.getList());
|
voteItemsLists.addAll(persisted.getList());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onAllServicesInitialized() {
|
public void onAllServicesInitialized() {
|
||||||
if (daoPeriodService.getPhase() == DaoPeriodService.Phase.OPEN_FOR_VOTING) {
|
if (daoPeriodService.getPhase() == DaoPeriodService.Phase.OPEN_FOR_VOTING) {
|
||||||
|
|
|
@ -143,6 +143,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||||
Pane portfolioButtonHolder = new Pane(portfolioButton);
|
Pane portfolioButtonHolder = new Pane(portfolioButton);
|
||||||
Pane disputesButtonHolder = new Pane(disputesButton);
|
Pane disputesButtonHolder = new Pane(disputesButton);
|
||||||
|
|
||||||
|
if (!DevEnv.DAO_ACTIVATED) {
|
||||||
|
daoButton.setVisible(false);
|
||||||
|
daoButton.setManaged(false);
|
||||||
|
}
|
||||||
HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {{
|
HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {{
|
||||||
setLeftAnchor(this, 10d);
|
setLeftAnchor(this, 10d);
|
||||||
setTopAnchor(this, 0d);
|
setTopAnchor(this, 0d);
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class MainViewModel implements ViewModel {
|
||||||
private final Preferences preferences;
|
private final Preferences preferences;
|
||||||
private final AlertManager alertManager;
|
private final AlertManager alertManager;
|
||||||
private final PrivateNotificationManager privateNotificationManager;
|
private final PrivateNotificationManager privateNotificationManager;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||||
private final FilterManager filterManager;
|
private final FilterManager filterManager;
|
||||||
private final WalletPasswordWindow walletPasswordWindow;
|
private final WalletPasswordWindow walletPasswordWindow;
|
||||||
private final TradeStatisticsManager tradeStatisticsManager;
|
private final TradeStatisticsManager tradeStatisticsManager;
|
||||||
|
@ -143,12 +143,14 @@ public class MainViewModel implements ViewModel {
|
||||||
final StringProperty availableBalance = new SimpleStringProperty();
|
final StringProperty availableBalance = new SimpleStringProperty();
|
||||||
final StringProperty reservedBalance = new SimpleStringProperty();
|
final StringProperty reservedBalance = new SimpleStringProperty();
|
||||||
final StringProperty lockedBalance = new SimpleStringProperty();
|
final StringProperty lockedBalance = new SimpleStringProperty();
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private MonadicBinding<String> btcInfoBinding;
|
private MonadicBinding<String> btcInfoBinding;
|
||||||
|
|
||||||
private final StringProperty marketPrice = new SimpleStringProperty(Res.get("shared.na"));
|
private final StringProperty marketPrice = new SimpleStringProperty(Res.get("shared.na"));
|
||||||
|
|
||||||
// P2P network
|
// P2P network
|
||||||
final StringProperty p2PNetworkInfo = new SimpleStringProperty();
|
final StringProperty p2PNetworkInfo = new SimpleStringProperty();
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private MonadicBinding<String> p2PNetworkInfoBinding;
|
private MonadicBinding<String> p2PNetworkInfoBinding;
|
||||||
final BooleanProperty splashP2PNetworkAnimationVisible = new SimpleBooleanProperty(true);
|
final BooleanProperty splashP2PNetworkAnimationVisible = new SimpleBooleanProperty(true);
|
||||||
final StringProperty p2pNetworkWarnMsg = new SimpleStringProperty();
|
final StringProperty p2pNetworkWarnMsg = new SimpleStringProperty();
|
||||||
|
@ -163,6 +165,7 @@ public class MainViewModel implements ViewModel {
|
||||||
private final String btcNetworkAsString;
|
private final String btcNetworkAsString;
|
||||||
final StringProperty p2pNetworkLabelId = new SimpleStringProperty("footer-pane");
|
final StringProperty p2pNetworkLabelId = new SimpleStringProperty("footer-pane");
|
||||||
|
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private MonadicBinding<Boolean> allServicesDone, tradesAndUIReady;
|
private MonadicBinding<Boolean> allServicesDone, tradesAndUIReady;
|
||||||
final PriceFeedService priceFeedService;
|
final PriceFeedService priceFeedService;
|
||||||
private final User user;
|
private final User user;
|
||||||
|
@ -171,8 +174,9 @@ public class MainViewModel implements ViewModel {
|
||||||
private Timer checkNumberOfP2pNetworkPeersTimer;
|
private Timer checkNumberOfP2pNetworkPeersTimer;
|
||||||
private final Map<String, Subscription> disputeIsClosedSubscriptionsMap = new HashMap<>();
|
private final Map<String, Subscription> disputeIsClosedSubscriptionsMap = new HashMap<>();
|
||||||
final ObservableList<PriceFeedComboBoxItem> priceFeedComboBoxItems = FXCollections.observableArrayList();
|
final ObservableList<PriceFeedComboBoxItem> priceFeedComboBoxItems = FXCollections.observableArrayList();
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private MonadicBinding<String> marketPriceBinding;
|
private MonadicBinding<String> marketPriceBinding;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||||
private Subscription priceFeedAllLoadedSubscription;
|
private Subscription priceFeedAllLoadedSubscription;
|
||||||
private Popup startupTimeoutPopup;
|
private Popup startupTimeoutPopup;
|
||||||
private BooleanProperty p2pNetWorkReady;
|
private BooleanProperty p2pNetWorkReady;
|
||||||
|
@ -241,6 +245,7 @@ public class MainViewModel implements ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTacWindow() {
|
private void showTacWindow() {
|
||||||
|
//noinspection ConstantConditions,ConstantConditions
|
||||||
if (!preferences.isTacAccepted() && !DevEnv.DEV_MODE) {
|
if (!preferences.isTacAccepted() && !DevEnv.DEV_MODE) {
|
||||||
UserThread.runAfter(() -> {
|
UserThread.runAfter(() -> {
|
||||||
tacWindow.onAction(() -> {
|
tacWindow.onAction(() -> {
|
||||||
|
|
|
@ -26,6 +26,4 @@
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
||||||
|
|
||||||
<Tab fx:id="bsqWalletTab" closable="false"/>
|
<Tab fx:id="bsqWalletTab" closable="false"/>
|
||||||
<Tab fx:id="compensationTab" closable="false"/>
|
|
||||||
<Tab fx:id="votingTab" closable="false"/>
|
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bisq.gui.main.dao;
|
package io.bisq.gui.main.dao;
|
||||||
|
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.locale.Res;
|
import io.bisq.common.locale.Res;
|
||||||
import io.bisq.gui.Navigation;
|
import io.bisq.gui.Navigation;
|
||||||
import io.bisq.gui.common.model.Activatable;
|
import io.bisq.gui.common.model.Activatable;
|
||||||
|
@ -56,9 +57,14 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
if (DevEnv.DAO_PHASE2_ACTIVATED) {
|
||||||
|
compensationTab = new Tab(Res.get("dao.tab.compensation"));
|
||||||
|
votingTab = new Tab(Res.get("dao.tab.voting"));
|
||||||
|
compensationTab.setClosable(false);
|
||||||
|
votingTab.setClosable(false);
|
||||||
|
root.getTabs().addAll(compensationTab, votingTab);
|
||||||
|
}
|
||||||
bsqWalletTab.setText(Res.get("dao.tab.bsqWallet"));
|
bsqWalletTab.setText(Res.get("dao.tab.bsqWallet"));
|
||||||
compensationTab.setText(Res.get("dao.tab.compensation"));
|
|
||||||
votingTab.setText(Res.get("dao.tab.voting"));
|
|
||||||
|
|
||||||
navigationListener = viewPath -> {
|
navigationListener = viewPath -> {
|
||||||
if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) {
|
if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ package io.bisq.gui.main.dao.wallet.tx;
|
||||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||||
import io.bisq.common.UserThread;
|
import io.bisq.common.UserThread;
|
||||||
|
import io.bisq.common.app.DevEnv;
|
||||||
import io.bisq.common.locale.Res;
|
import io.bisq.common.locale.Res;
|
||||||
import io.bisq.core.btc.wallet.BsqBalanceListener;
|
import io.bisq.core.btc.wallet.BsqBalanceListener;
|
||||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||||
|
@ -122,7 +123,10 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
chainSyncIndicator = new ProgressBar();
|
chainSyncIndicator = new ProgressBar();
|
||||||
chainSyncIndicator.setPrefWidth(120);
|
chainSyncIndicator.setPrefWidth(120);
|
||||||
|
if (DevEnv.DAO_ACTIVATED)
|
||||||
chainSyncIndicator.setProgress(-1);
|
chainSyncIndicator.setProgress(-1);
|
||||||
|
else
|
||||||
|
chainSyncIndicator.setProgress(0);
|
||||||
chainSyncIndicator.setPadding(new Insets(-6, 0, -10, 5));
|
chainSyncIndicator.setPadding(new Insets(-6, 0, -10, 5));
|
||||||
|
|
||||||
chainHeightLabel = FormBuilder.addLabel(root, ++gridRow, "");
|
chainHeightLabel = FormBuilder.addLabel(root, ++gridRow, "");
|
||||||
|
|
Loading…
Add table
Reference in a new issue