Merge pull request #719 from mkljczk/anonymous-fix

Only display 'Connect anonymously' when available
This commit is contained in:
Jeremy Soller 2025-01-27 11:56:33 -07:00 • committed by GitHub
commit fbaf94fc94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3778,7 +3778,8 @@ impl Application for App {
let mut parts = auth.message.splitn(2, '\n'); let mut parts = auth.message.splitn(2, '\n');
let title = parts.next().unwrap_or_default(); let title = parts.next().unwrap_or_default();
let body = parts.next().unwrap_or_default(); let body = parts.next().unwrap_or_default();
widget::dialog()
let mut widget = widget::dialog()
.title(title) .title(title)
.body(body) .body(body)
.control(widget::column::with_children(controls).spacing(space_s)) .control(widget::column::with_children(controls).spacing(space_s))
@ -3787,8 +3788,11 @@ impl Application for App {
) )
.secondary_action( .secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel), widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
) );
.tertiary_action(widget::button::text(fl!("connect-anonymously")).on_press(
if let Some(_anonymous) = &auth.anonymous_opt {
widget = widget.tertiary_action(
widget::button::text(fl!("connect-anonymously")).on_press(
Message::DialogUpdateComplete(DialogPage::NetworkAuth { Message::DialogUpdateComplete(DialogPage::NetworkAuth {
mounter_key: *mounter_key, mounter_key: *mounter_key,
uri: uri.clone(), uri: uri.clone(),
@ -3798,7 +3802,11 @@ impl Application for App {
}, },
auth_tx: auth_tx.clone(), auth_tx: auth_tx.clone(),
}), }),
)) ),
);
}
widget
} }
DialogPage::NetworkError { DialogPage::NetworkError {
mounter_key: _, mounter_key: _,