diff --git a/android/src/app.rs b/android/src/app.rs index e4a9721..91cf325 100644 --- a/android/src/app.rs +++ b/android/src/app.rs @@ -2808,6 +2808,21 @@ impl eframe::App for SleekApp { match ui::discover_tab(ui, &th, &mut self.state) { DiscoverAction::None => {} DiscoverAction::Join(ch) => self.do_join(ch), + DiscoverAction::Open(name) => { + let need_history = self + .state + .channels + .get(&name) + .map(|b| !b.has_chat_messages()) + .unwrap_or(true); + self.state.open_chat(&name); + if need_history { + self.net.send(NetCmd::HistoryLatest { + target: name, + count: 100, + }); + } + } } } Tab::Settings => { diff --git a/android/src/ui/discover.rs b/android/src/ui/discover.rs index 11416f2..0fc581f 100644 --- a/android/src/ui/discover.rs +++ b/android/src/ui/discover.rs @@ -9,6 +9,8 @@ use crate::ui::widgets::{avatar_circle, card}; pub enum DiscoverAction { None, Join(String), + /// Already a member — open the channel buffer. + Open(String), } pub fn discover_tab(ui: &mut egui::Ui, th: &Theme, state: &mut AppState) -> DiscoverAction { @@ -92,10 +94,14 @@ pub fn discover_tab(ui: &mut egui::Ui, th: &Theme, state: &mut AppState) -> Disc .interact(egui::Sense::click()) .on_hover_cursor(CursorIcon::PointingHand); - if resp.clicked() && !joined { - action = DiscoverAction::Join((*name).to_string()); + if resp.clicked() { + action = if joined { + DiscoverAction::Open((*name).to_string()) + } else { + DiscoverAction::Join((*name).to_string()) + }; } - if resp.hovered() && !joined { + if resp.hovered() { ui.painter().rect_filled( resp.rect, sp.radius_md,