Updater fixes [release]

This commit is contained in:
crschnick 2023-04-04 18:58:28 +00:00
parent 819ad3e839
commit d836bfcce6
4 changed files with 31 additions and 6 deletions

View file

@ -5,9 +5,11 @@ import io.xpipe.app.comp.AppLayoutComp;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.update.AppUpdater;
import io.xpipe.core.process.OsType;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
@ -69,11 +71,27 @@ public class App extends Application {
// AppActionLinkDetector.detectOnFocus();
});
});
var title =
String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion());
var titleBinding = Bindings.createStringBinding(
() -> {
var base = String.format(
"X-Pipe Desktop (%s)", AppProperties.get().getVersion());
var suffix = AppUpdater.get().getLastUpdateCheckResult().getValue() != null
? String.format(
" (Update to %s available)",
AppUpdater.get()
.getLastUpdateCheckResult()
.getValue()
.getVersion())
: "";
return base + suffix;
},
AppUpdater.get().getLastUpdateCheckResult());
var appWindow = new AppMainWindow(stage);
appWindow.getStage().titleProperty().bind(PlatformThread.sync(titleBinding));
appWindow.initialize();
appWindow.setContent(title, content);
appWindow.setContent(content);
TrackEvent.info("Application window initialized");
stage.setOnShown(event -> {
focus();

View file

@ -16,6 +16,7 @@ import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Screen;
import javafx.stage.Stage;
import lombok.Getter;
import java.time.Duration;
import java.time.Instant;
@ -24,6 +25,8 @@ import java.time.temporal.ChronoUnit;
public class AppMainWindow {
private static AppMainWindow INSTANCE;
@Getter
private final Stage stage;
private final BooleanProperty windowActive = new SimpleBooleanProperty(false);
private Thread thread;
@ -240,8 +243,7 @@ public class AppMainWindow {
TrackEvent.debug("Set content reload listener");
}
public void setContent(String title, Comp<?> content) {
stage.setTitle(title);
public void setContent(Comp<?> content) {
setupContent(content);
AppWindowHelper.setupStylesheets(stage.getScene());
}

View file

@ -78,6 +78,10 @@ public class AppUpdater {
AppCache.update("downloadedUpdate", n);
});
lastUpdateCheckResult.addListener((c, o, n) -> {
if (n != null && downloadedUpdate.getValue() != null && n.getVersion().equals(downloadedUpdate.getValue().getVersion())) {
return;
}
downloadedUpdate.setValue(null);
});

View file

@ -1,6 +1,7 @@
- Add file type icons to file browser
- Add shift-select ability to select range of files to file browser
- Fix various file browser bugs
- Improve memory footprint
- Properly update last used time for connections
- Show changelog when prompting for an update installation
- Improve icon semantics in connection overview
-