Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Feb 21, 2023
1 parent 0a23e95 commit 84a1291
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/io/xpipe/app/prefs/AppPrefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ private static ObservableBooleanValue bindDeveloperFalse(ObservableBooleanValue

// External editor
// ===============

final ObjectProperty<ExternalEditorType> externalEditor =
typed(new SimpleObjectProperty<>(), ExternalEditorType.class);
private final SingleSelectionField<ExternalEditorType> externalEditorControl = Field.ofSingleSelectionType(
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void launch(Path file) throws Exception {
@Override
public void launch(Path file) throws Exception {
var customCommand = AppPrefs.get().customEditorCommand().getValue();
if (customCommand == null || customCommand.trim().isEmpty()) {
return;
if (customCommand == null || customCommand.isBlank()) {
throw new IllegalStateException("No custom editor command specified");
}

var format = customCommand.contains("$file") ? customCommand : customCommand + " $file";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ public CustomType() {
public void launch(String name, String command) throws Exception {
var custom = AppPrefs.get().customTerminalCommand().getValue();
if (custom == null || custom.isBlank()) {
ErrorEvent.fromMessage("No custom terminal command specified").reportable(false).handle();
return;
throw new IllegalStateException("No custom terminal command specified");
}

var format = custom.contains("$cmd") ? custom : custom + " $cmd";
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/io/xpipe/app/update/AppUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public void executeUpdateAndClose() {

var performedUpdate = new PerformedUpdate(
downloadedUpdate.getValue().getVersion(),
downloadedUpdate.getValue().getBody());
downloadedUpdate.getValue().getBody(),
downloadedUpdate.getValue().getVersion());
AppCache.update("performedUpdate", performedUpdate);
}
});
Expand Down Expand Up @@ -290,6 +291,7 @@ public synchronized AvailableRelease checkForUpdate(boolean forceCheck) {
public static class PerformedUpdate {
String name;
String rawDescription;
String newVersion;
}

@Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.AppWindowHelper;
import io.xpipe.app.issue.ErrorEvent;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
Expand All @@ -12,6 +14,12 @@ public class UpdateChangelogAlert {

public static void showIfNeeded() {
var update = AppUpdater.get().getPerformedUpdate();

if (update != null && !update.getNewVersion().equals(AppProperties.get().getVersion())) {
ErrorEvent.fromMessage("Update did not succeed").handle();
return;
}

if (update == null || update.getRawDescription() == null) {
return;
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/io/xpipe/app/util/TerminalHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public static void open(String title, String command) throws Exception {
}

var type = AppPrefs.get().terminalType().getValue();
if (type == null) {
throw new IllegalStateException("No terminal has been configured to be used");
}

type.launch(title, command);
}
}

0 comments on commit 84a1291

Please sign in to comment.