mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Setting to enable/disable zap receipts (even though zaps not impl yet, we were subscribing to them)
This commit is contained in:
parent
c14dbac8b2
commit
ba51f2d280
@ -31,6 +31,7 @@ pub const DEFAULT_CHECK_NIP05: bool = true;
|
|||||||
pub const DEFAULT_DIRECT_MESSAGES: bool = true;
|
pub const DEFAULT_DIRECT_MESSAGES: bool = true;
|
||||||
pub const DEFAULT_AUTOMATICALLY_FETCH_METADATA: bool = true;
|
pub const DEFAULT_AUTOMATICALLY_FETCH_METADATA: bool = true;
|
||||||
pub const DEFAULT_HIGHLIGHT_UNREAD_EVENTS: bool = true;
|
pub const DEFAULT_HIGHLIGHT_UNREAD_EVENTS: bool = true;
|
||||||
|
pub const DEFAULT_ENABLE_ZAP_RECEIPTS: bool = false;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
@ -59,6 +60,7 @@ pub struct Settings {
|
|||||||
pub automatically_fetch_metadata: bool,
|
pub automatically_fetch_metadata: bool,
|
||||||
pub delegatee_tag: String,
|
pub delegatee_tag: String,
|
||||||
pub highlight_unread_events: bool,
|
pub highlight_unread_events: bool,
|
||||||
|
pub enable_zap_receipts: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Settings {
|
impl Default for Settings {
|
||||||
@ -89,6 +91,7 @@ impl Default for Settings {
|
|||||||
automatically_fetch_metadata: DEFAULT_AUTOMATICALLY_FETCH_METADATA,
|
automatically_fetch_metadata: DEFAULT_AUTOMATICALLY_FETCH_METADATA,
|
||||||
delegatee_tag: String::new(),
|
delegatee_tag: String::new(),
|
||||||
highlight_unread_events: DEFAULT_HIGHLIGHT_UNREAD_EVENTS,
|
highlight_unread_events: DEFAULT_HIGHLIGHT_UNREAD_EVENTS,
|
||||||
|
enable_zap_receipts: DEFAULT_ENABLE_ZAP_RECEIPTS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,6 +182,7 @@ impl Settings {
|
|||||||
"highlight_unread_events" => {
|
"highlight_unread_events" => {
|
||||||
settings.highlight_unread_events = numstr_to_bool(row.1)
|
settings.highlight_unread_events = numstr_to_bool(row.1)
|
||||||
}
|
}
|
||||||
|
"enable_zap_receipts" => settings.enable_zap_receipts = numstr_to_bool(row.1),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +227,8 @@ impl Settings {
|
|||||||
('direct_messages', ?),\
|
('direct_messages', ?),\
|
||||||
('automatically_fetch_metadata', ?),\
|
('automatically_fetch_metadata', ?),\
|
||||||
('delegatee_tag', ?),\
|
('delegatee_tag', ?),\
|
||||||
('highlight_unread_events', ?)",
|
('highlight_unread_events', ?),\
|
||||||
|
('enable_zap_receipts', ?)",
|
||||||
)?;
|
)?;
|
||||||
stmt.execute(params![
|
stmt.execute(params![
|
||||||
self.feed_chunk,
|
self.feed_chunk,
|
||||||
@ -250,6 +255,7 @@ impl Settings {
|
|||||||
bool_to_numstr(self.automatically_fetch_metadata),
|
bool_to_numstr(self.automatically_fetch_metadata),
|
||||||
self.delegatee_tag,
|
self.delegatee_tag,
|
||||||
bool_to_numstr(self.highlight_unread_events),
|
bool_to_numstr(self.highlight_unread_events),
|
||||||
|
bool_to_numstr(self.enable_zap_receipts),
|
||||||
])?;
|
])?;
|
||||||
|
|
||||||
// Settings which are Options should not even exist when None. We don't accept null valued
|
// Settings which are Options should not even exist when None. We don't accept null valued
|
||||||
@ -287,6 +293,7 @@ impl Settings {
|
|||||||
&& ((*k != EventKind::Repost) || self.reposts)
|
&& ((*k != EventKind::Repost) || self.reposts)
|
||||||
&& ((*k != EventKind::LongFormContent) || self.show_long_form)
|
&& ((*k != EventKind::LongFormContent) || self.show_long_form)
|
||||||
&& ((*k != EventKind::EncryptedDirectMessage) || self.direct_messages)
|
&& ((*k != EventKind::EncryptedDirectMessage) || self.direct_messages)
|
||||||
|
&& ((*k != EventKind::Zap) || self.enable_zap_receipts)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,11 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
|
|||||||
"Enable reactions (show and react)",
|
"Enable reactions (show and react)",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ui.checkbox(
|
||||||
|
&mut app.settings.enable_zap_receipts,
|
||||||
|
"Enable zap receipts",
|
||||||
|
);
|
||||||
|
|
||||||
ui.checkbox(
|
ui.checkbox(
|
||||||
&mut app.settings.reposts,
|
&mut app.settings.reposts,
|
||||||
"Enable reposts (show)",
|
"Enable reposts (show)",
|
||||||
|
Loading…
Reference in New Issue
Block a user