From 98010c7ff9f6fd4cf1e71d2c0ead30311bfd2d2c Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 23 Jan 2022 23:25:31 +0530 Subject: [PATCH] LaunchActivity: ensure V2 backend setting is respected (#1677) --- .../msfjarvis/aps/ui/main/LaunchActivity.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/main/LaunchActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/main/LaunchActivity.kt index b5f7a593..a918a076 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/main/LaunchActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/main/LaunchActivity.kt @@ -10,16 +10,24 @@ import android.os.Handler import android.os.Looper import androidx.appcompat.app.AppCompatActivity import androidx.core.content.edit +import dagger.hilt.android.AndroidEntryPoint import dev.msfjarvis.aps.ui.crypto.BasePgpActivity import dev.msfjarvis.aps.ui.crypto.DecryptActivity +import dev.msfjarvis.aps.ui.crypto.DecryptActivityV2 import dev.msfjarvis.aps.ui.passwords.PasswordStore import dev.msfjarvis.aps.util.auth.BiometricAuthenticator import dev.msfjarvis.aps.util.auth.BiometricAuthenticator.Result import dev.msfjarvis.aps.util.extensions.sharedPrefs +import dev.msfjarvis.aps.util.features.Feature +import dev.msfjarvis.aps.util.features.Features import dev.msfjarvis.aps.util.settings.PreferenceKeys +import javax.inject.Inject +@AndroidEntryPoint class LaunchActivity : AppCompatActivity() { + @Inject lateinit var features: Features + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val prefs = sharedPrefs @@ -44,10 +52,18 @@ class LaunchActivity : AppCompatActivity() { } } + private fun getDecryptIntent(): Intent { + return if (features.isEnabled(Feature.EnablePGPainlessBackend)) { + Intent(this, DecryptActivityV2::class.java) + } else { + Intent(this, DecryptActivity::class.java) + } + } + private fun startTargetActivity(noAuth: Boolean) { val intentToStart = if (intent.action == ACTION_DECRYPT_PASS) - Intent(this, DecryptActivity::class.java).apply { + getDecryptIntent().apply { putExtra( BasePgpActivity.EXTRA_FILE_PATH, intent.getStringExtra(BasePgpActivity.EXTRA_FILE_PATH)