mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-16 18:23:50 +00:00
cargo clippy
This commit is contained in:
parent
e2c07dddf8
commit
71db828407
@ -3,7 +3,6 @@ mod content;
|
||||
use std::cell::RefCell;
|
||||
use std::ops::Add;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::notedata::{EncryptionType, NoteData, RepostType};
|
||||
|
||||
@ -272,11 +271,7 @@ pub fn render_note_inner(
|
||||
if let Ok(note) = note_ref.try_borrow() {
|
||||
let collapsed = app.collapsed.contains(¬e.event.id);
|
||||
|
||||
let is_dm_feed = if let Page::Feed(FeedKind::DmChat(_)) = app.page {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let is_dm_feed = matches!(app.page, Page::Feed(FeedKind::DmChat(_)));
|
||||
|
||||
// Load avatar texture
|
||||
let avatar = if note.muted() {
|
||||
@ -1333,7 +1328,7 @@ fn note_actions(
|
||||
note.event.id.as_hex_string().as_str(),
|
||||
note.event.content.as_str(),
|
||||
) {
|
||||
app.modal = Some(Arc::new(ModalEntry {
|
||||
app.modal = Some(Rc::new(ModalEntry {
|
||||
min_size: vec2(300.0, 200.0),
|
||||
max_size: vec2(x * 1.2, y * 1.2).min(ui.ctx().screen_rect().size()),
|
||||
content: Rc::new(|ui, app| {
|
||||
@ -1533,7 +1528,7 @@ fn note_actions(
|
||||
Box::new(|ui, app| {
|
||||
let json = serde_json::to_string_pretty(¬e.event).unwrap_or_default();
|
||||
app.render_raw = Some((note.event.id, json));
|
||||
app.modal = Some(Arc::new(ModalEntry {
|
||||
app.modal = Some(Rc::new(ModalEntry {
|
||||
min_size: vec2(300.0, 200.0),
|
||||
max_size: ui.ctx().screen_rect().size() * 0.8,
|
||||
content: Rc::new(|ui, app| {
|
||||
@ -1596,7 +1591,7 @@ fn note_actions(
|
||||
note.event.id.as_hex_string().as_str(),
|
||||
serde_json::to_string_pretty(¬e.event).unwrap().as_str(),
|
||||
) {
|
||||
app.modal = Some(Arc::new(ModalEntry {
|
||||
app.modal = Some(Rc::new(ModalEntry {
|
||||
min_size: vec2(300.0, 200.0),
|
||||
max_size: vec2(x * 1.2, y * 1.2).min(ui.ctx().screen_rect().size()),
|
||||
content: Rc::new(|ui, app| {
|
||||
|
@ -180,11 +180,12 @@ fn dm_posting_area(
|
||||
} else {
|
||||
let text = "BASIC ENCRYPTION";
|
||||
let tt_text = "WARNING: Using older less-secure DM technology (NIP-04; recipient(s) have not signalled the ability to accept the newer method)";
|
||||
if app.theme.dark_mode {
|
||||
(app.theme.amber_400(), app.theme.neutral_50(), text, tt_text)
|
||||
} else {
|
||||
(app.theme.amber_400(), app.theme.neutral_50(), text, tt_text)
|
||||
}
|
||||
|
||||
// if app.theme.dark_mode {
|
||||
(app.theme.amber_400(), app.theme.neutral_50(), text, tt_text)
|
||||
//} else {
|
||||
// (app.theme.amber_400(), app.theme.neutral_50(), text, tt_text)
|
||||
//}
|
||||
};
|
||||
|
||||
// Text area
|
||||
|
@ -73,12 +73,10 @@ use gossip_lib::{
|
||||
use nostr_types::ContentSegment;
|
||||
use nostr_types::RelayUrl;
|
||||
use nostr_types::{Id, Metadata, MilliSatoshi, Profile, PublicKey, UncheckedUrl, Url};
|
||||
use std::sync::Arc;
|
||||
use widgets::ModalEntry;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::hash::Hash;
|
||||
#[cfg(feature = "video-ffmpeg")]
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::time::{Duration, Instant};
|
||||
@ -412,7 +410,7 @@ struct GossipUi {
|
||||
popups: HashMap<egui::Id, HashMap<egui::Id, Box<dyn widgets::InformationPopup>>>,
|
||||
|
||||
// Modal dialogue
|
||||
modal: Option<Arc<ModalEntry>>,
|
||||
modal: Option<Rc<ModalEntry>>,
|
||||
|
||||
// QR codes being rendered (in feed or elsewhere)
|
||||
// the f32's are the recommended image size
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::{rc::Rc, sync::Arc};
|
||||
use std::rc::Rc;
|
||||
|
||||
use eframe::{
|
||||
egui::{pos2, Context, Vec2},
|
||||
@ -14,6 +14,7 @@ const MARGIN_Y: f32 = 40.0;
|
||||
pub struct ModalEntry {
|
||||
pub min_size: Vec2,
|
||||
pub max_size: Vec2,
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub content: Rc<dyn Fn(&mut Ui, &mut GossipUi)>,
|
||||
pub on_close: Rc<dyn Fn(&mut GossipUi)>,
|
||||
}
|
||||
@ -95,7 +96,7 @@ pub fn modal_popup_dyn(
|
||||
ctx: &Context,
|
||||
app: &mut GossipUi,
|
||||
closable: bool,
|
||||
entry: Arc<ModalEntry>,
|
||||
entry: Rc<ModalEntry>,
|
||||
) -> InnerResponse<egui::Response> {
|
||||
let content = |ui: &mut Ui| {
|
||||
ui.set_min_size(entry.min_size);
|
||||
|
@ -125,11 +125,8 @@ impl<'a> MoreMenuSubMenu<'a> {
|
||||
|
||||
// recurse
|
||||
for entry in &self.items {
|
||||
match entry {
|
||||
MoreMenuItem::SubMenu(menu) => {
|
||||
menu.close(ui);
|
||||
}
|
||||
_ => {}
|
||||
if let MoreMenuItem::SubMenu(menu) = entry {
|
||||
menu.close(ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,11 +236,8 @@ impl<'a> MoreMenuSubMenu<'a> {
|
||||
} else {
|
||||
// close all sub-menu's
|
||||
for item in self.items {
|
||||
match item {
|
||||
MoreMenuItem::SubMenu(menu) => {
|
||||
menu.close(ui);
|
||||
}
|
||||
_ => {}
|
||||
if let MoreMenuItem::SubMenu(menu) = item {
|
||||
menu.close(ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -531,11 +525,8 @@ impl MoreMenu {
|
||||
} else {
|
||||
// close all sub-menu's
|
||||
for item in content {
|
||||
match item {
|
||||
MoreMenuItem::SubMenu(menu) => {
|
||||
menu.close(ui);
|
||||
}
|
||||
_ => {}
|
||||
if let MoreMenuItem::SubMenu(menu) = item {
|
||||
menu.close(ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user