diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-03-21 14:03:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-21 14:03:51 +0530 |
commit | db4683e0d60a31d87c41050445c00b0e48b77ae1 (patch) | |
tree | 5f6ec3f324483eac3872384102e13fbd368282e1 /app/src/main/java | |
parent | 74122ccbfcf5da436e2d127a05f4530b39b4f431 (diff) |
Inform users that GPG key selection is mandatory (#1355)
* Inform users that GPG key selection is mandatory
Fixes #1342
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* changelog: sync for 1.13.4 release
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* changelog: add GPG key selection improvements
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt | 3 | ||||
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt index 1e9066b0..ea950a5e 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt @@ -24,6 +24,7 @@ import com.github.michaelbull.result.onFailure import com.github.michaelbull.result.onSuccess import com.github.michaelbull.result.runCatching import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.snackbar.Snackbar import com.google.zxing.integration.android.IntentIntegrator import com.google.zxing.integration.android.IntentIntegrator.QR_CODE import dev.msfjarvis.aps.R @@ -117,6 +118,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB .onSuccess { encrypt(encryptionIntent) } } } + } else { + snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG) } } diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt b/app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt index 44a6d6c5..3d7a66b3 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt @@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.edit import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope +import com.google.android.material.snackbar.Snackbar import dev.msfjarvis.aps.R import dev.msfjarvis.aps.data.repo.PasswordRepository import dev.msfjarvis.aps.databinding.FragmentKeySelectionBinding @@ -20,6 +21,7 @@ import dev.msfjarvis.aps.ui.crypto.GetKeyIdsActivity import dev.msfjarvis.aps.util.extensions.commitChange import dev.msfjarvis.aps.util.extensions.finish import dev.msfjarvis.aps.util.extensions.sharedPrefs +import dev.msfjarvis.aps.util.extensions.snackbar import dev.msfjarvis.aps.util.extensions.viewBinding import dev.msfjarvis.aps.util.settings.PreferenceKeys import java.io.File @@ -46,10 +48,11 @@ class KeySelectionFragment : Fragment(R.layout.fragment_key_selection) { requireActivity().commitChange(getString(R.string.git_commit_gpg_id, getString(R.string.app_name))) } } + finish() } else { - throw IllegalStateException("Failed to initialize repository state.") + requireActivity() + .snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG) } - finish() } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |