diff --git a/presentation/build.gradle b/presentation/build.gradle
index d5289996..be4b4997 100644
--- a/presentation/build.gradle
+++ b/presentation/build.gradle
@@ -91,6 +91,9 @@ android {
fdroidmain {
dimension "version"
+
+ applicationIdSuffix ".lite"
+ resValue "string", "app_id", androidApplicationId + applicationIdSuffix
}
}
diff --git a/presentation/src/fdroidmain/AndroidManifest.xml b/presentation/src/fdroidmain/AndroidManifest.xml
new file mode 100644
index 00000000..e341d057
--- /dev/null
+++ b/presentation/src/fdroidmain/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/presentation/src/fdroidmain/res/values/strings.xml b/presentation/src/fdroidmain/res/values/strings.xml
new file mode 100644
index 00000000..31a7ed2d
--- /dev/null
+++ b/presentation/src/fdroidmain/res/values/strings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+ Cryptomator Lite
+
+
diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml
index 359fb2ec..d485812b 100644
--- a/presentation/src/main/AndroidManifest.xml
+++ b/presentation/src/main/AndroidManifest.xml
@@ -119,6 +119,9 @@
+
diff --git a/presentation/src/main/java/org/cryptomator/presentation/di/component/ActivityComponent.java b/presentation/src/main/java/org/cryptomator/presentation/di/component/ActivityComponent.java
index 07aec966..a8018384 100644
--- a/presentation/src/main/java/org/cryptomator/presentation/di/component/ActivityComponent.java
+++ b/presentation/src/main/java/org/cryptomator/presentation/di/component/ActivityComponent.java
@@ -13,6 +13,7 @@ import org.cryptomator.presentation.ui.activity.ChooseCloudServiceActivity;
import org.cryptomator.presentation.ui.activity.CloudConnectionListActivity;
import org.cryptomator.presentation.ui.activity.CloudSettingsActivity;
import org.cryptomator.presentation.ui.activity.CreateVaultActivity;
+import org.cryptomator.presentation.ui.activity.CryptomatorVariantsActivity;
import org.cryptomator.presentation.ui.activity.ImagePreviewActivity;
import org.cryptomator.presentation.ui.activity.LicenseCheckActivity;
import org.cryptomator.presentation.ui.activity.LicensesActivity;
@@ -123,4 +124,7 @@ public interface ActivityComponent {
void inject(S3AddOrChangeActivity s3AddOrChangeActivity);
void inject(S3AddOrChangeFragment s3AddOrChangeFragment);
+
+ void inject(CryptomatorVariantsActivity cryptomatorVariantsActivity);
+
}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/intent/CryptomatorVariantsIntent.java b/presentation/src/main/java/org/cryptomator/presentation/intent/CryptomatorVariantsIntent.java
new file mode 100644
index 00000000..87f8c284
--- /dev/null
+++ b/presentation/src/main/java/org/cryptomator/presentation/intent/CryptomatorVariantsIntent.java
@@ -0,0 +1,9 @@
+package org.cryptomator.presentation.intent;
+
+import org.cryptomator.generator.Intent;
+import org.cryptomator.presentation.ui.activity.CryptomatorVariantsActivity;
+
+@Intent(CryptomatorVariantsActivity.class)
+public interface CryptomatorVariantsIntent {
+
+}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/presenter/ChooseCloudServicePresenter.kt b/presentation/src/main/java/org/cryptomator/presentation/presenter/ChooseCloudServicePresenter.kt
index d28d24bc..e1d14874 100644
--- a/presentation/src/main/java/org/cryptomator/presentation/presenter/ChooseCloudServicePresenter.kt
+++ b/presentation/src/main/java/org/cryptomator/presentation/presenter/ChooseCloudServicePresenter.kt
@@ -1,5 +1,6 @@
package org.cryptomator.presentation.presenter
+import android.view.View
import org.cryptomator.domain.Cloud
import org.cryptomator.domain.di.PerView
import org.cryptomator.domain.exception.FatalBackendException
@@ -12,6 +13,7 @@ import org.cryptomator.presentation.intent.Intents
import org.cryptomator.presentation.model.CloudTypeModel
import org.cryptomator.presentation.model.mappers.CloudModelMapper
import org.cryptomator.presentation.ui.activity.view.ChooseCloudServiceView
+import org.cryptomator.presentation.ui.snackbar.SnackbarAction
import org.cryptomator.presentation.workflow.ActivityResult
import org.cryptomator.presentation.workflow.AddExistingVaultWorkflow
import org.cryptomator.presentation.workflow.CreateNewVaultWorkflow
@@ -92,6 +94,18 @@ class ChooseCloudServicePresenter @Inject constructor( //
finishWithResult(cloudModelMapper.toModel(cloud))
}
+ fun showCloudMissingSnackbarHintInFDroidMainVariant() {
+ if (BuildConfig.FLAVOR == "fdroidmain") {
+ view?.showSnackbar(R.string.snack_bar_cryptomator_variants_hint, object: SnackbarAction {
+ override fun onClick(v: View?) {
+ startIntent(Intents.cryptomatorVariantsIntent())
+ }
+ override val text: Int
+ get() = R.string.snack_bar_cryptomator_variants_title
+ })
+ }
+ }
+
init {
unsubscribeOnDestroy(getCloudsUseCase)
}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/presenter/CryptomatorVariantsPresenter.kt b/presentation/src/main/java/org/cryptomator/presentation/presenter/CryptomatorVariantsPresenter.kt
new file mode 100644
index 00000000..1c4b0cf8
--- /dev/null
+++ b/presentation/src/main/java/org/cryptomator/presentation/presenter/CryptomatorVariantsPresenter.kt
@@ -0,0 +1,103 @@
+package org.cryptomator.presentation.presenter
+
+import android.content.Intent
+import android.net.Uri
+import android.widget.Toast
+import com.google.common.base.Optional
+import org.cryptomator.data.util.NetworkConnectionCheck
+import org.cryptomator.domain.di.PerView
+import org.cryptomator.domain.usecases.DoUpdateCheckUseCase
+import org.cryptomator.domain.usecases.DoUpdateUseCase
+import org.cryptomator.domain.usecases.NoOpResultHandler
+import org.cryptomator.domain.usecases.UpdateCheck
+import org.cryptomator.presentation.R
+import org.cryptomator.presentation.exception.ExceptionHandlers
+import org.cryptomator.presentation.model.ProgressModel
+import org.cryptomator.presentation.ui.activity.view.CryptomatorVariantsView
+import org.cryptomator.presentation.util.FileUtil
+import javax.inject.Inject
+
+@PerView
+class CryptomatorVariantsPresenter @Inject constructor(
+ //
+ exceptionMappings: ExceptionHandlers, //
+ private val updateCheckUseCase: DoUpdateCheckUseCase, //
+ private val updateUseCase: DoUpdateUseCase, //
+ private val networkConnectionCheck: NetworkConnectionCheck, //
+ private val fileUtil: FileUtil, //
+) : Presenter(exceptionMappings) {
+
+ private val fDroidPackageName = "org.fdroid.fdroid"
+
+ fun onInstallMainFDroidVariantClicked() {
+ context().packageManager.getLaunchIntentForPackage(fDroidPackageName)?.let {
+ it.data = Uri.parse("https://f-droid.org/packages/org.cryptomator.light")
+ context().startActivity(it)
+ } ?: Toast.makeText(context(), R.string.error_interact_with_fdroid_but_fdroid_missing, Toast.LENGTH_SHORT).show()
+ }
+
+ fun onAddRepoClicked() {
+ context().packageManager.getLaunchIntentForPackage(fDroidPackageName)?.let {
+ it.data = Uri.parse("https://static.cryptomator.org/android/fdroid/repo?fingerprint=F7C3EC3B0D588D3CB52983E9EB1A7421C93D4339A286398E71D7B651E8D8ECDD")
+ context().startActivity(it)
+ } ?: Toast.makeText(context(), R.string.error_interact_with_fdroid_but_fdroid_missing, Toast.LENGTH_SHORT).show()
+ }
+
+ fun onInstallFDroidVariantClicked() {
+ context().packageManager.getLaunchIntentForPackage(fDroidPackageName)?.let {
+ it.data = Uri.parse("https://f-droid.org/packages/org.cryptomator")
+ context().startActivity(it)
+ } ?: Toast.makeText(context(), R.string.error_interact_with_fdroid_but_fdroid_missing, Toast.LENGTH_SHORT).show()
+ }
+
+ fun onInstallWebsiteVariantClicked() {
+ if (networkConnectionCheck.isPresent) {
+ view?.showProgress(ProgressModel.GENERIC)
+
+ updateCheckUseCase //
+ .withVersion("0.0.0")
+ .run(object : NoOpResultHandler>() {
+ override fun onSuccess(result: Optional) {
+ installUpdate()
+ }
+
+ override fun onError(e: Throwable) {
+ view?.showProgress(ProgressModel.COMPLETED)
+ showError(e)
+ }
+ })
+ } else {
+ Toast.makeText(context(), R.string.error_update_no_internet, Toast.LENGTH_SHORT).show()
+ }
+ }
+
+ private fun installUpdate() {
+ val uri = fileUtil.contentUriForNewTempFile("cryptomator.apk")
+ val file = fileUtil.tempFile("cryptomator.apk")
+
+ updateUseCase //
+ .withFile(file) //
+ .run(object : NoOpResultHandler() {
+ override fun onError(e: Throwable) {
+ showError(e)
+ }
+
+ override fun onSuccess(result: Void?) {
+ super.onSuccess(result)
+ val intent = Intent(Intent.ACTION_VIEW)
+ intent.setDataAndType(uri, "application/vnd.android.package-archive")
+ intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ context().startActivity(intent)
+ }
+
+ override fun onFinished() {
+ view?.showProgress(ProgressModel.COMPLETED)
+ }
+ })
+ }
+
+ init {
+ unsubscribeOnDestroy(updateCheckUseCase, updateUseCase)
+ }
+}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/BaseActivity.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/BaseActivity.kt
index a4b73723..25f4c3ba 100644
--- a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/BaseActivity.kt
+++ b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/BaseActivity.kt
@@ -316,6 +316,7 @@ abstract class BaseActivity : AppCompatActivity(), View, ActivityCompat.OnReques
internal open fun snackbarView(): android.view.View {
return activity().findViewById(R.id.locationsRecyclerView) as android.view.View?
+ ?: activity().findViewById(R.id.rlChooseCloudService) as android.view.View?
?: return activity().findViewById(R.id.coordinatorLayout)
}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/CryptomatorVariantsActivity.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/CryptomatorVariantsActivity.kt
new file mode 100644
index 00000000..1a77652a
--- /dev/null
+++ b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/CryptomatorVariantsActivity.kt
@@ -0,0 +1,51 @@
+package org.cryptomator.presentation.ui.activity
+
+import org.cryptomator.generator.Activity
+import org.cryptomator.presentation.R
+import org.cryptomator.presentation.presenter.CryptomatorVariantsPresenter
+import org.cryptomator.presentation.ui.activity.view.CryptomatorVariantsView
+import javax.inject.Inject
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.btnAddRepo
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.btnInstallFDroidVariant
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.btnInstallMainFDroidVariant
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.btnInstallWebsiteVariant
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.tvFdroidCustomSupported
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.tvFdroidCustomUnsupported
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.tvFdroidMainSupported
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.tvFdroidMainUnsupported
+import kotlinx.android.synthetic.main.activity_cryptomator_variants.tvWebsiteAllowed
+import kotlinx.android.synthetic.main.toolbar_layout.toolbar
+
+@Activity(layout = R.layout.activity_cryptomator_variants)
+class CryptomatorVariantsActivity : BaseActivity(), CryptomatorVariantsView {
+
+ @Inject
+ lateinit var presenter: CryptomatorVariantsPresenter
+
+ override fun setupView() {
+ toolbar.title = getString(R.string.screen_cryptomator_variants_title)
+ setSupportActionBar(toolbar)
+
+ tvFdroidMainSupported.text = "WebDAV, S3, Local Storage"
+ tvFdroidMainUnsupported.text = "Dropbox, Google Drive, OneDrive, pCloud"
+
+ tvFdroidCustomSupported.text = "Dropbox, OneDrive, pCloud, WebDAV, S3, Local Storage"
+ tvFdroidCustomUnsupported.text = "Google Drive"
+
+ tvWebsiteAllowed.text = "Dropbox, Google Drive, OneDrive, pCloud, WebDAV, S3, Local Storage"
+
+ btnInstallMainFDroidVariant.setOnClickListener {
+ presenter.onInstallMainFDroidVariantClicked()
+ }
+ btnAddRepo.setOnClickListener {
+ presenter.onAddRepoClicked()
+ }
+ btnInstallFDroidVariant.setOnClickListener {
+ presenter.onInstallFDroidVariantClicked()
+ }
+ btnInstallWebsiteVariant.setOnClickListener {
+ presenter.onInstallWebsiteVariantClicked()
+ }
+ }
+
+}
diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/view/CryptomatorVariantsView.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/view/CryptomatorVariantsView.kt
new file mode 100644
index 00000000..9b8ee1be
--- /dev/null
+++ b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/view/CryptomatorVariantsView.kt
@@ -0,0 +1,3 @@
+package org.cryptomator.presentation.ui.activity.view
+
+interface CryptomatorVariantsView : View
diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/fragment/ChooseCloudServiceFragment.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/fragment/ChooseCloudServiceFragment.kt
index 4902d353..efe4bb46 100644
--- a/presentation/src/main/java/org/cryptomator/presentation/ui/fragment/ChooseCloudServiceFragment.kt
+++ b/presentation/src/main/java/org/cryptomator/presentation/ui/fragment/ChooseCloudServiceFragment.kt
@@ -27,6 +27,7 @@ class ChooseCloudServiceFragment : BaseFragment() {
override fun setupView() {
setupRecyclerView()
+ chooseCloudServicePresenter.showCloudMissingSnackbarHintInFDroidMainVariant()
}
fun render(cloudModels: List?) {
diff --git a/presentation/src/main/res/drawable-night/ic_clear_gray.xml b/presentation/src/main/res/drawable-night/ic_clear_gray.xml
new file mode 100644
index 00000000..70dfd52f
--- /dev/null
+++ b/presentation/src/main/res/drawable-night/ic_clear_gray.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/presentation/src/main/res/drawable-night/ic_done_gray.xml b/presentation/src/main/res/drawable-night/ic_done_gray.xml
new file mode 100644
index 00000000..5f99d9aa
--- /dev/null
+++ b/presentation/src/main/res/drawable-night/ic_done_gray.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/presentation/src/main/res/drawable/ic_clear_gray.xml b/presentation/src/main/res/drawable/ic_clear_gray.xml
new file mode 100644
index 00000000..481c0aa6
--- /dev/null
+++ b/presentation/src/main/res/drawable/ic_clear_gray.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/presentation/src/main/res/drawable/ic_done_gray.xml b/presentation/src/main/res/drawable/ic_done_gray.xml
new file mode 100644
index 00000000..2603270e
--- /dev/null
+++ b/presentation/src/main/res/drawable/ic_done_gray.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/presentation/src/main/res/layout/activity_cryptomator_variants.xml b/presentation/src/main/res/layout/activity_cryptomator_variants.xml
new file mode 100644
index 00000000..cc3dc305
--- /dev/null
+++ b/presentation/src/main/res/layout/activity_cryptomator_variants.xml
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/presentation/src/main/res/layout/fragment_choose_cloud_service.xml b/presentation/src/main/res/layout/fragment_choose_cloud_service.xml
index 79e40d8f..cc674652 100644
--- a/presentation/src/main/res/layout/fragment_choose_cloud_service.xml
+++ b/presentation/src/main/res/layout/fragment_choose_cloud_service.xml
@@ -1,7 +1,8 @@
+ android:layout_height="match_parent"
+ android:id="@+id/rlChooseCloudService">
diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml
index 915d78d0..f8a34297 100644
--- a/presentation/src/main/res/values/strings.xml
+++ b/presentation/src/main/res/values/strings.xml
@@ -42,6 +42,7 @@
Local file isn\'t present anymore after switching back to Cryptomator. Possible changes cannot be propagated back to the cloud.
No such bucket
Custom Masterkey location not supported yet
+ Failed to communicate with the F-Droid app. Not installed?
@@ -79,6 +80,9 @@
@string/screen_share_files_save_button_text
+ READ MORE
+ Cloud not in the list?
+
@@ -300,7 +304,21 @@
%1$s could not be authenticated.
Update pCloud credentials
-
+
+ Variants of Cryptomator
+ Main F-Droid Repository
+ Excluded because they require API keys.
+ Install
+ Cryptomator F-Droid Repository
+ Excluded because it contains proprietary dependencies.
+ Add Cryptomator repository to the F-Droid app.
+ Add
+ Install Cryptomator using F-Droid.\nIf a not found error is displayed, wait until the F-Droid synchronisation is finished.
+ @string/screen_cryptomator_variants_fdroid_main_install
+ Website
+ Contains proprietary dependencies.
+ @string/screen_cryptomator_variants_fdroid_main_install
+ Switching from or to the Main F-Droid repository variant requires a fresh setup of the app.
Cancel