From 7a64c393f29f3749692c933237511caa50f01cde Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 9 Jan 2026 12:46:03 -0500 Subject: [PATCH] Manual fixes --- .../ntfy/ui/ClientCertificateFragment.kt | 6 ++-- .../ntfy/ui/TrustedCertificateFragment.kt | 4 ++- .../fragment_client_certificate_dialog.xml | 30 ++++++++++++++----- .../fragment_trusted_certificate_dialog.xml | 6 ++-- app/src/main/res/values/strings.xml | 8 ++--- .../metadata/android/en-US/changelog/NEXT.txt | 2 +- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/ClientCertificateFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/ClientCertificateFragment.kt index 812d120d..f2c08041 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/ClientCertificateFragment.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/ClientCertificateFragment.kt @@ -59,6 +59,7 @@ class ClientCertificateFragment : DialogFragment() { private lateinit var passwordText: TextInputEditText private lateinit var baseUrlLayout: TextInputLayout private lateinit var baseUrlText: TextInputEditText + private lateinit var errorLayout: LinearLayout private lateinit var errorText: TextView // Page 2 views @@ -159,6 +160,7 @@ class ClientCertificateFragment : DialogFragment() { passwordText = view.findViewById(R.id.client_certificate_password_text) baseUrlLayout = view.findViewById(R.id.client_certificate_base_url_layout) baseUrlText = view.findViewById(R.id.client_certificate_base_url_text) + errorLayout = view.findViewById(R.id.client_certificate_error_layout) errorText = view.findViewById(R.id.client_certificate_error_text) // Page 2 views @@ -273,7 +275,7 @@ class ClientCertificateFragment : DialogFragment() { extractedCert = keyStore.getCertificate(alias) as X509Certificate baseUrl = url password = pwd - errorText.isVisible = false + errorLayout.isVisible = false showPage2() } catch (e: Exception) { showError(getString(R.string.client_certificate_dialog_error_wrong_password)) @@ -335,7 +337,7 @@ class ClientCertificateFragment : DialogFragment() { private fun showError(message: String) { errorText.text = message - errorText.isVisible = true + errorLayout.isVisible = true } enum class Mode { diff --git a/app/src/main/java/io/heckel/ntfy/ui/TrustedCertificateFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/TrustedCertificateFragment.kt index ac2bdeec..9218d76d 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/TrustedCertificateFragment.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/TrustedCertificateFragment.kt @@ -358,7 +358,9 @@ class TrustedCertificateFragment : DialogFragment() { val pem = CertUtil.encodeCertificateToPem(certificate) repository.addTrustedCertificate(url, fingerprint, pem) withContext(Dispatchers.Main) { - Toast.makeText(context, R.string.trusted_certificate_dialog_added_toast, Toast.LENGTH_SHORT).show() + if (mode != Mode.UNKNOWN) { + Toast.makeText(context, R.string.trusted_certificate_dialog_added_toast, Toast.LENGTH_SHORT).show() + } listener?.onCertificateTrusted(certificate) dismiss() } diff --git a/app/src/main/res/layout/fragment_client_certificate_dialog.xml b/app/src/main/res/layout/fragment_client_certificate_dialog.xml index 9f7bfe5d..30fa4b5d 100644 --- a/app/src/main/res/layout/fragment_client_certificate_dialog.xml +++ b/app/src/main/res/layout/fragment_client_certificate_dialog.xml @@ -94,16 +94,32 @@ - + android:visibility="gone"> + + + + + + diff --git a/app/src/main/res/layout/fragment_trusted_certificate_dialog.xml b/app/src/main/res/layout/fragment_trusted_certificate_dialog.xml index f4e7088f..f688aead 100644 --- a/app/src/main/res/layout/fragment_trusted_certificate_dialog.xml +++ b/app/src/main/res/layout/fragment_trusted_certificate_dialog.xml @@ -64,14 +64,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:hint="@string/trusted_certificate_dialog_base_url_hint"> + android:hint="@string/trusted_certificate_dialog_base_url_hint" + app:placeholderText="@string/trusted_certificate_dialog_base_url_placeholder"> + android:inputType="textUri" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 674fc1d6..15fa523d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -431,7 +431,7 @@ %1$s, expires %2$s %1$s, expired Add a trusted certificate - Import a certificate into the trust store (PEM). When connecting to the specified ntfy server, this certificate will be trusted. + Import a certificate into the trust store (PEM). When connecting to the ntfy server, this certificate will be trusted. Client certificates (mTLS) Client certificate, issued by %1$s\nExpires %2$s, used by %3$s Client certificate, issued by %1$s\nExpired, used by %2$s @@ -505,11 +505,11 @@ Add trusted certificate The server\'s certificate could not be verified. Review the details below before trusting. Your connection is not private - Attackers might be trying to steal your information. You should not proceed unless you know why this certificate is not trusted. + The server certificate is not trusted. Attackers might be trying to steal your information. Do not proceed unless you know why this certificate is not trusted. You\'ve selected a certificate file. Review the details below before adding it to your trusted certificates. Enter the service URL that this certificate should be pinned to. The certificate will only be trusted for this URL. Service URL - https://ntfy.example.com + e.g. https://ntfy.example.com Service URL Subject Issuer @@ -529,7 +529,7 @@ Client certificate Add client certificate Enter the service URL this certificate should be used for, and the password for the PKCS#12 file. - Review the certificate details and save to add this client certificate. + Review the certificate details and save to add this client certificate. This certificate will be used to authenticate with the server. Password Service URL e.g. https://ntfy.example.com diff --git a/fastlane/metadata/android/en-US/changelog/NEXT.txt b/fastlane/metadata/android/en-US/changelog/NEXT.txt index 9de1a68d..5bbf0b03 100644 --- a/fastlane/metadata/android/en-US/changelog/NEXT.txt +++ b/fastlane/metadata/android/en-US/changelog/NEXT.txt @@ -1,5 +1,5 @@ Features: -* Support for self-signed certs, custom CAs and client certs for mTLS (#215, #530, ntfy-android#149) +* Support for self-signed certs and client certs for mTLS (#215, #530, ntfy-android#149) Maintenance + bug fixes: * Use server-specific user for attachment downloads (#1529, thanks to @ManInDark for reporting)