Fix target Activity not found due to the combination of flavor and type

This commit is contained in:
Julian Raufelder 2022-05-25 17:54:48 +02:00
parent 646e6418ad
commit 33b79506d0
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
10 changed files with 121 additions and 37 deletions

View File

@ -50,8 +50,6 @@ android {
buildConfigField "String", "PCLOUD_CLIENT_ID", "\"" + getApiKey('PCLOUD_CLIENT_ID') + "\""
manifestPlaceholders = [DROPBOX_API_KEY: getApiKey('DROPBOX_API_KEY'), ONEDRIVE_API_KEY_DECODED: getOnedriveApiKey()]
resValue "string", "app_id", androidApplicationId
}
debug {
@ -69,8 +67,6 @@ android {
applicationIdSuffix ".debug"
versionNameSuffix '-DEBUG'
resValue "string", "app_id", androidApplicationId + applicationIdSuffix
}
}

View File

@ -0,0 +1,9 @@
package org.cryptomator.presentation.intent;
import org.cryptomator.generator.Intent;
import org.cryptomator.presentation.ui.activity.AutoUploadChooseVaultActivity;
@Intent(AutoUploadChooseVaultActivity.class)
public interface AutoUploadChooseVaultIntent {
}

View File

@ -0,0 +1,9 @@
package org.cryptomator.presentation.intent;
import org.cryptomator.generator.Intent;
import org.cryptomator.presentation.ui.activity.BiometricAuthSettingsActivity;
@Intent(BiometricAuthSettingsActivity.class)
public interface BiometricAuthSettingsIntent {
}

View File

@ -0,0 +1,9 @@
package org.cryptomator.presentation.intent;
import org.cryptomator.generator.Intent;
import org.cryptomator.presentation.ui.activity.LicensesActivity;
@Intent(LicensesActivity.class)
public interface LicenseIntent {
}

View File

