diff --git a/main/installer-osx-mas/package/macosx/Cryptomator-Volume.icns b/main/installer-osx-mas/package/macosx/Cryptomator-Volume.icns new file mode 100644 index 000000000..eb66f52bf Binary files /dev/null and b/main/installer-osx-mas/package/macosx/Cryptomator-Volume.icns differ diff --git a/main/installer-osx-mas/package/macosx/Cryptomator-background.png b/main/installer-osx-mas/package/macosx/Cryptomator-background.png new file mode 100644 index 000000000..e05f1e8cf Binary files /dev/null and b/main/installer-osx-mas/package/macosx/Cryptomator-background.png differ diff --git a/main/installer-osx-mas/package/macosx/Cryptomator.icns b/main/installer-osx-mas/package/macosx/Cryptomator.icns new file mode 100644 index 000000000..eb66f52bf Binary files /dev/null and b/main/installer-osx-mas/package/macosx/Cryptomator.icns differ diff --git a/main/installer-osx-mas/package/macosx/Info.plist b/main/installer-osx-mas/package/macosx/Info.plist new file mode 100644 index 000000000..6338c79a9 --- /dev/null +++ b/main/installer-osx-mas/package/macosx/Info.plist @@ -0,0 +1,102 @@ + + + + + LSMinimumSystemVersion + 10.7.4 + CFBundleDevelopmentRegion + English + CFBundleAllowMixedLocalizations + + CFBundleExecutable + DEPLOY_LAUNCHER_NAME + CFBundleIconFile + DEPLOY_ICON_FILE + CFBundleIdentifier + DEPLOY_BUNDLE_IDENTIFIER + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + DEPLOY_BUNDLE_NAME + CFBundlePackageType + APPL + CFBundleShortVersionString + DEPLOY_BUNDLE_SHORT_VERSION + CFBundleSignature + ???? + + LSApplicationCategoryType + DEPLOY_BUNDLE_CATEGORY + CFBundleVersion + 100 + NSHumanReadableCopyright + DEPLOY_BUNDLE_COPYRIGHT + JVMRuntime + DEPLOY_JAVA_RUNTIME_NAME + JVMMainClassName + DEPLOY_LAUNCHER_CLASS + JVMAppClasspath + DEPLOY_APP_CLASSPATH + JVMMainJarName + DEPLOY_MAIN_JAR_NAME + JVMPreferencesID + DEPLOY_PREFERENCES_ID + JVMOptions + +DEPLOY_JVM_OPTIONS + + JVMUserOptions + +DEPLOY_JVM_USER_OPTIONS + + NSHighResolutionCapable + true + + LSUIElement + 1 + + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + cryptomator + + CFBundleTypeIconFile + Cryptomator.icns + CFBundleTypeName + Cryptomator Vault + CFBundleTypeRole + Editor + LSItemContentTypes + + org.cryptomator.folder + + LSTypeIsPackage + + + + UTExportedTypeDeclarations + + + UTTypeConformsTo + + com.apple.package + + UTTypeDescription + Cryptomator Vault + UTTypeIconFile + Cryptomator.icns + UTTypeIdentifier + org.cryptomator.folder + UTTypeTagSpecification + + public.filename-extension + + cryptomator + + + + + + diff --git a/main/installer-osx-mas/pom.xml b/main/installer-osx-mas/pom.xml new file mode 100644 index 000000000..3a2fe177c --- /dev/null +++ b/main/installer-osx-mas/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + + org.cryptomator + main + 0.11.0-SNAPSHOT + + installer-osx-mas + pom + Cryptomator Mac OS X installer for Mac App Store + + + Cryptomator + org.cryptomator.ui.Cryptomator + ${java.home}/../lib/ant-javafx.jar + + + + + org.cryptomator + ui + + + + + + + maven-dependency-plugin + + + copy-libs + prepare-package + + + + + maven-antrun-plugin + 1.7 + + + create-deployment-bundle + install + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main/pom.xml b/main/pom.xml index d8158045d..83fd0408d 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -204,6 +204,12 @@ installer-osx + + osx-mas + + installer-osx-mas + + win diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/WelcomeController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/WelcomeController.java index 48f5c2e4a..61b1d5bba 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/WelcomeController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/WelcomeController.java @@ -38,6 +38,7 @@ import javafx.application.Platform; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.fxml.FXML; +import javafx.scene.Node; import javafx.scene.control.CheckBox; import javafx.scene.control.Hyperlink; import javafx.scene.control.Label; @@ -53,6 +54,9 @@ public class WelcomeController extends AbstractFXMLViewController { @FXML private ImageView botImageView; + @FXML + private Node checkForUpdatesContainer; + @FXML private CheckBox checkForUpdatesCheckbox; @@ -93,8 +97,15 @@ public class WelcomeController extends AbstractFXMLViewController { botImageView.setImage(new Image(getClass().getResource("/bot_welcome.png").toString())); checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled()); checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged); - if (settings.isCheckForUpdatesEnabled()) { - executor.execute(this::checkForUpdates); + if (areUpdatesManagedExternally()) { + checkForUpdatesContainer.setVisible(false); + checkForUpdatesContainer.setManaged(false); + } else { + checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled()); + checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged); + if (settings.isCheckForUpdatesEnabled()) { + executor.execute(this::checkForUpdates); + } } } @@ -110,7 +121,14 @@ public class WelcomeController extends AbstractFXMLViewController { } } + private boolean areUpdatesManagedExternally() { + return Boolean.parseBoolean(System.getProperty("cryptomator.updatesManagedExternally", "false")); + } + private void checkForUpdates() { + if (areUpdatesManagedExternally()) { + return; + } Platform.runLater(() -> { checkForUpdatesCheckbox.setVisible(false); checkForUpdatesStatus.setText(resourceBundle.getString("welcome.checkForUpdates.label.currentlyChecking")); diff --git a/main/ui/src/main/java/org/cryptomator/ui/util/TrayIconUtil.java b/main/ui/src/main/java/org/cryptomator/ui/util/TrayIconUtil.java index a33513136..9bdf7e85d 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/util/TrayIconUtil.java +++ b/main/ui/src/main/java/org/cryptomator/ui/util/TrayIconUtil.java @@ -11,9 +11,7 @@ import java.awt.TrayIcon.MessageType; import java.awt.event.ActionEvent; import java.io.IOException; import java.util.ResourceBundle; - -import javafx.application.Platform; -import javafx.stage.Stage; +import java.util.concurrent.TimeUnit; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; @@ -21,10 +19,16 @@ import javax.script.ScriptException; import javax.swing.SwingUtilities; import org.apache.commons.lang3.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javafx.application.Platform; +import javafx.stage.Stage; public final class TrayIconUtil { private static TrayIconUtil INSTANCE; + private static final Logger LOG = LoggerFactory.getLogger(TrayIconUtil.class); private final Stage mainApplicationWindow; private final ResourceBundle rb; @@ -79,10 +83,32 @@ public final class TrayIconUtil { exitItem.addActionListener(this::quitFromTray); popup.add(exitItem); - final Image image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png")); + final Image image; + if (SystemUtils.IS_OS_MAC_OSX && isMacMenuBarDarkMode()) { + image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon_white.png")); + } else { + image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png")); + } + return new TrayIcon(image, rb.getString("app.name"), popup); } + /** + * @return true if defaults read -g AppleInterfaceStyle has an exit status of 0 (i.e. _not_ returning "key not found"). + */ + private boolean isMacMenuBarDarkMode() { + try { + // check for exit status only. Once there are more modes than "dark" and "default", we might need to analyze string contents.. + final Process proc = Runtime.getRuntime().exec(new String[] {"defaults", "read", "-g", "AppleInterfaceStyle"}); + proc.waitFor(100, TimeUnit.MILLISECONDS); + return proc.exitValue() == 0; + } catch (IOException | InterruptedException | IllegalThreadStateException ex) { + // IllegalThreadStateException thrown by proc.exitValue(), if process didn't terminate + LOG.warn("Determining MAC OS X dark mode settings failed. Assuming default (light) mode."); + return false; + } + } + private void showTrayNotification(TrayIcon trayIcon) { final Runnable notificationCmd; if (SystemUtils.IS_OS_MAC_OSX) { diff --git a/main/ui/src/main/resources/fxml/welcome.fxml b/main/ui/src/main/resources/fxml/welcome.fxml index 9e877a529..5d4a9592a 100644 --- a/main/ui/src/main/resources/fxml/welcome.fxml +++ b/main/ui/src/main/resources/fxml/welcome.fxml @@ -27,15 +27,16 @@ - diff --git a/main/ui/src/main/resources/tray_icon_white.png b/main/ui/src/main/resources/tray_icon_white.png new file mode 100644 index 000000000..434f5e5aa Binary files /dev/null and b/main/ui/src/main/resources/tray_icon_white.png differ