From f4dea1e05e0d02331a3d6c36d52b9af7c11a8555 Mon Sep 17 00:00:00 2001 From: Bu5hm4nn Date: Fri, 15 Mar 2024 13:56:22 -0600 Subject: [PATCH] Refactor: Eliminate passing reference of outer egui::Frame (which is never used) in feed module --- gossip-bin/src/ui/feed/mod.rs | 16 ++++------------ gossip-bin/src/ui/feed/note/mod.rs | 2 -- gossip-bin/src/ui/feed/post.rs | 5 ++--- gossip-bin/src/ui/mod.rs | 2 +- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/gossip-bin/src/ui/feed/mod.rs b/gossip-bin/src/ui/feed/mod.rs index e8a51880..614ef5f7 100644 --- a/gossip-bin/src/ui/feed/mod.rs +++ b/gossip-bin/src/ui/feed/mod.rs @@ -47,7 +47,7 @@ pub(super) fn enter_feed(app: &mut GossipUi, kind: FeedKind) { } } -pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) { +pub(super) fn update(app: &mut GossipUi, ctx: &Context, ui: &mut Ui) { if GLOBALS.ui_invalidate_all.load(Ordering::Relaxed) { app.notes.cache_invalidate_all(); GLOBALS.ui_invalidate_all.store(false, Ordering::Relaxed); @@ -127,7 +127,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram }, ); ui.add_space(6.0); - render_a_feed(app, ctx, frame, ui, feed, false, &id, load_more); + render_a_feed(app, ctx, ui, feed, false, &id, load_more); } FeedKind::Inbox(indirect) => { if read_setting!(public_key).is_none() { @@ -173,14 +173,13 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram }, ); ui.add_space(6.0); - render_a_feed(app, ctx, frame, ui, feed, false, id, load_more); + render_a_feed(app, ctx, ui, feed, false, id, load_more); } FeedKind::Thread { id, .. } => { if let Some(parent) = GLOBALS.feed.get_thread_parent() { render_a_feed( app, ctx, - frame, ui, vec![parent], true, @@ -206,7 +205,6 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram render_a_feed( app, ctx, - frame, ui, feed, false, @@ -235,7 +233,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram let feed = GLOBALS.feed.get_dm_chat_feed(); let id = channel.unique_id(); - render_a_feed(app, ctx, frame, ui, feed, false, &id, load_more); + render_a_feed(app, ctx, ui, feed, false, &id, load_more); } } @@ -247,7 +245,6 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram fn render_a_feed( app: &mut GossipUi, ctx: &Context, - frame: &mut eframe::Frame, ui: &mut Ui, feed: Vec, threaded: bool, @@ -277,7 +274,6 @@ fn render_a_feed( render_note_maybe_fake( app, ctx, - frame, ui, FeedNoteParams { id: *id, @@ -334,7 +330,6 @@ fn render_a_feed( fn render_note_maybe_fake( app: &mut GossipUi, ctx: &Context, - _frame: &mut eframe::Frame, ui: &mut Ui, feed_note_params: FeedNoteParams, ) { @@ -361,7 +356,6 @@ fn render_note_maybe_fake( note::render_note( app, ctx, - _frame, ui, FeedNoteParams { id, @@ -401,7 +395,6 @@ fn render_note_maybe_fake( render_note_maybe_fake( app, ctx, - _frame, ui, FeedNoteParams { id: *reply_id, @@ -418,7 +411,6 @@ fn render_note_maybe_fake( note::render_note( app, ctx, - _frame, ui, FeedNoteParams { id, diff --git a/gossip-bin/src/ui/feed/note/mod.rs b/gossip-bin/src/ui/feed/note/mod.rs index 6a5143e9..c81e382d 100644 --- a/gossip-bin/src/ui/feed/note/mod.rs +++ b/gossip-bin/src/ui/feed/note/mod.rs @@ -57,7 +57,6 @@ pub struct NoteRenderData { pub(super) fn render_note( app: &mut GossipUi, ctx: &Context, - _frame: &mut eframe::Frame, ui: &mut Ui, feed_note_params: FeedNoteParams, ) { @@ -193,7 +192,6 @@ pub(super) fn render_note( super::render_note_maybe_fake( app, ctx, - _frame, ui, FeedNoteParams { id: *reply_id, diff --git a/gossip-bin/src/ui/feed/post.rs b/gossip-bin/src/ui/feed/post.rs index 1149bf4a..f277b0c1 100644 --- a/gossip-bin/src/ui/feed/post.rs +++ b/gossip-bin/src/ui/feed/post.rs @@ -145,7 +145,7 @@ pub(in crate::ui) fn posting_area( }; match &dm_channel { Some(dmc) => dm_posting_area(app, ctx, frame, ui, dmc), - None => real_posting_area(app, ctx, frame, ui), + None => real_posting_area(app, ctx, ui), } } }); @@ -314,7 +314,7 @@ fn dm_posting_area( } } -fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) { +fn real_posting_area(app: &mut GossipUi, ctx: &Context, ui: &mut Ui) { // Maybe render post we are replying to or reposting let compose_area_id: egui::Id = egui::Id::new("compose_area"); @@ -333,7 +333,6 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram super::note::render_note( app, ctx, - frame, ui, FeedNoteParams { id, diff --git a/gossip-bin/src/ui/mod.rs b/gossip-bin/src/ui/mod.rs index 32fa09da..d062f996 100644 --- a/gossip-bin/src/ui/mod.rs +++ b/gossip-bin/src/ui/mod.rs @@ -1455,7 +1455,7 @@ impl eframe::App for GossipUi { self.begin_ui(ui); match self.page { Page::DmChatList => dm_chat_list::update(self, ctx, frame, ui), - Page::Feed(_) => feed::update(self, ctx, frame, ui), + Page::Feed(_) => feed::update(self, ctx, ui), Page::PeopleLists | Page::PeopleList(_) | Page::Person(_) => { people::update(self, ctx, frame, ui) }