diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-01-23 23:25:31 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 17:55:31 +0000 |
commit | 98010c7ff9f6fd4cf1e71d2c0ead30311bfd2d2c (patch) | |
tree | 235311242874f8e9ec5658b1df624de7a1288e1a | |
parent | 81c27218835f9a339f750415ba4c90fa18731f9b (diff) |
LaunchActivity: ensure V2 backend setting is respected (#1677)
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/ui/main/LaunchActivity.kt | 18 |
1 files changed, 17 insertions, 1 deletions
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) |