@ -19,6 +19,7 @@ import org.cryptomator.generator.Callback
import org.cryptomator.presentation.BuildConfig
import org.cryptomator.presentation.R
import org.cryptomator.presentation.exception.ExceptionHandlers
import org.cryptomator.presentation.intent.Intents
import org.cryptomator.presentation.logging.Logfiles
import org.cryptomator.presentation.logging.ReleaseLogger
import org.cryptomator.presentation.model.ProgressModel
@ -194,6 +195,26 @@ class SettingsPresenter @Inject internal constructor(
})
}
fun onCloudSettingsClicked() {
startIntent(Intents.cloudSettingsIntent())
}
fun onBiometricAuthSettingsClicked() {
startIntent(Intents.biometricAuthSettingsIntent())
}
fun onCryptomatorVariantsClicked() {
startIntent(Intents.cryptomatorVariantsIntent())
}
fun onAutoUploadChooseVaultClicked() {
startIntent(Intents.autoUploadChooseVaultIntent())
}
fun onLicensedClicked() {
startIntent(Intents.licenseIntent())
}
private inner class CreateErrorReportArchiveTask : AsyncTask<Void?, IOException?, File?>() {
override fun doInBackground(vararg params: Void?): File? {

View File

@ -13,10 +13,9 @@ import android.net.Uri
import android.os.Handler
import android.provider.MediaStore
import org.cryptomator.domain.exception.FatalBackendException
import org.cryptomator.presentation.BuildConfig
import org.cryptomator.presentation.CryptomatorApp
import org.cryptomator.presentation.R
import org.cryptomator.presentation.util.FileUtil
import org.cryptomator.presentation.util.ResourceHelper
import org.cryptomator.util.SharedPreferencesHandler
import org.cryptomator.util.file.MimeTypeMap
import org.cryptomator.util.file.MimeTypes
@ -145,7 +144,7 @@ class PhotoContentJob : JobService() {
private const val PHOTOS_CONTENT_JOB = 23
init {
val builder = JobInfo.Builder(PHOTOS_CONTENT_JOB, ComponentName(ResourceHelper.getString(R.string.app_id), PhotoContentJob::class.java.name))
val builder = JobInfo.Builder(PHOTOS_CONTENT_JOB, ComponentName(BuildConfig.APPLICATION_ID, PhotoContentJob::class.java.name))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Images.Media.INTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))

View File

@ -62,6 +62,31 @@ class SettingsFragment : PreferenceFragmentCompat() {
true
}
private val cloudSettingsClickListener = Preference.OnPreferenceClickListener {
onCloudSettingsClicked()
true
}
private val biometricAuthSettingsClickListener = Preference.OnPreferenceClickListener {
onBiometricAuthSettingsClicked()
true
}
private val cryptomatorVariantsClickListener = Preference.OnPreferenceClickListener {
onCryptomatorVariantsClicked()
true
}
private val autoUploadChooseVaultClickListener = Preference.OnPreferenceClickListener {
onAutoUploadChooseVaultClicked()
true
}
private val licensesClickListener = Preference.OnPreferenceClickListener {
onLicensedClicked()
true
}
private val useAutoPhotoUploadChangedListener = Preference.OnPreferenceChangeListener { _, newValue ->
onUseAutoPhotoUploadChanged(TRUE == newValue)
true
@ -209,6 +234,11 @@ class SettingsFragment : PreferenceFragmentCompat() {
if (BuildConfig.FLAVOR == "apkstore") {
(findPreference(UPDATE_CHECK_ITEM_KEY) as Preference?)?.onPreferenceClickListener = updateCheckClickListener
}
(findPreference(SharedPreferencesHandler.CLOUD_SETTINGS) as Preference?)?.onPreferenceClickListener = cloudSettingsClickListener
(findPreference(SharedPreferencesHandler.BIOMETRIC_AUTHENTICATION) as Preference?)?.onPreferenceClickListener = biometricAuthSettingsClickListener
(findPreference(SharedPreferencesHandler.CRYPTOMATOR_VARIANTS) as Preference?)?.onPreferenceClickListener = cryptomatorVariantsClickListener
(findPreference(SharedPreferencesHandler.PHOTO_UPLOAD_VAULT) as Preference?)?.onPreferenceClickListener = autoUploadChooseVaultClickListener
(findPreference(SharedPreferencesHandler.LICENSES_ACTIVITY) as Preference?)?.onPreferenceClickListener = licensesClickListener
}
fun deactivateDebugMode() {
@ -234,6 +264,26 @@ class SettingsFragment : PreferenceFragmentCompat() {
activity().presenter().onCheckUpdateClicked()
}
private fun onCloudSettingsClicked() {
activity().presenter().onCloudSettingsClicked()
}
private fun onBiometricAuthSettingsClicked() {
activity().presenter().onBiometricAuthSettingsClicked()
}
private fun onCryptomatorVariantsClicked() {
activity().presenter().onCryptomatorVariantsClicked()
}
private fun onAutoUploadChooseVaultClicked() {
activity().presenter().onAutoUploadChooseVaultClicked()
}
private fun onLicensedClicked() {
activity().presenter().onLicensedClicked()
}
private fun onDebugModeChanged(enabled: Boolean) {
if (enabled) {
activity().showDialog(DebugModeDisclaimerDialog.newInstance())

View File

@ -287,6 +287,9 @@
<string name="screen_settings_keep_unlocked_while_editing_files">Keep unlocked</string>
<string name="screen_settings_keep_unlocked_while_editing_files_summary">Keep vaults unlocked while editing files</string>
<string name="screen_settings_cryptomator_variants_label" translatable="false">@string/screen_cryptomator_variants_title</string>
<string name="screen_settings_cryptomator_variants_summary" translatable="false">Show variants of this app</string>
<!-- ## screen: cloud settings -->
<string name="screen_cloud_settings_title" translatable="false">@string/screen_settings_cloud_settings_label</string>
<string name="screen_cloud_settings_onedrive_connections">OneDrive connections</string>

View File

@ -16,25 +16,13 @@
android:key="@string/screen_settings_section_general"
android:title="@string/screen_settings_section_general">
<androidx.preference.PreferenceScreen android:title="@string/screen_settings_cloud_settings_label">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="org.cryptomator.presentation.ui.activity.CloudSettingsActivity"
android:targetPackage="@string/app_id" />
</androidx.preference.PreferenceScreen>
<androidx.preference.PreferenceScreen
android:key="cloudSettings"
android:title="@string/screen_settings_cloud_settings_label" />
<androidx.preference.PreferenceScreen
android:key="biometricAuthentication"
android:title="@string/screen_settings_biometric_auth">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="org.cryptomator.presentation.ui.activity.BiometricAuthSettingsActivity"
android:targetPackage="@string/app_id" />
</androidx.preference.PreferenceScreen>
android:title="@string/screen_settings_biometric_auth" />
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="true"
@ -57,6 +45,11 @@
android:summary="%s"
android:title="@string/screen_settings_style_mode" />
<androidx.preference.PreferenceScreen
android:key="cryptomatorVariants"
android:summary="@string/screen_settings_cryptomator_variants_summary"
android:title="@string/screen_settings_cryptomator_variants_label" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/screen_settings_section_search">
@ -123,13 +116,7 @@
<androidx.preference.PreferenceScreen
android:key="photoUploadVault"
android:title="@string/screen_settings_section_auto_photo_upload_vault">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="org.cryptomator.presentation.ui.activity.AutoUploadChooseVaultActivity"
android:targetPackage="@string/app_id" />
</androidx.preference.PreferenceScreen>
android:title="@string/screen_settings_section_auto_photo_upload_vault" />
</PreferenceCategory>
@ -219,12 +206,9 @@
<PreferenceCategory android:title="@string/screen_settings_section_legal">
<androidx.preference.PreferenceScreen android:title="@string/screen_settings_licenses_label">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="org.cryptomator.presentation.ui.activity.LicensesActivity"
android:targetPackage="@string/app_id" />
</androidx.preference.PreferenceScreen>
<androidx.preference.PreferenceScreen
android:key="licensesActivity"
android:title="@string/screen_settings_licenses_label" />
<androidx.preference.PreferenceScreen android:title="@string/screen_settings_security_label">
<intent

View File

@ -290,6 +290,7 @@ constructor(context: Context) : SharedPreferences.OnSharedPreferenceChangeListen
private const val BACKGROUND_UNLOCK_PREPARATION = "backgroundUnlockPreparation"
private const val VAULTS_REMOVED_DURING_MIGRATION = "vaultsRemovedDuringMigration"
private const val VAULTS_REMOVED_DURING_MIGRATION_TYPE = "vaultsRemovedDuringMigrationType"
private const val LAST_UPDATE_CHECK = "lastUpdateCheck"
const val DEBUG_MODE = "debugMode"
const val DISABLE_APP_WHEN_OBSCURED = "disableAppWhenObscured"
const val SECURE_SCREEN = "secureScreen"
@ -304,7 +305,10 @@ constructor(context: Context) : SharedPreferences.OnSharedPreferenceChangeListen
const val LRU_CACHE_SIZE = "lruCacheSize"
const val MAIL = "mail"
const val UPDATE_INTERVAL = "updateInterval"
private const val LAST_UPDATE_CHECK = "lastUpdateCheck"
const val CLOUD_SETTINGS = "cloudSettings"
const val BIOMETRIC_AUTHENTICATION = "biometricAuthentication"
const val CRYPTOMATOR_VARIANTS = "cryptomatorVariants"
const val LICENSES_ACTIVITY = "licensesActivity"
}
private inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {