mirror of https://github.com/Corewala/Buran
Certificate button in overflow menu works better
Also the client cert icon isn't broken and doesn't cause the address bar to do weird scaling stuff anymore
This commit is contained in:
parent
b2f10454db
commit
506976b25e
|
@ -257,16 +257,24 @@ class GemActivity : AppCompatActivity() {
|
|||
inSearch = true
|
||||
}
|
||||
R.id.overflow_menu_sign -> {
|
||||
if(prefs.getBoolean("use_biometrics", false) and certPassword.isNullOrEmpty()){
|
||||
biometricSecureRequest(binding.addressEdit.text.toString())
|
||||
}else{
|
||||
if(certPassword.isNullOrEmpty()){
|
||||
certPassword = prefs.getString(
|
||||
Buran.PREF_KEY_CLIENT_CERT_PASSWORD,
|
||||
null
|
||||
)
|
||||
if(!prefs.getString(Buran.PREF_KEY_CLIENT_CERT_URI, null).isNullOrEmpty()) {
|
||||
if (prefs.getBoolean("use_biometrics", false) and certPassword.isNullOrEmpty()) {
|
||||
biometricSecureRequest(binding.addressEdit.text.toString())
|
||||
}else if(certPassword.isNullOrEmpty()){
|
||||
if (certPassword.isNullOrEmpty()) {
|
||||
certPassword = prefs.getString(
|
||||
Buran.PREF_KEY_CLIENT_CERT_PASSWORD,
|
||||
null
|
||||
)
|
||||
}
|
||||
refresh()
|
||||
}else{
|
||||
certPassword = null
|
||||
refresh()
|
||||
updateClientCertIcon()
|
||||
}
|
||||
gemRequest(binding.addressEdit.text.toString())
|
||||
}else{
|
||||
Snackbar.make(binding.root, getString(R.string.no_certificate), Snackbar.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,22 +365,6 @@ class GemActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
when {
|
||||
!prefs.getString(
|
||||
Buran.PREF_KEY_CLIENT_CERT_URI,
|
||||
null
|
||||
).isNullOrEmpty() -> {
|
||||
binding.addressEdit.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.vector_client_cert,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
binding.addressEdit.compoundDrawablePadding = 6.toPx().toInt()
|
||||
}
|
||||
//else -> hideClientCertShield()
|
||||
}
|
||||
|
||||
val showInlineIcons = prefs.getBoolean(
|
||||
"show_inline_icons",
|
||||
true
|
||||
|
@ -397,8 +389,27 @@ class GemActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun hideClientCertShield(){
|
||||
binding.addressEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
private fun updateClientCertIcon(){
|
||||
if (!prefs.getString(
|
||||
Buran.PREF_KEY_CLIENT_CERT_URI,
|
||||
null
|
||||
).isNullOrEmpty()){
|
||||
if(certPassword.isNullOrEmpty()){
|
||||
binding.addressEdit.setCompoundDrawablesWithIntrinsicBounds(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}else{
|
||||
binding.addressEdit.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.vector_client_cert,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleState(state: GemState) {
|
||||
|
@ -450,6 +461,7 @@ class GemActivity : AppCompatActivity() {
|
|||
)
|
||||
}
|
||||
gemRequest(state.uri.toString())
|
||||
updateClientCertIcon()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(getString(R.string.cancel).toUpperCase()) { _, _ -> }
|
||||
|
@ -468,7 +480,8 @@ class GemActivity : AppCompatActivity() {
|
|||
showAlert("${GeminiResponse.getCodeString(state.header.code)}:\n\n${state.header.meta}")
|
||||
}
|
||||
is GemState.ClientCertError -> {
|
||||
//hideClientCertShield()
|
||||
certPassword = null
|
||||
updateClientCertIcon()
|
||||
showAlert("${GeminiResponse.getCodeString(state.header.code)}:\n\n${state.header.meta}")
|
||||
}
|
||||
is GemState.ResponseGemtext -> renderGemtext(state)
|
||||
|
@ -575,6 +588,7 @@ class GemActivity : AppCompatActivity() {
|
|||
|
||||
certPassword = biometricManager.decryptData(ciphertext, result.cryptoObject?.cipher!!)
|
||||
gemRequest(address)
|
||||
updateClientCertIcon()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
|
|
|
@ -73,7 +73,8 @@
|
|||
<string name="confirm_your_identity">Confirmez votre identité</string>
|
||||
<string name="use_biometric_unlock">Utilisez vos informations biométriques pour continuer</string>
|
||||
<string name="biometric_cert_verification">Certificat Client biométrique</string>
|
||||
<string name="sign">Certifier</string>
|
||||
<string name="sign">Certificat</string>
|
||||
<string name="no_certificate">Aucun Certificat Client sélectionné</string>
|
||||
<string name="set_home_capsule">Choisir comme capsule d\'accueil</string>
|
||||
<string name="check_for_updates">Rechercher des nouvelles versions</string>
|
||||
<string name="new_version_available">Nouvelle version disponible</string>
|
||||
|
|
|
@ -73,7 +73,8 @@
|
|||
<string name="confirm_your_identity">Confirm your identity</string>
|
||||
<string name="use_biometric_unlock">Verify your biometric credentials to continue</string>
|
||||
<string name="biometric_cert_verification">Client Certificate biometrics</string>
|
||||
<string name="sign">Sign</string>
|
||||
<string name="sign">Certificate</string>
|
||||
<string name="no_certificate">No Client Certificate selected</string>
|
||||
<string name="set_home_capsule">Set home capsule</string>
|
||||
<string name="check_for_updates">Check for updates</string>
|
||||
<string name="new_version_available">New version available</string>
|
||||
|
|
Loading…
Reference in New Issue