From d22f1a4459b1539b7e74946f6046dabf626a5e5c Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 1 Mar 2022 22:35:00 +0100 Subject: [PATCH] Restart app automatically when Microsoft workaround enabled (#150) --- .../cryptomator/presentation/presenter/SettingsPresenter.kt | 6 ++++++ .../presentation/ui/activity/SettingsActivity.kt | 2 +- presentation/src/main/res/values/strings.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/org/cryptomator/presentation/presenter/SettingsPresenter.kt b/presentation/src/main/java/org/cryptomator/presentation/presenter/SettingsPresenter.kt index 43cb4dc4..8910d2eb 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/presenter/SettingsPresenter.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/presenter/SettingsPresenter.kt @@ -35,6 +35,7 @@ import java.io.IOException import java.util.zip.ZipEntry import java.util.zip.ZipOutputStream import javax.inject.Inject +import kotlin.system.exitProcess import timber.log.Timber @PerView @@ -162,6 +163,11 @@ class SettingsPresenter @Inject internal constructor( }) } + fun restartApp() { + // process gets restarted so just exit it + exitProcess(0) + } + private inner class CreateErrorReportArchiveTask : AsyncTask() { override fun doInBackground(vararg params: Void?): File? { diff --git a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/SettingsActivity.kt b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/SettingsActivity.kt index 0a64940a..879182e3 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/ui/activity/SettingsActivity.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/ui/activity/SettingsActivity.kt @@ -105,7 +105,7 @@ class SettingsActivity : BaseActivity(), } override fun onMicrosoftDisclaimerAccepted() { - presenter.onDebugModeChanged(accepted()) + presenter.restartApp() } override fun onMicrosoftDisclaimerRejected() { diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 3a38bad2..6f55c3d5 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -411,7 +411,7 @@ Enable @string/dialog_button_cancel - Due to a bug in Microsoft apps, we need to share the file with them in a public media folder. We only use this using those file types. After resuming to Cryptomator, we delete the public available file again but we can not influence what happens to this file in the meantime. So just enable it if this isn\'t a problem for you.\n\nIf enabled, please restart Cryptomator to apply this change. + Due to a bug in Microsoft apps, we need to share the file with them in a public media folder. We only use this using those file types. After resuming to Cryptomator, we delete the public available file again but we can not influence what happens to this file in the meantime. So just enable it if this isn\'t a problem for you.\n\nIf enabled, Cryptomator gets restarted. @string/dialog_debug_mode_disclaimer_title @string/dialog_debug_mode_positive_button @string/dialog_button_cancel