aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-03-21 14:03:51 +0530
committerGitHub <noreply@github.com>2021-03-21 14:03:51 +0530
commitdb4683e0d60a31d87c41050445c00b0e48b77ae1 (patch)
tree5f6ec3f324483eac3872384102e13fbd368282e1 /app/src/main
parent74122ccbfcf5da436e2d127a05f4530b39b4f431 (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')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/onboarding/fragments/KeySelectionFragment.kt7
-rw-r--r--app/src/main/res/values/strings.xml1
3 files changed, 9 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?) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f71ddb75..b9a371d8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -402,5 +402,6 @@
<string name="otp_import_manual_entry">Enter manually</string>
<string name="otp_import_manual_hint_secret">Secret</string>
<string name="otp_import_manual_hint_account">Account</string>
+ <string name="gpg_key_select_mandatory">Selecting a GPG key is necessary to proceed</string>
</resources>