IdentityDialog: show and edit URL paths

This commit is contained in:
dece 2022-02-04 15:28:57 +01:00
parent ea6f54cd73
commit 02ba3a1401
4 changed files with 30 additions and 3 deletions

View file

@ -72,7 +72,6 @@ object Identities {
private fun deleteClientCert(alias: String) {
val keyStore = KeyStore.getInstance("AndroidKeyStore").also { it.load(null) }
Log.i(TAG, keyStore.aliases().toList().joinToString { it })
if (keyStore.containsAlias(alias)) {
keyStore.deleteEntry(alias)
Log.i(TAG, "deleteClientCert: deleted entry with alias \"$alias\"")

View file

@ -19,12 +19,14 @@ class IdentityDialog(
fun show() {
binding = DialogIdentityBinding.inflate(LayoutInflater.from(context))
binding.labelInput.setText(identity.name.orEmpty())
binding.urlInput.setText(identity.urls.getOrNull(0).orEmpty())
binding.aliasText.text = identity.key
AlertDialog.Builder(context)
.setTitle(R.string.edit_identity)
.setView(binding.root)
.setPositiveButton(android.R.string.ok) { _, _ ->
identity.name = binding.labelInput.text.toString()
identity.urls = arrayListOf(binding.urlInput.text.toString())
listener.onSaveIdentity(identity)
}
.create()

View file

@ -3,12 +3,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/identity_name" />
android:text="@string/identity_name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<EditText
android:id="@+id/labelInput"
@ -18,10 +20,33 @@
android:importantForAutofill="no"
android:inputType="text" />
<Space
android:layout_width="wrap_content"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/identity_alias_title" />
android:text="@string/identity_usages"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<EditText
android:id="@+id/urlInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/url"
android:inputType="textUri"
android:importantForAutofill="no" />
<Space
android:layout_width="wrap_content"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/identity_alias_title"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="@+id/aliasText"

View file

@ -44,5 +44,6 @@
<string name="confirm">Confirm</string>
<string name="confirm_identity_delete">Are you sure you want to delete this identity? The client certificate cannot be retrieved afterwards.</string>
<string name="edit">Edit</string>
<string name="identity_usages">Active URL paths</string>
</resources>