Skip to content

feat(zap): render zap messages as mini-posts in the engagement drawer#559

Merged
barrydeen merged 1 commit into
barrydeen:mainfrom
dmnyc:feat/zap-with-image
May 25, 2026
Merged

feat(zap): render zap messages as mini-posts in the engagement drawer#559
barrydeen merged 1 commit into
barrydeen:mainfrom
dmnyc:feat/zap-with-image

Conversation

@dmnyc
Copy link
Copy Markdown
Contributor

@dmnyc dmnyc commented May 22, 2026

Summary

Zap messages used to render as a single truncated line in the
engagement drawer and a raw URL on the top-zap banner. That worked
for short "thanks!" zaps but mangled longer messages — anything with
body text + a link + an image got chopped to `...tes…` and the
content was lost.

This PR treats the two surfaces differently to suit their constraints:

  • Engagement-drawer zap row — rewritten as a mini-post. Avatar +
    display name + private icon + bolt + sats in a header row, then
    the message body renders through the same `RichContent` pipeline a
    regular kind-1 post body uses. Inline images, hashtags, profile /
    note mentions, plain links with OG preview cards, all rendered the
    same as in the feed. Body is not truncated; row grows vertically.
  • Top-zap banner above the post action bar — still a one-line
    preview. Image URLs collapse to the literal `[image]` token via a
    small `ZapMessageImage` helper so the sats amount stays visible.
  • Cross-platform parity doc `ZAP_IMAGE_PARITY.md` describes the
    contract for the iOS agent — banner uses the URL-collapse helper,
    drawer delegates to the iOS post-body renderer.

`eventRepo` is plumbed from `ReactionDetailsSection` into `ZapRow` so
the rich-content pipeline can resolve profile mentions / quoted
notes from cache.

Test plan

  • Zap a post with `"thanks!"` — drawer row renders just the
    single-line text below the header (no body wrap, no card).
  • Zap with `"check this out https://nostr.com"\` — drawer row
    shows the body, with an OG preview card for nostr.com below.
  • Zap with an image URL only (e.g. `https://i.nostr.build/x.gif\`)
    — drawer row body renders the inline image; top-zap banner
    shows `[image]`.
  • Zap with body + image URL — drawer renders body text + inline
    image; top-zap banner shows `text [image]` (or
    `[image] text`).
  • Zap with a long (400-char) body — drawer row grows vertically;
    nothing is truncated; sats amount stays visible in the header.
  • Long-press a drawer zap row → existing `ZapInspectorDialog`
    still opens.
  • Tap the row header (anywhere outside body links) → routes to
    zapper's profile.
  • Tap an OG card or link inside the body → opens browser.
  • Zap with a `nostr:nevent1...` reference in the body — renders
    as a quoted note card inside the zap row.

…] on top banner

Two surfaces render zap-receipt messages, each with a different
treatment to suit its constraints.

Engagement-drawer zap row (mini-post)
- Now renders the message through the same `RichContent` pipeline a
  regular post body uses. Body text, plain links, hashtags, profile
  / note mentions, and inline images all render the way they would
  in a feed post. The row grows vertically rather than truncating —
  long zapvertising payloads stay readable.
- Layout: avatar (top-aligned, 30dp) + right-side column (display
  name + private icon + bolt + sats on top; RichContent body below).
- `eventRepo` is plumbed from `ReactionDetailsSection` into `ZapRow`
  so RichContent can resolve profile mentions.

Top-zap banner above the action bar
- Single-line preview. Image URLs collapse to the literal token
  `[image]` (helpers in `ui/util/ZapMessageImage.kt`) so the sats
  amount stays visible. Surrounding text is preserved
  ("nice post [image]"). No image is loaded in the banner — the
  drawer handles that.

Cross-platform: `ZAP_IMAGE_PARITY.md` documents the contract — banner
uses URL-collapse, drawer uses the full post-body renderer; iOS port
checklist + visual test included.
@barrydeen barrydeen merged commit 14f237b into barrydeen:main May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants