mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
handle mode and startup config better
This commit is contained in:
parent
94da3b37b6
commit
7ae74e3000
4 changed files with 6 additions and 2 deletions
|
@ -230,6 +230,9 @@ public class AppController implements Initializable {
|
|||
onlineProperty().addListener((observable, oldValue, newValue) -> {
|
||||
Platform.runLater(() -> setServerToggleTooltip(getCurrentBlockHeight()));
|
||||
});
|
||||
serverToggle.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
|
||||
Config.get().setMode(serverToggle.isSelected() ? Mode.ONLINE : Mode.OFFLINE);
|
||||
});
|
||||
|
||||
openTransactionIdItem.disableProperty().bind(onlineProperty().not());
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ public class AppServices {
|
|||
private final ChangeListener<Boolean> onlineServicesListener = new ChangeListener<>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean online) {
|
||||
Config.get().setMode(online ? Mode.ONLINE : Mode.OFFLINE);
|
||||
if(online) {
|
||||
restartService(connectionService);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
if(Config.get().getServerType() == null) {
|
||||
if(Config.get().getServerType() == null && Config.get().getCoreServer() == null && Config.get().getElectrumServer() != null) {
|
||||
Config.get().setServerType(ServerType.ELECTRUM_SERVER);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.google.common.net.HostAndPort;
|
|||
import com.sparrowwallet.drongo.Network;
|
||||
import com.sparrowwallet.sparrow.AppServices;
|
||||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import com.sparrowwallet.sparrow.Mode;
|
||||
import com.sparrowwallet.sparrow.control.TextFieldValidator;
|
||||
import com.sparrowwallet.sparrow.control.UnlabeledToggleSwitch;
|
||||
import com.sparrowwallet.sparrow.event.*;
|
||||
|
@ -371,6 +372,7 @@ public class ServerPreferencesController extends PreferencesDetailController {
|
|||
ConnectionEvent connectionEvent = (ConnectionEvent)connectionService.getValue();
|
||||
showConnectionSuccess(connectionEvent.getServerVersion(), connectionEvent.getServerBanner());
|
||||
getMasterController().reconnectOnClosingProperty().set(true);
|
||||
Config.get().setMode(Mode.ONLINE);
|
||||
connectionService.cancel();
|
||||
});
|
||||
connectionService.setOnFailed(workerStateEvent -> {
|
||||
|
|
Loading…
Reference in a new issue