mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 18:21:26 +00:00
Added posibility to add build number to "about" dialog
This commit is contained in:
@@ -39,6 +39,7 @@ public class Environment {
|
||||
LOG.debug("cryptomator.logDir: {}", System.getProperty("cryptomator.logDir"));
|
||||
LOG.debug("cryptomator.mountPointsDir: {}", System.getProperty("cryptomator.mountPointsDir"));
|
||||
LOG.debug("cryptomator.minPwLength: {}", System.getProperty("cryptomator.minPwLength"));
|
||||
LOG.debug("cryptomator.buildNumber: {}", System.getProperty("cryptomator.buildNumber"));
|
||||
}
|
||||
|
||||
public boolean useCustomLogbackConfig() {
|
||||
@@ -65,6 +66,10 @@ public class Environment {
|
||||
return getPath("cryptomator.mountPointsDir").map(this::replaceHomeDir);
|
||||
}
|
||||
|
||||
public Optional<String> getBuildNumber() {
|
||||
return Optional.ofNullable(System.getProperty("cryptomator.buildNumber"));
|
||||
}
|
||||
|
||||
public int getMinPwLength() {
|
||||
return getInt("cryptomator.minPwLength", DEFAULT_MIN_PW_LENGTH);
|
||||
}
|
||||
@@ -82,8 +87,8 @@ public class Environment {
|
||||
String value = System.getProperty(propertyName);
|
||||
return Optional.ofNullable(value).map(Paths::get);
|
||||
}
|
||||
|
||||
// visible for testing
|
||||
|
||||
Stream<Path> getPaths(String propertyName) {
|
||||
Stream<String> rawSettingsPaths = getRawList(propertyName, PATH_LIST_SEP);
|
||||
return rawSettingsPaths.filter(Predicate.not(Strings::isNullOrEmpty)).map(Paths::get).map(this::replaceHomeDir);
|
||||
@@ -107,5 +112,4 @@ public class Environment {
|
||||
return StreamSupport.stream(spliter, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.cryptomator.ui.preferences;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
import org.cryptomator.common.Environment;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.fxapp.UpdateChecker;
|
||||
import org.slf4j.Logger;
|
||||
@@ -13,18 +14,20 @@ import java.io.InputStreamReader;
|
||||
|
||||
@PreferencesScoped
|
||||
public class AboutController implements FxController {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AboutController.class);
|
||||
|
||||
|
||||
private final String thirdPartyLicenseText;
|
||||
private final String applicationVersion;
|
||||
|
||||
@Inject
|
||||
AboutController(UpdateChecker updateChecker) {
|
||||
AboutController(UpdateChecker updateChecker, Environment environment) {
|
||||
this.thirdPartyLicenseText = loadThirdPartyLicenseFile();
|
||||
this.applicationVersion = updateChecker.currentVersionProperty().get();
|
||||
StringBuilder sb = new StringBuilder(updateChecker.currentVersionProperty().get());
|
||||
environment.getBuildNumber().ifPresent(s -> sb.append(" (").append(s).append(')'));
|
||||
this.applicationVersion = sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String loadThirdPartyLicenseFile() {
|
||||
try (InputStream in = AboutController.class.getResourceAsStream("/license/THIRD-PARTY.txt")) {
|
||||
return CharStreams.toString(new InputStreamReader(in));
|
||||
@@ -33,7 +36,7 @@ public class AboutController implements FxController {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Getter */
|
||||
|
||||
public String getThirdPartyLicenseText() {
|
||||
|
||||
Reference in New Issue
Block a user