mirror of
https://github.com/Corewala/Buran
synced 2025-01-02 21:24:19 +00:00
Rearranged client cert section in settings
Also removed unnecessary "if true" statement
This commit is contained in:
parent
79056fe060
commit
b2ef138402
2 changed files with 64 additions and 64 deletions
|
@ -8,8 +8,6 @@ class Buran: Application() {
|
|||
const val DEFAULT_HOME_CAPSULE = "gemini://tlgs.one"
|
||||
const val DEFAULT_SEARCH_BASE = "gemini://tlgs.one/search?"
|
||||
|
||||
const val FEATURE_CLIENT_CERTS = true
|
||||
|
||||
const val PREF_KEY_CLIENT_CERT_URI = "client_cert_uri"
|
||||
const val PREF_KEY_CLIENT_CERT_HUMAN_READABLE = "client_cert_uri_human_readable"
|
||||
const val PREF_KEY_CLIENT_CERT_ACTIVE = "client_cert_active"
|
||||
|
|
|
@ -97,8 +97,8 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
|||
checkForUpdates.title = getString(R.string.check_for_updates)
|
||||
appCategory.addPreference(checkForUpdates)
|
||||
|
||||
//Home - Certificates - Updates
|
||||
buildClientCertificateSection(context, appCategory)
|
||||
//Certificates
|
||||
buildClientCertificateSection(context, screen)
|
||||
|
||||
//Appearance --------------------------------------------
|
||||
buildAppearanceSection(context, appCategory)
|
||||
|
@ -226,15 +226,18 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
|||
accessibilityCategory.addPreference(showLinkButtonsPreference)
|
||||
}
|
||||
|
||||
private fun buildClientCertificateSection(context: Context?, appCategory: PreferenceCategory) {
|
||||
if (Buran.FEATURE_CLIENT_CERTS) {
|
||||
private fun buildClientCertificateSection(context: Context?, screen: PreferenceScreen) {
|
||||
|
||||
val certificateCategory = PreferenceCategory(context)
|
||||
certificateCategory.key = "certificate_category"
|
||||
certificateCategory.title = getString(R.string.client_certificate)
|
||||
screen.addPreference(certificateCategory)
|
||||
|
||||
val aboutPref = Preference(context)
|
||||
aboutPref.key = "unused_pref"
|
||||
aboutPref.summary = getString(R.string.pkcs_notice)
|
||||
aboutPref.isPersistent = false
|
||||
aboutPref.isSelectable = false
|
||||
appCategory.addPreference(aboutPref)
|
||||
certificateCategory.addPreference(aboutPref)
|
||||
|
||||
clientCertPref = Preference(context)
|
||||
clientCertPref.title = getString(R.string.client_certificate)
|
||||
|
@ -262,7 +265,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
|||
true
|
||||
}
|
||||
|
||||
appCategory.addPreference(clientCertPref)
|
||||
certificateCategory.addPreference(clientCertPref)
|
||||
|
||||
|
||||
val clientCertPassword = EditTextPreference(context)
|
||||
|
@ -290,18 +293,17 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
|||
true//update the value
|
||||
}
|
||||
|
||||
appCategory.addPreference(clientCertPassword)
|
||||
certificateCategory.addPreference(clientCertPassword)
|
||||
|
||||
useClientCertPreference = SwitchPreferenceCompat(context)
|
||||
useClientCertPreference.key = Buran.PREF_KEY_CLIENT_CERT_ACTIVE
|
||||
useClientCertPreference.title = getString(R.string.use_client_certificate)
|
||||
appCategory.addPreference(useClientCertPreference)
|
||||
certificateCategory.addPreference(useClientCertPreference)
|
||||
|
||||
if (!hasCert) {
|
||||
useClientCertPreference.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDots(value: String): String {
|
||||
val sb = StringBuilder()
|
||||
|
|
Loading…
Reference in a new issue