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