ui/note: fix actionbar note responses

they are not responsive on android?

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-09-04 15:33:53 -07:00
parent 024cf3ef91
commit c765b031e9

View File

@@ -832,35 +832,14 @@ struct Zapper<'a> {
cur_acc: KeypairUnowned<'a>,
}
#[profiling::function]
fn render_note_actionbar(
fn zap_actionbar_button(
ui: &mut egui::Ui,
zapper: Option<Zapper<'_>>,
note_id: &[u8; 32],
note_pubkey: &[u8; 32],
note_key: NoteKey,
zapper: Option<Zapper<'_>>,
i18n: &mut Localization,
) -> Option<NoteAction> {
let mut action = None;
ui.set_min_height(26.0);
ui.spacing_mut().item_spacing.x = 24.0;
let reply_resp =
reply_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand);
let quote_resp =
quote_repost_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand);
let to_noteid = |id: &[u8; 32]| NoteId::new(*id);
if reply_resp.clicked() {
action = Some(NoteAction::Reply(to_noteid(note_id)));
}
if quote_resp.clicked() {
action = Some(NoteAction::Quote(to_noteid(note_id)));
}
let mut action: Option<NoteAction> = None;
let Zapper { zaps, cur_acc } = zapper?;
let zap_target = ZapTarget::Note(NoteZapTarget {
@@ -871,11 +850,10 @@ fn render_note_actionbar(
let zap_state = zaps.any_zap_state_for(cur_acc.pubkey.bytes(), zap_target);
let target = NoteZapTargetOwned {
note_id: to_noteid(note_id),
note_id: NoteId::new(*note_id),
zap_recipient: Pubkey::new(*note_pubkey),
};
{
cur_acc.secret_key.as_ref()?;
match zap_state {
@@ -905,12 +883,44 @@ fn render_note_actionbar(
x_button
}
}
}
.on_hover_cursor(egui::CursorIcon::PointingHand);
action
}
#[profiling::function]
fn render_note_actionbar(
ui: &mut egui::Ui,
zapper: Option<Zapper<'_>>,
note_id: &[u8; 32],
note_pubkey: &[u8; 32],
note_key: NoteKey,
i18n: &mut Localization,
) -> Option<NoteAction> {
let mut action = None;
ui.set_min_height(26.0);
ui.spacing_mut().item_spacing.x = 24.0;
let reply_resp =
reply_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand);
let quote_resp =
quote_repost_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand);
if reply_resp.clicked() {
action = Some(NoteAction::Reply(NoteId::new(*note_id)));
}
if quote_resp.clicked() {
action = Some(NoteAction::Quote(NoteId::new(*note_id)));
}
action = zap_actionbar_button(ui, note_id, note_pubkey, zapper, i18n).or(action);
action
}
#[profiling::function]
fn render_notetime(
ui: &mut egui::Ui,