From e9feef554e64d2056a8a86159275d49eada1de78 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Fri, 9 Jun 2023 09:52:00 +0200 Subject: [PATCH 01/61] Adjust preference order in Settings Show Microsoft Office workaround next to keep vault unlocked while editing --- presentation/src/main/res/xml/preferences.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/res/xml/preferences.xml b/presentation/src/main/res/xml/preferences.xml index 3c6fe0fd4..bae69bc31 100644 --- a/presentation/src/main/res/xml/preferences.xml +++ b/presentation/src/main/res/xml/preferences.xml @@ -174,18 +174,18 @@ android:summary="@string/screen_settings_microsoft_apps_workaround_summary" android:title="@string/screen_settings_microsoft_apps_workaround_label" /> - - + + From 74db4c34532d472d34dbc72f70ce9984a9b927cb Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 16 Jun 2023 11:21:23 +0200 Subject: [PATCH 02/61] Update SECURITY.md [ci skip] --- .github/SECURITY.md | 136 +++++++------------------------------------- 1 file changed, 19 insertions(+), 117 deletions(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 1bcb1adc3..1494074d0 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -2,123 +2,25 @@ ## Reporting a Vulnerability -For reporting security-related vulnerabilities or exploits that [haven't been reported yet](https://github.com/cryptomator/android/labels/type%3Asecurity-issue), contact us at: security@cryptomator.org +We take security seriously at Cryptomator. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. -
-PGP Key +To report a security vulnerability, please use the GitHub Security Advisory feature. This feature allows you to privately discuss, fix, and publish information about security vulnerabilities. -``` ------BEGIN PGP PUBLIC KEY BLOCK----- -Comment: GPGTools - https://gpgtools.org +If you prefer to report the vulnerability via email, please send an email to security@cryptomator.org. -mQINBFbgeicBEADM9AcU6DTgM5KZnBaJc6x9DBLr+TCMHntTt7YM9GLTlO2Z43Jt -oYoyqdRWAY28veqpLEFgRvvVD3fdBj/KUOxF1cr2J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Yatruk7dZZMPtFxvxM1Q36gDIpPEOKPkvm -dMXg6jHaIdYIaoMpzXFaXsQMdRuMtzbcA+CdwXVY55qGLtfmM/QuEiIJdDeeh7iB -+VAMyEFOOpi8IFhixaeMoZAmrKDqOkzPcMJVklLYq8N+b9p5JszYNwZEbpyWCACM -6K+iJzlWzW/OPZttGLJBgYuSYIJIuG80Cx5m5m1e5RAgQ1iT8nbfrS+gYttwP48J -V7SXQg7QugxG9l1vlK4VjnXiOFulJ7V0e/VyUBpJp3qHcCxFq3RnxVwlIqKZh+jm -Q1bk0H0Xodd27nQITfDP5ullByGW2Jrjs6SsXeR3jl9+t0XQfInU1L9d/wSOkMjL -9IMUt06lV4vB/WP2xioqLZiZ4eAi0E+lWkFxjZsgNs2xbOAYRThMB8a5 -=W1Ri ------END PGP PUBLIC KEY BLOCK----- -``` -
+PGP key fingerprint: `3647 9903 B23A E0A5 9359  9A3E 23B5 DBEF 94D4 D81D` ([public key](https://gist.github.com/cryptobot/864300b6b44ae2d2a15abedfe14bd040)) + +## Expectations + +When reporting a vulnerability, please provide us with a detailed report that includes: + +- A description of the vulnerability +- Steps to reproduce the vulnerability +- Possible impact of the vulnerability +- Any additional information that may be helpful + +We ask that you do not publicly disclose the vulnerability until we have had a chance to address it. + +## Thank You + +We appreciate your help in keeping Cryptomator for Android secure. Thank you for your contributions to the security of our project. From 7f4d00fa588fa55256c17320ae0e75463acaee8f Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 16 Jun 2023 11:42:08 +0200 Subject: [PATCH 03/61] Update SECURITY.md [ci skip] --- .github/SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 1494074d0..06c81a72f 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -4,7 +4,7 @@ We take security seriously at Cryptomator. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. -To report a security vulnerability, please use the GitHub Security Advisory feature. This feature allows you to privately discuss, fix, and publish information about security vulnerabilities. +To report a security vulnerability, please use the [GitHub Security Advisory feature](https://github.com/cryptomator/android/security/advisories). This feature allows you to privately discuss, fix, and publish information about security vulnerabilities. If you prefer to report the vulnerability via email, please send an email to security@cryptomator.org. From 757ade25edcdc7b54bd7815cceaec8c8b80f7da3 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 27 Jun 2023 16:08:44 +0200 Subject: [PATCH 04/61] Secure Dialog of Cryptomator as well --- .../cryptomator/generator/BottomSheet.java | 8 +++++--- .../org/cryptomator/generator/Dialog.java | 8 +++++--- .../ui/bottomsheet/BaseBottomSheet.kt | 10 ++++++++++ .../presentation/ui/dialog/BaseDialog.kt | 20 +++++++++++++------ 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/generator-api/src/main/java/org/cryptomator/generator/BottomSheet.java b/generator-api/src/main/java/org/cryptomator/generator/BottomSheet.java index a6b4870b1..bf364b4db 100644 --- a/generator-api/src/main/java/org/cryptomator/generator/BottomSheet.java +++ b/generator-api/src/main/java/org/cryptomator/generator/BottomSheet.java @@ -1,15 +1,17 @@ package org.cryptomator.generator; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + @Retention(RUNTIME) @Target(TYPE) public @interface BottomSheet { int value(); + boolean secure() default true; + } diff --git a/generator-api/src/main/java/org/cryptomator/generator/Dialog.java b/generator-api/src/main/java/org/cryptomator/generator/Dialog.java index 7241e4555..71eaea322 100644 --- a/generator-api/src/main/java/org/cryptomator/generator/Dialog.java +++ b/generator-api/src/main/java/org/cryptomator/generator/Dialog.java @@ -1,15 +1,17 @@ package org.cryptomator.generator; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + @Retention(RUNTIME) @Target(TYPE) public @interface Dialog { int value(); + boolean secure() default true; + } diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/bottomsheet/BaseBottomSheet.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/bottomsheet/BaseBottomSheet.kt index 519d98fc9..a42309105 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/ui/bottomsheet/BaseBottomSheet.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/ui/bottomsheet/BaseBottomSheet.kt @@ -6,8 +6,12 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.WindowManager import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import org.cryptomator.generator.BottomSheet +import org.cryptomator.presentation.BuildConfig import org.cryptomator.presentation.R +import org.cryptomator.util.SharedPreferencesHandler abstract class BaseBottomSheet : BottomSheetDialogFragment() { @@ -32,6 +36,12 @@ abstract class BaseBottomSheet : BottomSheetDialogFragment() { } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + val config = javaClass.getAnnotation(BottomSheet::class.java) + if (config?.secure == true && SharedPreferencesHandler(requireContext()).secureScreen() && !BuildConfig.DEBUG) { + dialog?.window?.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) + } else { + dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) + } setupView() } diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/dialog/BaseDialog.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/dialog/BaseDialog.kt index 5ded788cb..2a465c4be 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/ui/dialog/BaseDialog.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/ui/dialog/BaseDialog.kt @@ -1,6 +1,5 @@ package org.cryptomator.presentation.ui.dialog -import android.app.Dialog import android.content.Context import android.content.pm.ActivityInfo import android.content.res.Configuration @@ -9,6 +8,7 @@ import android.view.KeyEvent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.WindowManager import android.view.inputmethod.EditorInfo import android.widget.Button import android.widget.EditText @@ -16,6 +16,8 @@ import android.widget.TextView import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.fragment.app.FragmentManager +import org.cryptomator.generator.Dialog +import org.cryptomator.presentation.BuildConfig import org.cryptomator.presentation.util.KeyboardHelper import org.cryptomator.util.SharedPreferencesHandler import java.util.function.Supplier @@ -26,7 +28,7 @@ abstract class BaseDialog : DialogFragment() { var callback: Callback? = null - protected abstract fun setupDialog(builder: AlertDialog.Builder): Dialog + protected abstract fun setupDialog(builder: AlertDialog.Builder): android.app.Dialog protected abstract fun setupView() fun show(fragmentManager: FragmentManager) { @@ -38,7 +40,7 @@ abstract class BaseDialog : DialogFragment() { callback = context as Callback } - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + override fun onCreateDialog(savedInstanceState: Bundle?): android.app.Dialog { val builder = AlertDialog.Builder(requireActivity()) customDialog = requireActivity().layoutInflater.inflate(dialogContent, null) builder.setView(customDialog) @@ -53,6 +55,12 @@ abstract class BaseDialog : DialogFragment() { } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + val config = javaClass.getAnnotation(Dialog::class.java) + if (config?.secure == true && SharedPreferencesHandler(requireContext()).secureScreen() && !BuildConfig.DEBUG) { + dialog?.window?.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) + } else { + dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) + } setupView() } @@ -89,8 +97,8 @@ abstract class BaseDialog : DialogFragment() { private fun enableButtons(enabled: Boolean) { val dialog = dialog as AlertDialog? - dialog?.getButton(Dialog.BUTTON_POSITIVE)?.isEnabled = enabled - dialog?.getButton(Dialog.BUTTON_NEGATIVE)?.isEnabled = enabled + dialog?.getButton(android.app.Dialog.BUTTON_POSITIVE)?.isEnabled = enabled + dialog?.getButton(android.app.Dialog.BUTTON_NEGATIVE)?.isEnabled = enabled } fun allowClosingDialog(allow: Boolean) { @@ -100,7 +108,7 @@ abstract class BaseDialog : DialogFragment() { dialog?.setCanceledOnTouchOutside(allow) } - fun showKeyboard(dialog: Dialog) { + fun showKeyboard(dialog: android.app.Dialog) { KeyboardHelper.showKeyboardForDialog(dialog) } From 91de0b6c56a2cc809f2993e3c3ee68ec8f25f0f5 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Sat, 29 Jul 2023 12:41:41 +0200 Subject: [PATCH 05/61] Change update check URL --- .../cryptomator/data/repository/UpdateCheckRepositoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/src/main/java/org/cryptomator/data/repository/UpdateCheckRepositoryImpl.java b/data/src/main/java/org/cryptomator/data/repository/UpdateCheckRepositoryImpl.java index b768ad661..0d0018996 100644 --- a/data/src/main/java/org/cryptomator/data/repository/UpdateCheckRepositoryImpl.java +++ b/data/src/main/java/org/cryptomator/data/repository/UpdateCheckRepositoryImpl.java @@ -44,7 +44,7 @@ @Singleton public class UpdateCheckRepositoryImpl implements UpdateCheckRepository { - private static final String HOSTNAME_LATEST_VERSION = "https://static.cryptomator.org/android/latest-version.json"; + private static final String HOSTNAME_LATEST_VERSION = "https://api.cryptomator.org/android/latest-version.json"; private final Database database; private final OkHttpClient httpClient; From aafdae1e700f98459858a7efa0fd98bb109e2871 Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Thu, 17 Aug 2023 19:39:26 +0200 Subject: [PATCH 06/61] Allow loading of api keys from the non-VCS local.properties file --- presentation/build.gradle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/presentation/build.gradle b/presentation/build.gradle index 4f6261f4c..13824cd57 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -275,7 +275,13 @@ def liteFlavor() { } def getApiKey(key) { - return !liteFlavor() ? System.getenv().getOrDefault(key, "") : "" + return !liteFlavor() ? System.getenv().getOrDefault(key, getApiKeyLocal(key)) : "" +} + +def getApiKeyLocal(key) { + def localPropertyList = new Properties() + localPropertyList.load(new FileInputStream(rootProject.file("local.properties"))) + return localPropertyList.getOrDefault(key, "") } def getOnedriveApiKey() { From a7b0eeaa7813c4ec077e6b327d8f61c9f29381d3 Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Thu, 17 Aug 2023 19:55:35 +0200 Subject: [PATCH 07/61] Fixed exception if local.properties file doesn't exist --- presentation/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/presentation/build.gradle b/presentation/build.gradle index 13824cd57..ec554282b 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -279,6 +279,9 @@ def getApiKey(key) { } def getApiKeyLocal(key) { + if(!rootProject.file("local.properties").exists()) { + return "" + } def localPropertyList = new Properties() localPropertyList.load(new FileInputStream(rootProject.file("local.properties"))) return localPropertyList.getOrDefault(key, "") From bacce958c56adc67a5a1e0dd8ec23bb4dd00c277 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Fri, 18 Aug 2023 12:20:54 +0200 Subject: [PATCH 08/61] Fix unlock on some Samsung devices Fixes #473 and see https://issuetracker.google.com/issues/229000935#comment34 for further information --- .../presentation/service/UnlockedNotification.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java b/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java index 3f0c6ab8c..3ce268e81 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java +++ b/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java @@ -1,5 +1,6 @@ package org.cryptomator.presentation.service; +import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; @@ -31,8 +32,8 @@ class UnlockedNotification { private static final String NOTIFICATION_GROUP_KEY = "CryptomatorGroup"; private final Service service; - private final NotificationCompat.Builder builder; private final AutolockTimeout autolockTimeout; + private NotificationCompat.Builder builder; private int unlocked = 0; public UnlockedNotification(Service service, AutolockTimeout autolockTimeout) { @@ -57,6 +58,11 @@ public UnlockedNotification(Service service, AutolockTimeout autolockTimeout) { .addAction(lockNowAction()) // .setGroup(NOTIFICATION_GROUP_KEY) // .setOngoing(true); + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { + this.builder = this.builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE); + } + this.autolockTimeout = autolockTimeout; } From a97bd6e13c87d879116364c8370aa71e3d500e1e Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:29:53 +0200 Subject: [PATCH 09/61] Added stubs for read-only support Required for DocumentsProvider --- domain/src/main/java/org/cryptomator/domain/Cloud.kt | 1 + domain/src/main/java/org/cryptomator/domain/Vault.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/domain/src/main/java/org/cryptomator/domain/Cloud.kt b/domain/src/main/java/org/cryptomator/domain/Cloud.kt index 6c1f1e22e..e43dabd43 100644 --- a/domain/src/main/java/org/cryptomator/domain/Cloud.kt +++ b/domain/src/main/java/org/cryptomator/domain/Cloud.kt @@ -9,4 +9,5 @@ interface Cloud : Serializable { fun configurationMatches(cloud: Cloud?): Boolean fun persistent(): Boolean fun requiresNetwork(): Boolean + fun isReadOnly(): Boolean = false //TODO Implement read-only check } diff --git a/domain/src/main/java/org/cryptomator/domain/Vault.java b/domain/src/main/java/org/cryptomator/domain/Vault.java index b142ad8a5..de66a6a76 100644 --- a/domain/src/main/java/org/cryptomator/domain/Vault.java +++ b/domain/src/main/java/org/cryptomator/domain/Vault.java @@ -87,6 +87,10 @@ public int getPosition() { return position; } + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @Override public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { From 46f06bfe6d1b5348c6f42cd9559040e24a2b79f6 Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:46:51 +0200 Subject: [PATCH 10/61] Fixed `#isReadOnly` --- .../java/org/cryptomator/data/cloud/crypto/CryptoCloud.java | 5 +++++ domain/src/main/java/org/cryptomator/domain/Cloud.kt | 2 +- .../src/main/java/org/cryptomator/domain/DropboxCloud.java | 5 +++++ .../main/java/org/cryptomator/domain/GoogleDriveCloud.java | 5 +++++ .../main/java/org/cryptomator/domain/LocalStorageCloud.java | 5 +++++ .../src/main/java/org/cryptomator/domain/OnedriveCloud.java | 5 +++++ domain/src/main/java/org/cryptomator/domain/PCloud.java | 5 +++++ domain/src/main/java/org/cryptomator/domain/S3Cloud.java | 5 +++++ domain/src/main/java/org/cryptomator/domain/WebDavCloud.java | 5 +++++ 9 files changed, 41 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/org/cryptomator/data/cloud/crypto/CryptoCloud.java b/data/src/main/java/org/cryptomator/data/cloud/crypto/CryptoCloud.java index eeadb1358..65a843d33 100644 --- a/data/src/main/java/org/cryptomator/data/cloud/crypto/CryptoCloud.java +++ b/data/src/main/java/org/cryptomator/data/cloud/crypto/CryptoCloud.java @@ -41,6 +41,11 @@ public boolean requiresNetwork() { return false; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + public Vault getVault() { return vault; } diff --git a/domain/src/main/java/org/cryptomator/domain/Cloud.kt b/domain/src/main/java/org/cryptomator/domain/Cloud.kt index e43dabd43..30496875b 100644 --- a/domain/src/main/java/org/cryptomator/domain/Cloud.kt +++ b/domain/src/main/java/org/cryptomator/domain/Cloud.kt @@ -9,5 +9,5 @@ interface Cloud : Serializable { fun configurationMatches(cloud: Cloud?): Boolean fun persistent(): Boolean fun requiresNetwork(): Boolean - fun isReadOnly(): Boolean = false //TODO Implement read-only check + fun isReadOnly(): Boolean //TODO Implement read-only checks } diff --git a/domain/src/main/java/org/cryptomator/domain/DropboxCloud.java b/domain/src/main/java/org/cryptomator/domain/DropboxCloud.java index 2178e3c75..db70d609e 100644 --- a/domain/src/main/java/org/cryptomator/domain/DropboxCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/DropboxCloud.java @@ -58,6 +58,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { diff --git a/domain/src/main/java/org/cryptomator/domain/GoogleDriveCloud.java b/domain/src/main/java/org/cryptomator/domain/GoogleDriveCloud.java index 8ebd70f0e..cb1b13ab5 100644 --- a/domain/src/main/java/org/cryptomator/domain/GoogleDriveCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/GoogleDriveCloud.java @@ -58,6 +58,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { diff --git a/domain/src/main/java/org/cryptomator/domain/LocalStorageCloud.java b/domain/src/main/java/org/cryptomator/domain/LocalStorageCloud.java index fb96449c6..6915a6e0a 100644 --- a/domain/src/main/java/org/cryptomator/domain/LocalStorageCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/LocalStorageCloud.java @@ -57,6 +57,11 @@ public boolean requiresNetwork() { return false; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { diff --git a/domain/src/main/java/org/cryptomator/domain/OnedriveCloud.java b/domain/src/main/java/org/cryptomator/domain/OnedriveCloud.java index 8791bb7e3..389e4611c 100644 --- a/domain/src/main/java/org/cryptomator/domain/OnedriveCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/OnedriveCloud.java @@ -53,6 +53,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @Override public boolean configurationMatches(Cloud cloud) { return cloud instanceof OnedriveCloud && configurationMatches((OnedriveCloud) cloud); diff --git a/domain/src/main/java/org/cryptomator/domain/PCloud.java b/domain/src/main/java/org/cryptomator/domain/PCloud.java index 89b016177..163da1e96 100644 --- a/domain/src/main/java/org/cryptomator/domain/PCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/PCloud.java @@ -69,6 +69,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { diff --git a/domain/src/main/java/org/cryptomator/domain/S3Cloud.java b/domain/src/main/java/org/cryptomator/domain/S3Cloud.java index 064cc93ad..ebc3c858b 100644 --- a/domain/src/main/java/org/cryptomator/domain/S3Cloud.java +++ b/domain/src/main/java/org/cryptomator/domain/S3Cloud.java @@ -90,6 +90,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { diff --git a/domain/src/main/java/org/cryptomator/domain/WebDavCloud.java b/domain/src/main/java/org/cryptomator/domain/WebDavCloud.java index ccb21dd6d..73f1f3d99 100644 --- a/domain/src/main/java/org/cryptomator/domain/WebDavCloud.java +++ b/domain/src/main/java/org/cryptomator/domain/WebDavCloud.java @@ -76,6 +76,11 @@ public boolean requiresNetwork() { return true; } + @Override + public boolean isReadOnly() { + return false; //TODO Implement read-only check + } + @NotNull @Override public String toString() { From f6976ebb714eba9c273d5707abf6827a32f1d770 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 29 Aug 2023 12:40:08 +0200 Subject: [PATCH 11/61] Add Timber license --- presentation/src/main/res/xml/licenses.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/presentation/src/main/res/xml/licenses.xml b/presentation/src/main/res/xml/licenses.xml index a3f346e3d..606e34fc1 100644 --- a/presentation/src/main/res/xml/licenses.xml +++ b/presentation/src/main/res/xml/licenses.xml @@ -148,6 +148,13 @@ android:action="android.intent.action.VIEW" android:data="https://github.com/davemorrissey/subsampling-scale-image-view" /> + + + From 335fd2546882214584f0253e757c8db1d76c62b0 Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:45:23 +0200 Subject: [PATCH 12/61] Added NamedTimberLogger --- .../docprovider/NamedTimberLogger.kt | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 presentation/src/main/java/org/cryptomator/presentation/docprovider/NamedTimberLogger.kt diff --git a/presentation/src/main/java/org/cryptomator/presentation/docprovider/NamedTimberLogger.kt b/presentation/src/main/java/org/cryptomator/presentation/docprovider/NamedTimberLogger.kt new file mode 100644 index 000000000..65cd72f04 --- /dev/null +++ b/presentation/src/main/java/org/cryptomator/presentation/docprovider/NamedTimberLogger.kt @@ -0,0 +1,222 @@ +/* + * Parts of this file have been copied from the "timber" project by Jake Wharton, hosted on GitHub. + * The pertaining file can be found here: https://github.com/JakeWharton/timber/blob/9954d94abbaea9d003243be5b69f8ae0ffc0c99d/timber/src/main/java/timber/log/Timber.kt + * + * Copied elements include: + * - The head of all contained functions in the "NamedTimberLogger" class, but not the body + * - The first line of documentation of all contained functions in the "NamedTimberLogger" class + * + * The following notice ONLY applies to that particular source code. Unless stated otherwise, + * any other source code in this file or in this project is subject to the license of the project, which can be found in the "License" section of this project's README. + * + * --- + * + * Copyright 2013 Jake Wharton + * Use of this source code is governed by the Apache 2.0 license that can be found at http://www.apache.org/licenses/LICENSE-2.0 + * + * THIS FILE WAS CHANGED BY THE LICENSEE, I.E. IT CONTAINS CHANGES NOT MADE BY THE ORIGINAL CONTRIBUTORS LISTED ABOVE. + */ +package org.cryptomator.presentation.docprovider + +import org.jetbrains.annotations.NonNls +import timber.log.Timber + +fun Timber.Forest.named(tag: String): NamedTimberLogger { + return NamedTimberLogger(tag) +} + +/** + * This class is a facade for the [companion object of Timber][Timber.Forest] + * that emits each message with this classes [tag] parameter. + */ +class NamedTimberLogger(private val tag: String) { + + /** Log a verbose message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.v] with it. + */ + fun v(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.v(message, *args) + } + + /** Log a verbose exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.v] with it. + */ + fun v(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.v(t, message, *args) + } + + /** Log a verbose exception. + * + * This method uses this classes [tag] and calls [Timber.v] with it. + */ + fun v(t: Throwable?) { + Timber.tag(tag) + Timber.v(t) + } + + /** Log a debug message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.d] with it. + */ + fun d(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.d(message, *args) + } + + /** Log a debug exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.d] with it. + */ + fun d(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.d(t, message, *args) + } + + /** Log a debug exception. + * + * This method uses this classes [tag] and calls [Timber.d] with it. + */ + fun d(t: Throwable?) { + Timber.tag(tag) + Timber.d(t) + } + + /** Log an info message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.i] with it. + */ + fun i(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.i(message, *args) + } + + /** Log an info exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.i] with it. + */ + fun i(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.i(t, message, *args) + } + + /** Log an info exception. + * + * This method uses this classes [tag] and calls [Timber.i] with it. + */ + fun i(t: Throwable?) { + Timber.tag(tag) + Timber.i(t) + } + + /** Log a warning message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.w] with it. + */ + fun w(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.w(message, *args) + } + + /** Log a warning exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.w] with it. + */ + fun w(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.w(t, message, *args) + } + + /** Log a warning exception. + * + * This method uses this classes [tag] and calls [Timber.w] with it. + */ + fun w(t: Throwable?) { + Timber.tag(tag) + Timber.w(t) + } + + /** Log an error message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.e] with it. + */ + fun e(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.e(message, *args) + } + + /** Log an error exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.e] with it. + */ + fun e(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.e(t, message, *args) + } + + /** Log an error exception. + * + * This method uses this classes [tag] and calls [Timber.e] with it. + */ + fun e(t: Throwable?) { + Timber.tag(tag) + Timber.e(t) + } + + /** Log an assert message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.wtf] with it. + */ + fun wtf(@NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.wtf(message, *args) + } + + /** Log an assert exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.wtf] with it. + */ + fun wtf(t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.wtf(t, message, *args) + } + + /** Log an assert exception. + * + * This method uses this classes [tag] and calls [Timber.wtf] with it. + */ + fun wtf(t: Throwable?) { + Timber.tag(tag) + Timber.wtf(t) + } + + /** Log at `priority` a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.log] with it. + */ + fun log(priority: Int, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.log(priority, message, *args) + } + + /** Log at `priority` an exception and a message with optional format args. + * + * This method uses this classes [tag] and calls [Timber.log] with it. + */ + fun log(priority: Int, t: Throwable?, @NonNls message: String?, vararg args: Any?) { + Timber.tag(tag) + Timber.log(priority, t, message, *args) + } + + /** Log at `priority` an exception. + * + * This method uses this classes [tag] and calls [Timber.log] with it. + */ + fun log(priority: Int, t: Throwable?) { + Timber.tag(tag) + Timber.log(priority, t) + } +} \ No newline at end of file From 4bb6e6a5fd999ec5e1aab8dc7604397a50b218ae Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:08:49 +0200 Subject: [PATCH 13/61] Added stubs for copy-operation --- .../repository/CloudContentRepository.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/domain/src/main/java/org/cryptomator/domain/repository/CloudContentRepository.kt b/domain/src/main/java/org/cryptomator/domain/repository/CloudContentRepository.kt index f4ca070c7..b7ecb0420 100644 --- a/domain/src/main/java/org/cryptomator/domain/repository/CloudContentRepository.kt +++ b/domain/src/main/java/org/cryptomator/domain/repository/CloudContentRepository.kt @@ -67,6 +67,24 @@ interface CloudContentRepository Date: Sat, 30 Sep 2023 16:15:24 +0200 Subject: [PATCH 14/61] Reformatted CryptomatorApp.kt [ci skip] --- .../presentation/CryptomatorApp.kt | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt b/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt index df950962f..1fce6d214 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt @@ -45,16 +45,11 @@ class CryptomatorApp : MultiDexApplication(), HasComponent override fun onCreate() { super.onCreate() setupLogging() + @Suppress("KotlinConstantConditions") // val flavor = when (BuildConfig.FLAVOR) { - "apkstore" -> { - "APK Store Edition" - } - "fdroid" -> { - "F-Droid Edition" - } - "lite" -> { - "F-Droid Main Repo Edition" - } + "apkstore" -> "APK Store Edition" + "fdroid" -> "F-Droid Edition" + "lite" -> "F-Droid Main Repo Edition" else -> "Google Play Edition" } Timber.tag("App").i( @@ -147,17 +142,16 @@ class CryptomatorApp : MultiDexApplication(), HasComponent val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault) startAutoUpload(cloud) } else if (vault == null) { - autoUploadServiceBinder?.vaultNotFound() - ?: run { - Timber.tag("App").i("autoUploadServiceBinder not yet initialized, manually show notification") - AutoUploadNotification(applicationContext, 0).showVaultNotFoundNotification() - } + autoUploadServiceBinder?.vaultNotFound() ?: run { + Timber.tag("App").i("autoUploadServiceBinder not yet initialized, manually show notification") + AutoUploadNotification(applicationContext, 0).showVaultNotFoundNotification() + } } } } private fun checkToStartAutoImageUpload(sharedPreferencesHandler: SharedPreferencesHandler): Boolean { - return sharedPreferencesHandler.usePhotoUpload() + return sharedPreferencesHandler.usePhotoUpload() // && (!sharedPreferencesHandler.autoPhotoUploadOnlyUsingWifi() || applicationComponent.networkConnectionCheck().checkWifiOnAndConnected()) } From 12311bf658b26a077eda449757cd6c97bc371763 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Fri, 13 Oct 2023 09:59:12 +0200 Subject: [PATCH 15/61] Simplify API key loading --- build.gradle | 17 +++++++++++++++++ data/build.gradle | 8 -------- presentation/build.gradle | 13 ------------- presentation/prebuild.gradle | 4 ---- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 6c568e557..c43456457 100644 --- a/build.gradle +++ b/build.gradle @@ -53,3 +53,20 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir } + +def getApiKey(key) { + return !liteFlavor() ? System.getenv().getOrDefault(key, getApiKeyLocal(key)) : "" +} + +def liteFlavor() { + gradle.startParameter.taskNames.stream().filter(t -> t.toLowerCase().contains("lite")).findAny().isPresent() +} + +def getApiKeyLocal(key) { + if(!rootProject.file("local.properties").exists()) { + return "" + } + def localPropertyList = new Properties() + localPropertyList.load(new FileInputStream(rootProject.file("local.properties"))) + return localPropertyList.getOrDefault(key, "") +} diff --git a/data/build.gradle b/data/build.gradle index 596b438a3..21be02fe1 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -224,14 +224,6 @@ configurations { all*.exclude group: 'com.google.android', module: 'android' } -def liteFlavor() { - gradle.startParameter.taskNames.stream().filter(t -> t.toLowerCase().contains("lite")).findAny().isPresent() -} - -def getApiKey(key) { - return !liteFlavor() ? System.getenv().getOrDefault(key, "") : "" -} - tasks.withType(Test) { testLogging { events "failed" diff --git a/presentation/build.gradle b/presentation/build.gradle index ec554282b..807ae9c38 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -274,19 +274,6 @@ def liteFlavor() { gradle.startParameter.taskNames.stream().filter(t -> t.toLowerCase().contains("lite")).findAny().isPresent() } -def getApiKey(key) { - return !liteFlavor() ? System.getenv().getOrDefault(key, getApiKeyLocal(key)) : "" -} - -def getApiKeyLocal(key) { - if(!rootProject.file("local.properties").exists()) { - return "" - } - def localPropertyList = new Properties() - localPropertyList.load(new FileInputStream(rootProject.file("local.properties"))) - return localPropertyList.getOrDefault(key, "") -} - def getOnedriveApiKey() { if (liteFlavor()) { return "" diff --git a/presentation/prebuild.gradle b/presentation/prebuild.gradle index b7a5e16ca..20db7bbcb 100644 --- a/presentation/prebuild.gradle +++ b/presentation/prebuild.gradle @@ -29,8 +29,4 @@ task generateAppConfigurationFile() { config_file.write(JsonOutput.prettyPrint(JsonOutput.toJson(jsonSlurper.parseText(jsonString)))) } -static def getApiKey(key) { - return System.getenv().getOrDefault(key, "") -} - build.dependsOn generateAppConfigurationFile From ee8b41facb74c477826ca2732e76c9d42eb1f1cf Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:12:55 +0200 Subject: [PATCH 16/61] Updated code style Fixed java import layout Removed unnecessary entry Minor cleanup --- .idea/codeStyles/Project.xml | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 1ed39b2bf..7928f60d5 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -11,6 +11,40 @@