Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back force relay option #3281

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ List<String> buildCommand(Path workDirectory, int adapterPort, int gpgPort, int

cmd.addAll(standardIceOptions);

if (forgedAlliancePrefs.isForceRelay()) {
cmd.add("--force-relay");
log.info("Forcing ice adapter relay connection");
}

if (forgedAlliancePrefs.isShowIceAdapterDebugWindow()) {
cmd.add("--debug-window");
cmd.add("--info-window");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ForgedAlliancePrefs {
private final ObjectProperty<Path> preferencesFile = new SimpleObjectProperty<>();
private final ObjectProperty<Path> vaultBaseDirectory = new SimpleObjectProperty<>();
private final BooleanProperty warnNonAsciiVaultPath = new SimpleBooleanProperty(true);
private final BooleanProperty forceRelay = new SimpleBooleanProperty(false);
private final BooleanProperty autoDownloadMaps = new SimpleBooleanProperty(true);
private final BooleanProperty allowIpv6 = new SimpleBooleanProperty(false);

Expand Down Expand Up @@ -51,6 +52,18 @@ public ObjectProperty<Path> preferencesFileProperty() {
return preferencesFile;
}

public boolean isForceRelay() {
return forceRelay.get();
}

public void setForceRelay(boolean forceRelay) {
this.forceRelay.set(forceRelay);
}

public BooleanProperty forceRelayProperty() {
return forceRelay;
}

public boolean isAutoDownloadMaps() {
return autoDownloadMaps.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public class SettingsController extends NodeController<Node> {
public Toggle randomColorsToggle;
public Toggle defaultColorsToggle;
public CheckBox hideFoeToggle;
public CheckBox forceRelayToggle;
public TextField dataLocationTextField;
public TextField gameLocationTextField;
public TextField vaultLocationTextField;
Expand Down Expand Up @@ -308,6 +309,7 @@ private void bindGeneralPreferences() {

private void bindGamePreferences() {
ForgedAlliancePrefs forgedAlliancePrefs = preferences.getForgedAlliance();
forceRelayToggle.selectedProperty().bindBidirectional(forgedAlliancePrefs.forceRelayProperty());
gameLocationTextField.textProperty()
.bindBidirectional(forgedAlliancePrefs.installationPathProperty(), PATH_STRING_CONVERTER);
autoDownloadMapsToggle.selectedProperty().bindBidirectional(forgedAlliancePrefs.autoDownloadMapsProperty());
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/theme/settings/settings.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,27 @@
</ListView>
</children>
</GridPane>
<GridPane styleClass="setting-container">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0"/>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES"
minWidth="10.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label contentDisplay="RIGHT" maxWidth="1.7976931348623157E308"
styleClass="setting-title" text="%settings.fa.forceRelay"/>
<Label styleClass="setting-description"
text="%settings.fa.forceRelay.description"
GridPane.columnSpan="2147483647" GridPane.hgrow="ALWAYS"
GridPane.rowIndex="1"/>
<CheckBox fx:id="forceRelayToggle" contentDisplay="GRAPHIC_ONLY"
mnemonicParsing="false" GridPane.columnIndex="1"/>
</children>
</GridPane>
</children>
</VBox>
</content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void testBuildCommand() throws Exception {
PlayerInfo currentPlayer = PlayerInfoBuilder.create().defaultValues().get();
when(playerService.getCurrentPlayer()).thenReturn(currentPlayer);
when(tokenRetriever.getRefreshedTokenValue()).thenReturn(Mono.just("someToken"));
forgedAlliancePrefs.setForceRelay(true);
forgedAlliancePrefs.setShowIceAdapterDebugWindow(true);

List<String> command = instance.buildCommand(Path.of("."), 0, 0, 4711);
Expand All @@ -142,8 +143,9 @@ public void testBuildCommand() throws Exception {
assertEquals("someToken", command.get(16));
assertEquals("--icebreaker-base-url", command.get(17));
assertEquals("http://faf-api/ice", command.get(18));
assertEquals("--debug-window", command.get(19));
assertEquals("--info-window", command.get(20));
assertEquals("--force-relay", command.get(19));
assertEquals("--debug-window", command.get(20));
assertEquals("--info-window", command.get(21));
}

@Test
Expand Down