Make Privacy settings interactive (accept policy + fiat toggle)
Tap to cycle the incoming-payment accept policy (Anyone/Contacts/Ask) and to toggle the fiat USD preview, completing the user-control story for settings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -581,7 +581,19 @@ impl GoblinWalletView {
|
||||
.show(ui, |ui| {
|
||||
settings_group(ui, "Privacy", |ui| {
|
||||
settings_row(ui, "Tor routing", "All payments routed over Tor");
|
||||
settings_row(ui, "Auto-accept", accept_policy_label(wallet));
|
||||
// Tap to cycle the incoming-payment accept policy.
|
||||
if settings_row_btn(ui, "Auto-accept", accept_policy_label(wallet)) {
|
||||
cycle_accept_policy(wallet);
|
||||
}
|
||||
// Tap to toggle the fiat (USD) preview.
|
||||
let fiat = if crate::AppConfig::fiat_preview() {
|
||||
"On"
|
||||
} else {
|
||||
"Off"
|
||||
};
|
||||
if settings_row_btn(ui, "Fiat preview (USD)", fiat) {
|
||||
crate::AppConfig::toggle_fiat_preview();
|
||||
}
|
||||
});
|
||||
ui.add_space(16.0);
|
||||
|
||||
@@ -921,6 +933,19 @@ fn accept_policy_label(wallet: &Wallet) -> &'static str {
|
||||
.unwrap_or("Anyone")
|
||||
}
|
||||
|
||||
/// Cycle the incoming-payment accept policy Anyone → Contacts → Ask → Anyone.
|
||||
fn cycle_accept_policy(wallet: &Wallet) {
|
||||
use crate::nostr::config::AcceptPolicy;
|
||||
if let Some(s) = wallet.nostr_service() {
|
||||
let next = match s.config.read().accept_from() {
|
||||
AcceptPolicy::Everyone => AcceptPolicy::Contacts,
|
||||
AcceptPolicy::Contacts => AcceptPolicy::Ask,
|
||||
AcceptPolicy::Ask => AcceptPolicy::Everyone,
|
||||
};
|
||||
s.config.write().set_accept_from(next);
|
||||
}
|
||||
}
|
||||
|
||||
fn relay_summary(wallet: &Wallet) -> String {
|
||||
wallet
|
||||
.nostr_service()
|
||||
|
||||
Reference in New Issue
Block a user