fix selected auth indication

This commit is contained in:
yggverse 2024-12-05 08:29:32 +02:00
parent 78b7c67038
commit 42d309d1de

View File

@ -52,13 +52,26 @@ impl Gemini {
"Use existing certificate", "Use existing certificate",
); );
// Collect additional options from database // Collect identities as options from profile database
// * memory cache synced also and could be faster @TODO
let mut i = 2; // start from 3'th let mut i = 2; // start from 3'th
match profile.identity.gemini.database.records() { match profile.identity.gemini.database.records() {
Ok(identities) => { Ok(identities) => {
for identity in identities { for identity in identities {
i += 1; i += 1;
// Is selected?
if profile
.identity
.gemini
.auth
.memory
.match_scope(auth_url.as_str())
.is_some_and(|auth| auth.profile_identity_gemini_id == identity.id)
{
selected = i;
}
// Get certificate details // Get certificate details
let certificate = match TlsCertificate::from_pem(&identity.pem) { let certificate = match TlsCertificate::from_pem(&identity.pem) {
Ok(certificate) => certificate, Ok(certificate) => certificate,
@ -93,22 +106,6 @@ impl Gemini {
.count(), .count(),
), ),
); );
// Is selected?
if profile
.identity
.gemini
.auth
.database
.records_scope(Some(auth_url.as_str()))
.unwrap()
.iter()
.filter(|this| this.profile_identity_gemini_id == identity.id)
.count()
> 0
{
selected = i;
}
} }
// Select list item // Select list item