diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java b/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java index ad98f41a0..f3f646e7e 100644 --- a/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java +++ b/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java @@ -68,7 +68,7 @@ public class ErrorDetailsComp extends SimpleComp { // AppI18n.observable("events"), "mdi2c-clipboard-list-outline", createTrackEventHistory())); // } - var tb = new TabPaneComp(new SimpleObjectProperty<>(items.get(0)), items); + var tb = new TabPaneComp(new SimpleObjectProperty<>(items.size() > 0 ? items.get(0) : null), items); tb.apply(r -> AppFont.small(r.get())); return tb.createRegion(); } diff --git a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java index 67554c699..f5572c791 100644 --- a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java @@ -23,7 +23,7 @@ public class SentryErrorHandler { options.setEnableUncaughtExceptionHandler(false); options.setAttachServerName(false); // options.setDebug(true); - options.setDist(XPipeDistributionType.get().getName()); + options.setDist(XPipeDistributionType.get().getId()); options.setRelease(AppProperties.get().getVersion()); options.setEnableShutdownHook(false); options.setProguardUuid(AppProperties.get().getBuildUuid().toString()); diff --git a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java index 396e74f5d..46e8748de 100644 --- a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java @@ -24,7 +24,7 @@ public class ChocoUpdater extends UpdateHandler { .space() .string("xpipe") .space() - .keyword("--version=" + getLastUpdateCheckResult().getValue().getVersion()) + .keyword("--version=" + getPreparedUpdate().getValue().getVersion()) .build(); return new CodeSnippetComp(false, new SimpleObjectProperty<>(snippet)).createRegion(); } @@ -36,6 +36,7 @@ public class ChocoUpdater extends UpdateHandler { var isUpdate = isUpdate(latest); var rel = new AvailableRelease( AppProperties.get().getVersion(), + XPipeDistributionType.get().getId(), latest, "https://community.chocolatey.org/packages/xpipe/" + latest, null, diff --git a/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java b/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java index fdfe28790..8dab29e87 100644 --- a/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java @@ -32,6 +32,7 @@ public class GitHubUpdater extends UpdateHandler { var changelog = changelogString.orElse(null); var rel = new PreparedUpdate( AppProperties.get().getVersion(), + XPipeDistributionType.get().getId(), lastUpdateCheckResult.getValue().getVersion(), lastUpdateCheckResult.getValue().getReleaseUrl(), downloadFile.get(), @@ -71,6 +72,7 @@ public class GitHubUpdater extends UpdateHandler { event("Selected asset " + ghAsset.get().getName()); lastUpdateCheckResult.setValue(new AvailableRelease( AppProperties.get().getVersion(), + XPipeDistributionType.get().getId(), rel.get().getTagName(), rel.get().getHtmlUrl().toString(), ghAsset.get().getBrowserDownloadUrl(), diff --git a/app/src/main/java/io/xpipe/app/update/PortableUpdater.java b/app/src/main/java/io/xpipe/app/update/PortableUpdater.java index d74c882fd..bc9fa131d 100644 --- a/app/src/main/java/io/xpipe/app/update/PortableUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/PortableUpdater.java @@ -43,6 +43,7 @@ public class PortableUpdater extends UpdateHandler { var isUpdate = isUpdate(rel.get().getTagName()); lastUpdateCheckResult.setValue(new AvailableRelease( AppProperties.get().getVersion(), + XPipeDistributionType.get().getId(), rel.get().getTagName(), rel.get().getHtmlUrl().toString(), null, diff --git a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java index 39681fd0d..d51e83087 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java @@ -40,7 +40,6 @@ public abstract class UpdateHandler { if (hasUpdated) { AppCache.clear("performedUpdate"); updateSucceeded = AppProperties.get().getVersion().equals(performedUpdate.getNewVersion()); - AppCache.clear("lastUpdateCheckResult"); AppCache.clear("preparedUpdate"); event("Found information about recent update"); } else { @@ -51,10 +50,13 @@ public abstract class UpdateHandler { // Check if the original version this was downloaded from is still the same if (preparedUpdate.getValue() != null - && !preparedUpdate - .getValue() - .getSourceVersion() - .equals(AppProperties.get().getVersion())) { + && (!preparedUpdate + .getValue() + .getSourceVersion() + .equals(AppProperties.get().getVersion()) + || !XPipeDistributionType.get() + .getId() + .equals(preparedUpdate.getValue().getSourceDist()))) { preparedUpdate.setValue(null); } @@ -168,6 +170,7 @@ public abstract class UpdateHandler { var rel = new PreparedUpdate( AppProperties.get().getVersion(), + XPipeDistributionType.get().getId(), lastUpdateCheckResult.getValue().getVersion(), lastUpdateCheckResult.getValue().getReleaseUrl(), null, @@ -237,6 +240,7 @@ public abstract class UpdateHandler { @With public static class AvailableRelease { String sourceVersion; + String sourceDist; String version; String releaseUrl; String downloadUrl; @@ -250,6 +254,7 @@ public abstract class UpdateHandler { @Jacksonized public static class PreparedUpdate { String sourceVersion; + String sourceDist; String version; String releaseUrl; Path file; diff --git a/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java b/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java index ab950d782..33f1a5032 100644 --- a/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java +++ b/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java @@ -4,42 +4,16 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.XPipeSession; import io.xpipe.core.impl.LocalStore; -import io.xpipe.core.util.ModuleHelper; -import io.xpipe.core.util.XPipeInstallation; import lombok.Getter; import java.util.Arrays; import java.util.function.Supplier; public enum XPipeDistributionType { - DEVELOPMENT("development", () -> new GitHubUpdater(false)) { - - @Override - public String getName() { - return "development"; - } - }, - PORTABLE("portable", () -> new PortableUpdater()) { - - @Override - public String getName() { - return "portable"; - } - }, - INSTALLATION("install", () -> new GitHubUpdater(true)) { - - @Override - public String getName() { - return "install"; - } - }, - CHOCO("choco", () -> new ChocoUpdater()) { - - @Override - public String getName() { - return "choco"; - } - }; + DEVELOPMENT("development", () -> new GitHubUpdater(false)), + PORTABLE("portable", () -> new PortableUpdater()), + INSTALLATION("install", () -> new GitHubUpdater(true)), + CHOCO("choco", () -> new ChocoUpdater()); private static XPipeDistributionType type; @@ -53,9 +27,6 @@ public enum XPipeDistributionType { return type; } - if (!ModuleHelper.isImage()) { - return (type = DEVELOPMENT); - } if (!XPipeSession.get().isNewBuildSession()) { var cached = AppCache.get("dist", String.class, () -> null); @@ -75,10 +46,6 @@ public enum XPipeDistributionType { } public static XPipeDistributionType determine() { - if (!XPipeInstallation.isInstallationDistribution()) { - return (type = PORTABLE); - } - try (var sc = LocalStore.getShell()) { try (var chocoOut = sc.command("choco search --local-only -r xpipe").start()) { var out = chocoOut.readStdoutDiscardErr(); @@ -107,6 +74,4 @@ public enum XPipeDistributionType { } return updateHandler; } - - public abstract String getName(); }