mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add interface enum
This commit is contained in:
parent
c4c581525a
commit
0fa6bd56e2
3 changed files with 26 additions and 2 deletions
|
@ -210,7 +210,7 @@ public class AppServices {
|
||||||
restartService(ratesService);
|
restartService(ratesService);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.isCheckNewVersions() && Network.get() == Network.MAINNET) {
|
if(config.isCheckNewVersions() && Network.get() == Network.MAINNET && Interface.get() == Interface.DESKTOP) {
|
||||||
restartService(versionCheckService);
|
restartService(versionCheckService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,7 +1104,7 @@ public class AppServices {
|
||||||
Wallet wallet = walletTabData.getWallet();
|
Wallet wallet = walletTabData.getWallet();
|
||||||
Storage storage = walletTabData.getStorage();
|
Storage storage = walletTabData.getStorage();
|
||||||
|
|
||||||
if(!storage.getWalletFile().exists() || wallet.containsSource(KeystoreSource.HW_USB)) {
|
if(Interface.get() == Interface.DESKTOP && (!storage.getWalletFile().exists() || wallet.containsSource(KeystoreSource.HW_USB))) {
|
||||||
usbWallet = true;
|
usbWallet = true;
|
||||||
|
|
||||||
if(deviceEnumerateService == null) {
|
if(deviceEnumerateService == null) {
|
||||||
|
|
23
src/main/java/com/sparrowwallet/sparrow/Interface.java
Normal file
23
src/main/java/com/sparrowwallet/sparrow/Interface.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package com.sparrowwallet.sparrow;
|
||||||
|
|
||||||
|
public enum Interface {
|
||||||
|
DESKTOP, TERMINAL, SERVER;
|
||||||
|
|
||||||
|
private static Interface currentInterface;
|
||||||
|
|
||||||
|
public static Interface get() {
|
||||||
|
if(currentInterface == null) {
|
||||||
|
currentInterface = DESKTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(Interface interf) {
|
||||||
|
if(currentInterface != null && interf != currentInterface) {
|
||||||
|
throw new IllegalStateException("Interface already set to " + currentInterface);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentInterface = interf;
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,6 +87,7 @@ public class SparrowWallet {
|
||||||
SLF4JBridgeHandler.install();
|
SLF4JBridgeHandler.install();
|
||||||
|
|
||||||
if(args.terminal || java.awt.GraphicsEnvironment.isHeadless()) {
|
if(args.terminal || java.awt.GraphicsEnvironment.isHeadless()) {
|
||||||
|
Interface.set(Interface.TERMINAL);
|
||||||
PlatformImpl.setTaskbarApplication(false);
|
PlatformImpl.setTaskbarApplication(false);
|
||||||
Drongo.removeRootLogAppender("STDOUT");
|
Drongo.removeRootLogAppender("STDOUT");
|
||||||
com.sun.javafx.application.LauncherImpl.launchApplication(SparrowTerminal.class, SparrowWalletPreloader.class, argv);
|
com.sun.javafx.application.LauncherImpl.launchApplication(SparrowTerminal.class, SparrowWalletPreloader.class, argv);
|
||||||
|
|
Loading…
Reference in a new issue