mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-23 08:30:38 +12:00
Refactor checks
This commit is contained in:
parent
f84c06dd8c
commit
3b6ad291a8
|
@ -1,4 +1,4 @@
|
|||
package io.xpipe.app.core;
|
||||
package io.xpipe.app.core.check;
|
||||
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.text.Font;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AppBundledFonts {
|
||||
public class AppBundledFontCheck {
|
||||
|
||||
public static void init() {
|
||||
if (OsType.getLocal() != OsType.LINUX) {
|
|
@ -1,9 +1,10 @@
|
|||
package io.xpipe.app.core;
|
||||
package io.xpipe.app.core.check;
|
||||
|
||||
import io.xpipe.app.core.AppLogs;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.util.ModuleHelper;
|
||||
|
||||
public class AppDebugModeNotice {
|
||||
public class AppDebugModeCheck {
|
||||
|
||||
public static void printIfNeeded() {
|
||||
if (!ModuleHelper.isImage() || !AppLogs.get().getLogLevel().equals("trace")) {
|
28
app/src/main/java/io/xpipe/app/core/check/AppPtbCheck.java
Normal file
28
app/src/main/java/io/xpipe/app/core/check/AppPtbCheck.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package io.xpipe.app.core.check;
|
||||
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.core.AppWindowHelper;
|
||||
import javafx.scene.control.Alert;
|
||||
|
||||
public class AppPtbCheck {
|
||||
|
||||
public static void check() {
|
||||
if (!AppProperties.get().isStaging()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AppWindowHelper.showBlockingAlert(
|
||||
alert -> {
|
||||
alert.setAlertType(Alert.AlertType.INFORMATION);
|
||||
alert.setHeaderText("Notice for the public test build");
|
||||
alert.getDialogPane()
|
||||
.setContent(
|
||||
AppWindowHelper.alertContentText(
|
||||
"You are running a PTB build of XPipe." +
|
||||
" This version is unstable and might contain bugs." +
|
||||
" You should not use it as a daily driver." +
|
||||
" It will also not receive regular updates." +
|
||||
" You will have to install and launch the normal XPipe release for that."));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ public class AppTempCheck {
|
|||
ErrorEvent.fromThrowable(new IOException("Specified temporary directory " + tmpdir
|
||||
+ ", set via the environment variable %TEMP% is invalid."))
|
||||
.term()
|
||||
.expected()
|
||||
.handle();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.core.mode;
|
|||
import io.xpipe.app.core.App;
|
||||
import io.xpipe.app.core.AppGreetings;
|
||||
import io.xpipe.app.core.AppMainWindow;
|
||||
import io.xpipe.app.core.check.AppPtbCheck;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
|
@ -31,6 +32,7 @@ public class GuiMode extends PlatformMode {
|
|||
super.onSwitchTo();
|
||||
|
||||
AppGreetings.showIfNeeded();
|
||||
AppPtbCheck.check();
|
||||
|
||||
TrackEvent.info("Waiting for window setup completion ...");
|
||||
PlatformThread.runLaterIfNeededBlocking(() -> {
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.xpipe.app.core.mode;
|
|||
|
||||
import io.xpipe.app.Main;
|
||||
import io.xpipe.app.core.*;
|
||||
import io.xpipe.app.core.check.AppDebugModeCheck;
|
||||
import io.xpipe.app.core.check.AppTempCheck;
|
||||
import io.xpipe.app.core.check.AppUserDirectoryCheck;
|
||||
import io.xpipe.app.ext.DataStoreProviders;
|
||||
|
@ -111,7 +112,7 @@ public abstract class OperationMode {
|
|||
AppUserDirectoryCheck.check();
|
||||
AppTempCheck.check();
|
||||
AppLogs.init();
|
||||
AppDebugModeNotice.printIfNeeded();
|
||||
AppDebugModeCheck.printIfNeeded();
|
||||
AppProperties.logArguments(args);
|
||||
AppProperties.logSystemProperties();
|
||||
AppProperties.logPassedProperties();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.xpipe.app.util;
|
||||
|
||||
import io.xpipe.app.core.AppBundledFonts;
|
||||
import io.xpipe.app.core.check.AppBundledFontCheck;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
|
@ -81,7 +81,7 @@ public enum PlatformState {
|
|||
}
|
||||
|
||||
// Check if we have no fonts and set properties to load bundled ones
|
||||
AppBundledFonts.init();
|
||||
AppBundledFontCheck.init();
|
||||
|
||||
if (AppPrefs.get() != null) {
|
||||
var s = AppPrefs.get().uiScale().getValue();
|
||||
|
|
Loading…
Reference in a new issue