GitLab's annual major release is around the corner. Along with a lot of new and exciting features, there will be a few breaking changes. Learn more here.

Commit a7883ee4 authored by Patrick Lang's avatar Patrick Lang
Browse files

Create an install intent if no certificates were found

parent ae90fb1c
Pipeline #214881233 passed with stage
in 8 minutes and 15 seconds
......@@ -24,6 +24,7 @@ import
import at.bitfire.davdroid.R
import at.bitfire.davdroid.databinding.LoginCredentialsFragmentBinding
import at.bitfire.davdroid.model.Credentials
......@@ -45,12 +46,28 @@ class DefaultLoginCredentialsFragment : Fragment() {
v.selectCertificate.setOnClickListener {
KeyChain.choosePrivateKeyAlias(requireActivity(), { alias ->
Handler(Looper.getMainLooper()).post {
// Show a dialog to add a certificate if no certificate was found
// API Versions < 29 still handle this automatically
if (alias == null && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
context?.let {
.setTitle("No certificate found")
.setMessage("You can add a certificate from your local file storage. Would you like to add a certificate? Please add certificate again once your certificate is installed.")
.setNeutralButton("Cancel") { dialog, which ->
// Just close the Alert on neutral button press
.setPositiveButton("Add Certificate") { dialog, which ->
// Respond to positive button press
model.certificateAlias.value = alias
}, null, null, null, -1, model.certificateAlias.value)
if (model.certificateAlias.value == null)
Toast.makeText(activity,"No Certificates found",Toast.LENGTH_LONG).show();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment