summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-03-21 14:03:51 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-04-16 15:42:07 +0530
commitc60a2534d5f63d448f9c26d6ac8a933a74249d84 (patch)
tree31976a7ab2940e3349df8ffa7cf056346f906769 /app/src/main/java
parentc292ba2e590a81ce3b0b6bd0bbe29ff6aad8ce34 (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: 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/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ui/onboarding/fragments/KeySelectionFragment.kt7
2 files changed, 8 insertions, 2 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
index baabfbf5..e4dbb7d9 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/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 com.zeapo.pwdstore.R
@@ -114,6 +115,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
}
}
}
+ } else {
+ snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG)
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/ui/onboarding/fragments/KeySelectionFragment.kt b/app/src/main/java/com/zeapo/pwdstore/ui/onboarding/fragments/KeySelectionFragment.kt
index 3dc03954..9abfe655 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ui/onboarding/fragments/KeySelectionFragment.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/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 com.zeapo.pwdstore.R
import com.zeapo.pwdstore.crypto.GetKeyIdsActivity
import com.zeapo.pwdstore.databinding.FragmentKeySelectionBinding
@@ -21,6 +22,7 @@ import com.zeapo.pwdstore.utils.PreferenceKeys
import com.zeapo.pwdstore.utils.commitChange
import com.zeapo.pwdstore.utils.finish
import com.zeapo.pwdstore.utils.sharedPrefs
+import com.zeapo.pwdstore.utils.snackbar
import com.zeapo.pwdstore.utils.viewBinding
import java.io.File
import kotlinx.coroutines.Dispatchers
@@ -48,10 +50,11 @@ class KeySelectionFragment : Fragment(R.layout.fragment_key_selection) {
))
}
}
+ 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?) {