IdentityDialog: show and edit URL paths
This commit is contained in:
parent
ea6f54cd73
commit
02ba3a1401
|
@ -72,7 +72,6 @@ object Identities {
|
||||||
|
|
||||||
private fun deleteClientCert(alias: String) {
|
private fun deleteClientCert(alias: String) {
|
||||||
val keyStore = KeyStore.getInstance("AndroidKeyStore").also { it.load(null) }
|
val keyStore = KeyStore.getInstance("AndroidKeyStore").also { it.load(null) }
|
||||||
Log.i(TAG, keyStore.aliases().toList().joinToString { it })
|
|
||||||
if (keyStore.containsAlias(alias)) {
|
if (keyStore.containsAlias(alias)) {
|
||||||
keyStore.deleteEntry(alias)
|
keyStore.deleteEntry(alias)
|
||||||
Log.i(TAG, "deleteClientCert: deleted entry with alias \"$alias\"")
|
Log.i(TAG, "deleteClientCert: deleted entry with alias \"$alias\"")
|
||||||
|
|
|
@ -19,12 +19,14 @@ class IdentityDialog(
|
||||||
fun show() {
|
fun show() {
|
||||||
binding = DialogIdentityBinding.inflate(LayoutInflater.from(context))
|
binding = DialogIdentityBinding.inflate(LayoutInflater.from(context))
|
||||||
binding.labelInput.setText(identity.name.orEmpty())
|
binding.labelInput.setText(identity.name.orEmpty())
|
||||||
|
binding.urlInput.setText(identity.urls.getOrNull(0).orEmpty())
|
||||||
binding.aliasText.text = identity.key
|
binding.aliasText.text = identity.key
|
||||||
AlertDialog.Builder(context)
|
AlertDialog.Builder(context)
|
||||||
.setTitle(R.string.edit_identity)
|
.setTitle(R.string.edit_identity)
|
||||||
.setView(binding.root)
|
.setView(binding.root)
|
||||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||||
identity.name = binding.labelInput.text.toString()
|
identity.name = binding.labelInput.text.toString()
|
||||||
|
identity.urls = arrayListOf(binding.urlInput.text.toString())
|
||||||
listener.onSaveIdentity(identity)
|
listener.onSaveIdentity(identity)
|
||||||
}
|
}
|
||||||
.create()
|
.create()
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/identity_name" />
|
android:text="@string/identity_name"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/labelInput"
|
android:id="@+id/labelInput"
|
||||||
|
@ -18,10 +20,33 @@
|
||||||
android:importantForAutofill="no"
|
android:importantForAutofill="no"
|
||||||
android:inputType="text" />
|
android:inputType="text" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="8dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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
|
<TextView
|
||||||
android:id="@+id/aliasText"
|
android:id="@+id/aliasText"
|
||||||
|
|
|
@ -44,5 +44,6 @@
|
||||||
<string name="confirm">Confirm</string>
|
<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="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="edit">Edit</string>
|
||||||
|
<string name="identity_usages">Active URL paths</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Reference in a new issue