mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +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.
|
||||
@SuppressWarnings("PointlessBooleanExpression")
|
||||
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;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.handlers.ErrorMessageHandler;
|
||||
import io.bisq.core.btc.provider.squ.BsqUtxoFeedService;
|
||||
import io.bisq.core.dao.blockchain.BsqBlockchainManager;
|
||||
|
@ -54,11 +55,13 @@ public class DaoManager {
|
|||
}
|
||||
|
||||
public void onAllServicesInitialized(ErrorMessageHandler errorMessageHandler) {
|
||||
daoPeriodService.onAllServicesInitialized();
|
||||
bsqUtxoFeedService.onAllServicesInitialized();
|
||||
voteManager.onAllServicesInitialized();
|
||||
compensationRequestManager.onAllServicesInitialized();
|
||||
bsqBlockchainManager.onAllServicesInitialized(errorMessageHandler);
|
||||
if (DevEnv.DAO_ACTIVATED) {
|
||||
daoPeriodService.onAllServicesInitialized();
|
||||
bsqUtxoFeedService.onAllServicesInitialized();
|
||||
voteManager.onAllServicesInitialized();
|
||||
compensationRequestManager.onAllServicesInitialized();
|
||||
bsqBlockchainManager.onAllServicesInitialized(errorMessageHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package io.bisq.core.dao.blockchain;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.handlers.ErrorMessageHandler;
|
||||
import io.bisq.core.dao.DaoOptionKeys;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -42,7 +43,8 @@ public class BsqBlockchainManager {
|
|||
}
|
||||
|
||||
public void addBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||
bsqNode.addBsqChainStateListener(bsqChainStateListener);
|
||||
if (DevEnv.DAO_ACTIVATED)
|
||||
bsqNode.addBsqChainStateListener(bsqChainStateListener);
|
||||
}
|
||||
|
||||
public boolean isParseBlockchainComplete() {
|
||||
|
@ -50,6 +52,7 @@ public class BsqBlockchainManager {
|
|||
}
|
||||
|
||||
public void removeBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||
bsqNode.removeBsqChainStateListener(bsqChainStateListener);
|
||||
if (DevEnv.DAO_ACTIVATED)
|
||||
bsqNode.removeBsqChainStateListener(bsqChainStateListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bisq.core.dao.compensation;
|
|||
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.inject.Inject;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.proto.persistable.PersistableList;
|
||||
import io.bisq.common.proto.persistable.PersistedDataHost;
|
||||
import io.bisq.common.storage.Storage;
|
||||
|
@ -81,33 +82,37 @@ public class CompensationRequestManager implements PersistedDataHost {
|
|||
|
||||
observableList = FXCollections.observableArrayList(model.getList());
|
||||
|
||||
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
|
||||
@Override
|
||||
public void onAdded(ProtectedStorageEntry data) {
|
||||
final StoragePayload storagePayload = data.getStoragePayload();
|
||||
if (DevEnv.DAO_ACTIVATED) {
|
||||
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
|
||||
@Override
|
||||
public void onAdded(ProtectedStorageEntry data) {
|
||||
final StoragePayload storagePayload = data.getStoragePayload();
|
||||
if (storagePayload instanceof CompensationRequestPayload)
|
||||
addToList((CompensationRequestPayload) storagePayload, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(ProtectedStorageEntry data) {
|
||||
// TODO
|
||||
}
|
||||
});
|
||||
|
||||
// At startup the P2PDataStorage inits earlier, otherwise we ge the listener called.
|
||||
p2PService.getP2PDataStorage().getMap().values().forEach(e -> {
|
||||
final StoragePayload storagePayload = e.getStoragePayload();
|
||||
if (storagePayload instanceof CompensationRequestPayload)
|
||||
addToList((CompensationRequestPayload) storagePayload, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(ProtectedStorageEntry data) {
|
||||
// TODO
|
||||
}
|
||||
});
|
||||
|
||||
// At startup the P2PDataStorage inits earlier, otherwise we ge the listener called.
|
||||
p2PService.getP2PDataStorage().getMap().values().forEach(e -> {
|
||||
final StoragePayload storagePayload = e.getStoragePayload();
|
||||
if (storagePayload instanceof CompensationRequestPayload)
|
||||
addToList((CompensationRequestPayload) storagePayload, false);
|
||||
});
|
||||
addToList((CompensationRequestPayload) storagePayload, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPersisted() {
|
||||
PersistableList<CompensationRequest> persisted = compensationRequestsStorage.initAndGetPersistedWithFileName("CompensationRequests");
|
||||
if (persisted != null)
|
||||
model.setPersistedCompensationRequest(persisted.getList());
|
||||
if (DevEnv.DAO_ACTIVATED) {
|
||||
PersistableList<CompensationRequest> persisted = compensationRequestsStorage.initAndGetPersistedWithFileName("CompensationRequests");
|
||||
if (persisted != null)
|
||||
model.setPersistedCompensationRequest(persisted.getList());
|
||||
}
|
||||
}
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bisq.core.dao.vote;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.proto.ProtoUtil;
|
||||
import io.bisq.common.proto.persistable.PersistableList;
|
||||
|
@ -92,9 +93,11 @@ public class VotingManager implements PersistedDataHost {
|
|||
|
||||
@Override
|
||||
public void readPersisted() {
|
||||
PersistableList<VoteItemsList> persisted = voteItemCollectionsStorage.initAndGetPersistedWithFileName("VoteItemCollections");
|
||||
if (persisted != null)
|
||||
voteItemsLists.addAll(persisted.getList());
|
||||
if (DevEnv.DAO_ACTIVATED) {
|
||||
PersistableList<VoteItemsList> persisted = voteItemCollectionsStorage.initAndGetPersistedWithFileName("VoteItemCollections");
|
||||
if (persisted != null)
|
||||
voteItemsLists.addAll(persisted.getList());
|
||||
}
|
||||
}
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
|
|
|
@ -143,6 +143,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
Pane portfolioButtonHolder = new Pane(portfolioButton);
|
||||
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) {{
|
||||
setLeftAnchor(this, 10d);
|
||||
setTopAnchor(this, 0d);
|
||||
|
|
|
@ -116,7 +116,7 @@ public class MainViewModel implements ViewModel {
|
|||
private final Preferences preferences;
|
||||
private final AlertManager alertManager;
|
||||
private final PrivateNotificationManager privateNotificationManager;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||
private final FilterManager filterManager;
|
||||
private final WalletPasswordWindow walletPasswordWindow;
|
||||
private final TradeStatisticsManager tradeStatisticsManager;
|
||||
|
@ -143,12 +143,14 @@ public class MainViewModel implements ViewModel {
|
|||
final StringProperty availableBalance = new SimpleStringProperty();
|
||||
final StringProperty reservedBalance = new SimpleStringProperty();
|
||||
final StringProperty lockedBalance = new SimpleStringProperty();
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private MonadicBinding<String> btcInfoBinding;
|
||||
|
||||
private final StringProperty marketPrice = new SimpleStringProperty(Res.get("shared.na"));
|
||||
|
||||
// P2P network
|
||||
final StringProperty p2PNetworkInfo = new SimpleStringProperty();
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private MonadicBinding<String> p2PNetworkInfoBinding;
|
||||
final BooleanProperty splashP2PNetworkAnimationVisible = new SimpleBooleanProperty(true);
|
||||
final StringProperty p2pNetworkWarnMsg = new SimpleStringProperty();
|
||||
|
@ -163,6 +165,7 @@ public class MainViewModel implements ViewModel {
|
|||
private final String btcNetworkAsString;
|
||||
final StringProperty p2pNetworkLabelId = new SimpleStringProperty("footer-pane");
|
||||
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private MonadicBinding<Boolean> allServicesDone, tradesAndUIReady;
|
||||
final PriceFeedService priceFeedService;
|
||||
private final User user;
|
||||
|
@ -171,8 +174,9 @@ public class MainViewModel implements ViewModel {
|
|||
private Timer checkNumberOfP2pNetworkPeersTimer;
|
||||
private final Map<String, Subscription> disputeIsClosedSubscriptionsMap = new HashMap<>();
|
||||
final ObservableList<PriceFeedComboBoxItem> priceFeedComboBoxItems = FXCollections.observableArrayList();
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private MonadicBinding<String> marketPriceBinding;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||
private Subscription priceFeedAllLoadedSubscription;
|
||||
private Popup startupTimeoutPopup;
|
||||
private BooleanProperty p2pNetWorkReady;
|
||||
|
@ -241,6 +245,7 @@ public class MainViewModel implements ViewModel {
|
|||
}
|
||||
|
||||
private void showTacWindow() {
|
||||
//noinspection ConstantConditions,ConstantConditions
|
||||
if (!preferences.isTacAccepted() && !DevEnv.DEV_MODE) {
|
||||
UserThread.runAfter(() -> {
|
||||
tacWindow.onAction(() -> {
|
||||
|
|
|
@ -26,6 +26,4 @@
|
|||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Tab fx:id="bsqWalletTab" closable="false"/>
|
||||
<Tab fx:id="compensationTab" closable="false"/>
|
||||
<Tab fx:id="votingTab" closable="false"/>
|
||||
</TabPane>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bisq.gui.main.dao;
|
||||
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.gui.Navigation;
|
||||
import io.bisq.gui.common.model.Activatable;
|
||||
|
@ -56,9 +57,14 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
|||
|
||||
@Override
|
||||
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"));
|
||||
compensationTab.setText(Res.get("dao.tab.compensation"));
|
||||
votingTab.setText(Res.get("dao.tab.voting"));
|
||||
|
||||
navigationListener = viewPath -> {
|
||||
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.AwesomeIcon;
|
||||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.core.btc.wallet.BsqBalanceListener;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
|
@ -122,7 +123,10 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
|||
|
||||
chainSyncIndicator = new ProgressBar();
|
||||
chainSyncIndicator.setPrefWidth(120);
|
||||
chainSyncIndicator.setProgress(-1);
|
||||
if (DevEnv.DAO_ACTIVATED)
|
||||
chainSyncIndicator.setProgress(-1);
|
||||
else
|
||||
chainSyncIndicator.setProgress(0);
|
||||
chainSyncIndicator.setPadding(new Insets(-6, 0, -10, 5));
|
||||
|
||||
chainHeightLabel = FormBuilder.addLabel(root, ++gridRow, "");
|
||||
|
|
Loading…
Add table
Reference in a new issue