Skip to content

Commit

Permalink
Removing all changes to make GUI work with the API
Browse files Browse the repository at this point in the history
The other changes in GUI, namely small refactoring to have the GUI
and the API use the same methods to calculate things have been
left in place.
  • Loading branch information
mrosseel committed Oct 12, 2017
1 parent 6f030a4 commit 68048bc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 30 deletions.
1 change: 0 additions & 1 deletion core/src/main/java/io/bisq/core/app/AppOptionKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ public class AppOptionKeys {
public static final String MAX_MEMORY = "maxMemory";
public static final String DUMP_STATISTICS = "dumpStatistics";
public static final String IGNORE_DEV_MSG_KEY = "ignoreDevMsg";
public static final String ENABLE_API = "enableAPI";
}
6 changes: 1 addition & 5 deletions core/src/main/java/io/bisq/core/app/BisqEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private static String appDataDir(String userDataDir, String appName) {

private final String btcNodes, seedNodes, ignoreDevMsg, useTorForBtc, rpcUser, rpcPassword,
rpcPort, rpcBlockNotificationPort, dumpBlockchainData, fullDaoNode,
myAddress, banList, dumpStatistics, enableApi, maxMemory, socks5ProxyBtcAddress,
myAddress, banList, dumpStatistics, maxMemory, socks5ProxyBtcAddress,
socks5ProxyHttpAddress;


Expand Down Expand Up @@ -200,9 +200,6 @@ public BisqEnvironment(PropertySource commandLineProperties) {
dumpStatistics = commandLineProperties.containsProperty(AppOptionKeys.DUMP_STATISTICS) ?
(String) commandLineProperties.getProperty(AppOptionKeys.DUMP_STATISTICS) :
"";
enableApi = commandLineProperties.containsProperty(AppOptionKeys.ENABLE_API) ?
(String) commandLineProperties.getProperty(AppOptionKeys.ENABLE_API) :
"";
maxMemory = commandLineProperties.containsProperty(AppOptionKeys.MAX_MEMORY) ?
(String) commandLineProperties.getProperty(AppOptionKeys.MAX_MEMORY) :
"";
Expand Down Expand Up @@ -347,7 +344,6 @@ private PropertySource<?> defaultProperties() {
setProperty(AppOptionKeys.APP_DATA_DIR_KEY, appDataDir);
setProperty(AppOptionKeys.IGNORE_DEV_MSG_KEY, ignoreDevMsg);
setProperty(AppOptionKeys.DUMP_STATISTICS, dumpStatistics);
setProperty(AppOptionKeys.ENABLE_API, enableApi);
setProperty(AppOptionKeys.APP_NAME_KEY, appName);
setProperty(AppOptionKeys.MAX_MEMORY, maxMemory);
setProperty(AppOptionKeys.USER_DATA_DIR_KEY, userDataDir);
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/io/bisq/core/app/BisqExecutable.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ protected void customizeOptionParsing(OptionParser parser) {
description("If set to true the trade statistics are stored as json file in the data dir.", false))
.withRequiredArg()
.ofType(boolean.class);
parser.accepts(AppOptionKeys.ENABLE_API,
description("If set to true the trading api is enabled.", false))
.withRequiredArg()
.ofType(boolean.class);
parser.accepts(AppOptionKeys.PROVIDERS,
description("Custom providers (comma separated)", false))
.withRequiredArg();
Expand Down
12 changes: 1 addition & 11 deletions gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.bisq</groupId>
<artifactId>api</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
Expand All @@ -371,10 +365,6 @@
<artifactId>jcsv</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>io.bisq</groupId>
<artifactId>api</artifactId>
<version>${project.parent.version}</version>
</dependency>

</dependencies>
</project>
3 changes: 0 additions & 3 deletions gui/src/main/java/io/bisq/gui/GuiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

import java.util.ResourceBundle;

import static com.google.inject.name.Names.named;

public class GuiModule extends AppModule {

private final Stage primaryStage;
Expand Down Expand Up @@ -75,6 +73,5 @@ protected void configure() {
bind(Stage.class).toInstance(primaryStage);

bindConstant().annotatedWith(Names.named(AppOptionKeys.APP_NAME_KEY)).to(environment.getRequiredProperty(AppOptionKeys.APP_NAME_KEY));
bindConstant().annotatedWith(named(AppOptionKeys.ENABLE_API)).to(environment.getRequiredProperty(AppOptionKeys.ENABLE_API));
}
}
15 changes: 9 additions & 6 deletions gui/src/main/java/io/bisq/gui/app/BisqApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import ch.qos.logback.classic.Logger;
import com.google.inject.Guice;
import com.google.inject.Injector;
import io.bisq.api.service.DropwizardApplication;
import io.bisq.common.CommonOptionKeys;
import io.bisq.common.UserThread;
import io.bisq.common.app.DevEnv;
Expand Down Expand Up @@ -163,7 +162,7 @@ public void start(Stage stage) throws IOException {
Security.addProvider(new BouncyCastleProvider());

final BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
String currencyCode = baseCurrencyNetwork.getCurrencyCode();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
CurrencyUtil.setBaseCurrencyCode(currencyCode);
Expand All @@ -173,10 +172,14 @@ public void start(Stage stage) throws IOException {
bisqAppModule = new BisqAppModule(bisqEnvironment, primaryStage);
injector = Guice.createInjector(bisqAppModule);
injector.getInstance(InjectorViewFactory.class).setInjector(injector);

if(Boolean.valueOf(bisqEnvironment.getRequiredProperty(AppOptionKeys.ENABLE_API))) {
injector.getInstance(DropwizardApplication.class).run("server", "bisq-api.yml");
}
/*
PrintWriter out = new PrintWriter(new File("grapher.dot"), "UTF-8");
Injector injector = Guice.createInjector(new GraphvizModule());
GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
grapher.setOut(out);
grapher.setRankdir("TB");
grapher.graph(injector);
*/

// All classes which are persisting objects need to be added here
// Maintain order!
Expand Down
1 change: 1 addition & 0 deletions gui/src/main/java/io/bisq/gui/app/BisqAppModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ protected void configure() {

bind(NetworkProtoResolver.class).to(CoreNetworkProtoResolver.class).in(Singleton.class);
bind(PersistenceProtoResolver.class).to(CorePersistenceProtoResolver.class).in(Singleton.class);
bind(Preferences.class).in(Singleton.class);

// ordering is used for shut down sequence
install(tradeModule());
Expand Down

0 comments on commit 68048bc

Please sign in to comment.