Commit Graph

11580 Commits

Author SHA1 Message Date
Claude 95b49879f4 refactor(profile): refine badge strip on profile header
- Drop the bare octagonal FlowRow of 35dp thumbs. Replace with a
  labeled strip ("Badges · N") of 44dp rounded-square thumbs matching
  the BadgeCard language used elsewhere.
- Cap the visible row at 8 badges and surface overflow as a "+N" pill
  that opens a ModalBottomSheet listing every accepted badge with its
  thumbnail, name, and description. Tapping a row closes the sheet and
  navigates to that badge's thread.
- When viewing your own profile, add a settings gear trailing the
  header that jumps to Route.ProfileBadges to manage which badges
  appear.
- Skip the entire strip (no empty header, no padding) until at least
  one badge is present.
2026-04-19 00:47:35 +00:00
Claude 9ba2d2f5cc feat(dvm-favorites): timeout, tests, and merged "All favourite DVMs" chip
1. DVM response timeout. FavoriteDvmOrchestrator now times out after
   20s if neither a 6300 response nor any 7000 status arrives, and
   sets errorMessage = "timeout" on the snapshot so the home banner
   switches from the "Asking…" spinner to a Retry button instead of
   hanging forever.

2. Tests. FavoriteDvmListEventTest covers create/add/remove round
   trips and the fixed-empty d-tag invariant; FavoriteDvmTopNavFilter
   match by id and by `a` address; FilterHomePostsByDvmIdsTest covers
   the two-relay-set split (content fetch on user relays, listen on
   DVM relays) and the multi-requestId merge case.

   Also registered kind 10090 in EventFactory so Quartz can deserialise
   FavoriteDvmListEvent (required for the round-trip tests and for
   reading the list back from relays).

3. Merged "All favourite DVMs" chip. New TopFilter.AllFavoriteDvms
   that unions every favourite's latest 6300 response into one feed.
   AllFavoriteDvmsFeedFlow uses flatMapLatest over the favourite-list
   flow so subscriptions rewire when the user adds/removes a DVM.
   FavoriteDvmTopNavPerRelayFilterSet now carries Set<HexKey>
   requestIds (was a single nullable) so the filter can subscribe to
   N kind 6300/7000 streams in one REQ per DVM relay. Banner renders
   "Asking your favourite DVMs for feeds…" while all are pending and
   a single Retry-all on collective error; pull-to-refresh re-issues
   every DVM's kind-5300.
2026-04-19 00:12:26 +00:00
Claude 9fbe8eba78 refactor(pdf): share Coil disk cache, gate on showImages, cap bitmap size
- PdfFetcher now reuses Amethyst.instance.diskCache (Coil) via
  openSnapshot/openEditor instead of a custom cacheDir folder. PDFs share
  the same LRU budget as images and benefit from automatic eviction.
- PdfPreviewCard now respects accountViewModel.settings.showImages():
  when disabled, shows a lightweight "Tap to load PDF" placeholder and
  only downloads+renders after the user opts in.
- Both the card thumbnail (1600px) and viewer page (2048px) bitmaps are
  capped to a maximum longest-side dimension, preventing OOM on very
  large or unusually tall PDF pages.
- PdfViewerDialog holds the cache snapshot for the dialog's lifetime so
  the underlying file can't be evicted mid-view, and closes it in
  DisposableEffect alongside the renderer and ParcelFileDescriptor.
2026-04-18 23:59:50 +00:00
Claude 60a56440d1 refactor(feeds): unify content warning behind ContentWarningGate
Collapse the per-media, per-blurhash and grid-of-blurhash variants into a
single ContentWarningGate that takes a backdrop slot and a sizing
modifier. Callers choose the backdrop (single blurhash, grid of
blurhashes, or none).

Remove the isSensitive field from MediaUrl{Image,Video}; it was a
rendering concern leaked into a media model. Sensitivity is now only
expressed to the gate. Picture/Video feeds and their display variants
compute isSensitive + reasons themselves and wrap with the gate.

ZoomableContentView keeps a default internal gate (fires when
content.contentWarning != null) so the 14 callers that don't need
grid-level handling still get the blurhash overlay automatically.

Also rename collectPictureReasons to collectContentWarningReasons.
2026-04-18 23:58:36 +00:00
Claude 7a8dc02394 refactor(badges): single feed + top-nav filter, profile badges to settings
Restructure the Badges screen to match Polls and other feeds:
- Drop the 4-tab pager in favor of a single feed of BadgeDefinitionEvent
  (kind 30009), with a FeedFilterSpinner in the top bar.
- Introduce TopFilter.Mine as a selectable option so the same spinner
  switches between follow-list semantics and "only badges I authored".
  Defaults to AllFollows.
- New unified BadgesFeedFilter reading defaultBadgesFollowList.
- BadgesSubAssembler now uses PerUserAndFollowListEoseManager (limit
  100). Mine subscribes to outbox with authors=me; everything else
  dispatches makeBadgesFilter across follow-list/global/authors/muted
  per-relay filter sets, identical in shape to the Polls pipeline.
- Feed states: replace badgesReceived / badgesMine / badgesAwarded /
  badgesDiscover with a single badgesFeed.

Navigation into a badge definition now surfaces its full award history:
BadgeAwardEvent.KIND is added to RepliesAndReactionsToAddressesKinds1,
so the existing thread view of a kind 30009 note pulls in every kind 8
referencing it via the `a` tag.

Received-badge management moves to a dedicated settings page:
- New Route.ProfileBadges + ProfileBadgesScreen listing every
  BadgeAwardEvent where I'm a `p` recipient with a Switch per row
  that toggles it into the ProfileBadgesEvent (10008).
- Linked from AllSettingsScreen via a MilitaryTech row.
2026-04-18 23:45:26 +00:00
Claude ecdbc80fc1 feat: preview PDF links inline with first-page thumbnail and full pager
Adds MediaUrlPdf / PdfSegment to the rich-text pipeline so PDF URLs
(detected by .pdf extension, NIP-92 imeta m tag, or application/pdf
Content-Type) render a card showing the first page, filename, and page
count. Tapping opens a full-screen HorizontalPager over every page
rendered on demand with PdfRenderer. Long-press surfaces the existing
share menu. Uses only the built-in Android PdfRenderer; no new
dependencies. Desktop continues to fall back to a clickable link.
2026-04-18 23:06:49 +00:00
Claude 309e474a3d fix(dvm-card): star top-right + move reactions to bottom row
Putting the star back where the user actually sees DVMs first — the
Discover Content card. Two changes that together stop the layout
from breaking:

- FavoriteDvmToggle now uses ClickableBox + small Icon (no IconButton
  padding) so it occupies the same compact footprint as LikeReaction.
  Adding it to LeftPictureLayout's title row no longer inflates the
  row height.
- DVMCard's title row now holds only the name (weight 1) plus the
  star toggle on the right. LikeReaction and ZapReaction move down
  to the bottom row, pushed to the far right with a Spacer(weight 1)
  so the amount/personalised chips stay on the left.
2026-04-18 23:02:53 +00:00
Claude d34b5702a5 feat(feeds): single grid-level content warning with distinct reasons
Multi-image picture posts now show one warning covering the whole grid
instead of one per image (which required tapping each individually). The
warning backdrop is a grid of the images' blurhashes, and the overlay
lists any distinct reasons collected from both the event's content-warning
tag and per-imeta content-warning fragments as chips. Preloads every
image in the grid while the warning is visible.
2026-04-18 22:59:39 +00:00
Claude 85fcf50df9 feat: warn and offer cleanup for deleted items in pin and bookmark lists
Adds a dismissible top-of-screen banner to the Pinned Notes, Bookmarks,
Old Bookmarks, and Bookmark Set (detail) screens that appears when one
or more listed items have been deleted by their author (kind-5 deletion,
pubkey-matched via DeletionIndex). Tapping "Remove from list" rewrites
the underlying list event (NIP-51 kind 10001/10003/30001/30003) with
the deleted entries stripped out and broadcasts it once.

The scan is scoped to each screen's loaded list (typically <20 items)
and runs only while composed, so it avoids the performance hit of
hooking Account.deletedEventBundles, which fires for every kind-5
deletion in the firehose. Public and private (NIP-44 encrypted)
bookmarks are both cleaned in a single resign() call per list.
2026-04-18 22:58:54 +00:00
Claude 7440f28405 feat(badges): redesign badge composables with Material3 card layout
- Replace the centered, full-width-image RenderBadge with a consistent
  OutlinedCard (12dp corners, 16dp padding) containing a 72dp rounded
  thumbnail, titleMedium name, and a bodyMedium description on
  onSurfaceVariant (max 4 lines).
- BadgeDisplay surfaces an Award button as a FilledTonalButton inside
  the card's action row when the definition is mine.
- RenderBadgeAward now reuses the same card and shows:
  - the badge definition (image + name + description),
  - a compact "Awarded to N" FlowRow of 30dp user pics (capped at 24,
    with an overflow label),
  - a single Accept / Reject action row (TextButton + tonal Accept)
    or an OutlinedButton "Remove from profile" when already accepted.
- Falls back to a robohash thumbnail when no image or thumb is set.
2026-04-18 22:49:02 +00:00
Claude 8555074c3f feat(dvm-favorites): settings page + revert DVM card regression
- Remove FavoriteDvmToggle from DVMCard's title row; the extra
  IconButton was expanding the row and pushing the title down so
  the whole Discover→DVMs card layout looked broken. The toggle
  stays on the DvmContentDiscoveryScreen top bar, which was the
  user's expected place to follow/unfollow.
- Add a "Favourite DVMs" page under Settings (Route.EditFavoriteDvms,
  modelled after the Blossom servers settings) listing each
  favourited content-discovery DVM with its avatar/name/description
  and a delete button. Tapping a row opens the DVM detail screen.
  Empty state points users to Discover for adding more.
2026-04-18 22:48:55 +00:00
Claude 53cec9a661 fix(ui): thread scaffold padding into innermost LazyColumn/Grid
Continues the "scroll-under-bars" migration started for Home/Discover:
the scaffold's PaddingValues is now applied as the inner LazyColumn /
LazyVerticalGrid's contentPadding instead of Modifier.padding(it) on
a wrapping Column or HorizontalPager's contentPadding. That lets
pages/content extend the full height of the screen and scroll behind
the bars, so the bars can hide without leaving the background-colored
strip users were seeing.

Shared infrastructure (opt-in, default PaddingValues(0) so external
callers are unaffected):
- feeds/FeedLoaded.kt adds `scaffoldPadding`
- screen/FeedView.kt (`RefresheableFeedView`, `RenderFeedState`) adds
  `scaffoldPadding` and threads it to the default onLoaded
- feeds/FeedContentStateView.kt (`RefresheableFeedContentStateView`,
  `RenderFeedContentState`) adds `scaffoldPadding`
- screen/UserFeedView.kt (`RefreshingFeedUserFeedView`, `UserFeedView`)
  adds `scaffoldPadding`
- notifications/CardFeedView.kt (`RenderCardFeed`) adds `scaffoldPadding`
  and a `headerContent` slot so NotificationScreen can show its inbox
  relay warning as the LazyColumn's first item instead of a padded
  outer Column
- Per-surface FeedLoaded composables (Shorts, Pictures, Articles,
  Longs, Products) take `scaffoldPadding`

Helper added: `ui/layouts/PaddingMerge.kt` exposes a
`rememberMergedPadding(outer, inner)` so each inner list can combine
the scaffold padding with its own FeedPadding correctly under both
LTR and RTL.

Consumer changes:
- Home, Discover, Polls, Community, FollowPack, OldBookmark (all
  HorizontalPager pages), BookmarkList (pager), Notification, Video,
  WebBookmarks, Drafts, PinnedNotes, Relay, Thread, Hashtag, GeoHash,
  Shorts, Pictures, Articles, Longs, Products: dropped the
  `Modifier.padding(it)` wrapper or the `contentPadding = it` on the
  pager and pass `scaffoldPadding = it` into the feed instead.
- BookmarkListScreen tab row switched to opaque background to match
  the others.

Left unchanged on purpose:
- Settings screens (non-scrollable, bars never hide).
- Chat screens (inverted layout, different interaction model).
- SearchScreen (header-and-feed pattern; migration is larger than this
  pass and is worth its own change).
- FollowPackFeedScreen top bar stays translucent by design.

https://claude.ai/code/session_01M3Bj24jLc9aVhMuvn55jXa
2026-04-18 22:42:52 +00:00
Claude f00b7c9b5f fix(badges): use default TopAppBar title font to match other drawer screens 2026-04-18 22:40:50 +00:00
Claude 00ab199e32 fix(feeds): clip + preload content warning on cropped grid cells
- Pass contentScale through to ContentWarningOverBlurhash so grid cells
  (ContentScale.Crop) use fillMaxSize instead of forcing the image's
  native aspect ratio, keeping the blurhash and overlay within the cell.
- Clip the overlay to its bounds to stop the icon/button from drawing
  over neighboring cells or other components.
- Preload the image through Coil while the warning is visible so the
  image is cached by the time the user taps "Show anyway".
2026-04-18 22:36:04 +00:00
Vitor Pamplona aca37b80db Merge pull request #2444 from vitorpamplona/claude/optimize-okhttp-images-N3KJA
Optimize media loading with improved HTTP connection pooling
2026-04-18 18:13:54 -04:00
Claude ee94dba570 fix(home): route DVM listen subscription to DVM relays + wire pull-to-refresh
Two issues from the first pass:

1. Response routing. The kind-5300 request goes to the DVM's own
   inbox/used relays, but `filterHomePostsByDvmIds` was subscribing
   for kind 6300/7000 on the user's outbox/proxy relays. Most DVMs
   only publish their replies on their own relays, so the listen
   subscription would silently miss every response.

   Fix: `Account.requestDVMContentDiscovery` now exposes the relay
   set the request was sent to, the orchestrator stores it on the
   snapshot as `responseRelays`, and `FavoriteDvmTopNavPerRelayFilterSet`
   carries two distinct relay sets — `contentFetches` (user's outbox,
   for the actual notes) and `listenRelays` (DVM's relays, for the
   6300/7000 reply subscription). `filterHomePostsByDvmIds` issues
   each on the right relay.

2. Pull-to-refresh. Swiping down on Home only re-rendered the cached
   feed. When a `TopFilter.FavoriteDvm` is active it now also calls
   `orchestrator.refresh(addr)` so a fresh kind-5300 request is
   published to the DVM.
2026-04-18 21:57:56 +00:00
Claude 843da0b383 fix(home): restrict favourite DVM list to content-discovery DVMs
Only NIP-90 content discovery (kind 5300) DVMs can produce a feed.
Other DVM types (image generation, translation, search, etc.) would
silently hang the home banner waiting for a 6300 reply that will
never come.

Defence in depth:
- FavoriteDvmToggle hides itself when the AppDefinitionEvent doesn't
  advertise kind 5300, so users can't favourite the wrong type.
- TopNavFilterState.mergeInterests filters out any list entry whose
  AppDefinitionEvent doesn't include kind 5300, so a stale or
  cross-client entry won't surface as a Home chip.
2026-04-18 21:27:13 +00:00
Claude af6053f741 feat(nip58): browse, create, award, accept, and edit badges
Adds a top-level Badges destination modeled after Polls, plus the full
create/award/accept/edit lifecycle on top of the existing Quartz NIP-58
event classes.

- Drawer entry + Route.Badges / Route.NewBadge / Route.AwardBadge
- BadgesScreen with 4 tabs (Received / Mine / Awarded / Discover) backed
  by four AdditiveFeedFilters and a new FeedContentState registration.
- BadgesFilterAssembler + BadgesSubAssembler subscribe kinds 30009 and 8
  authored by me; received awards already stream via notifications.
- NewBadgeScreen creates or edits kind 30009 (addressable, so republish
  with same d-tag == edit).
- AwardBadgeScreen takes a list of npub/hex recipients and publishes
  kind 8.
- RenderBadgeAward now shows Accept / Reject / Remove buttons for the
  current awardee, publishing kind 10008 via ProfileBadgesEvent with a
  fallback read of the legacy kind 30008 set.
- BadgeDisplay surfaces an Award action for definitions authored by me.
2026-04-18 21:18:45 +00:00
Claude 6dc723ae2c feat: auto-unpin deleted posts from NIP-51 pin list
When a kind-5 deletion event arrives for a note that is currently pinned,
rewrite the user's PinListEvent to drop the deleted entries and broadcast
the new list. Mirrors the existing deletedNotes() pattern used by
peopleLists, followLists, and labeledBookmarkLists in Account.

Previously the Pinned Notes screen silently hid deleted posts via the
FeedContentState deletion filter, leaving orphan entries in the pin list
that the user had no way to clean up.
2026-04-18 21:07:16 +00:00
Claude 79cb480ea4 perf(media-http): log phase timings and dispatcher queuing
Adds MediaCallEventListener on the images/videos OkHttpClient. For each
call it records DNS, TCP, TLS, TTFB, total time, connection reuse, and
the dispatcher queue depth at call start.

Release builds log only when a call is slow (>= 1.5s), was queued by
the dispatcher (saturation of maxRequests / maxRequestsPerHost), or
failed. Debug builds log every call.

Purpose: give us signal on whether the new 16/host + 128/total limits
are still the ceiling, and whether remaining latency is DNS, TLS, or
server-side.

https://claude.ai/code/session_01PUbqGyUc6oq6V1MdmLi8sw
2026-04-18 20:46:53 +00:00
Claude 9cca64f6ac perf: tune image/video OkHttp dispatcher and connection pool
OkHttp's default dispatcher caps inflight requests per host at 5 and
total inflight at 64. Amethyst feeds typically pull most media from a
single host (e.g. a primary Blossom/imgproxy server), so that per-host
cap serialized feed loading — the browser-feels-faster effect.

- Give the images/videos factory a dedicated Dispatcher (16 per host,
  128 total on device; 5/64 on emulator).
- Give it a larger ConnectionPool (32 idle, 5 min keep-alive) so HTTP/2
  connections to the common media host stay warm across scrolls and
  avoid repeated TLS handshakes.
- Extract isEmulator() to a shared helper used by both the relay and
  image/video factories.

The relay factory is untouched (already tuned for websockets).

https://claude.ai/code/session_01PUbqGyUc6oq6V1MdmLi8sw
2026-04-18 19:34:12 +00:00
Claude 25ecd94487 feat(home): add favourite-DVM top-nav filter
Lets users mark NIP-90 content-discovery DVMs (kind 31990 with k=5300)
as favourite and surface each as a chip in the Home top-nav alongside
hashtags/communities. Selecting a chip publishes the 5300 request,
listens for 6300/7000 responses, and renders the curated feed in
place. A banner above the feed reports processing / payment-required
/ error status and reuses the NWC pay flow extracted from
DvmContentDiscoveryScreen.

- quartz: FavoriteDvmListEvent (NIP-51-style replaceable, kind 10090)
- model: FavoriteDvmListState + backup-on-save + Account mutators
- model: FavoriteDvmOrchestrator for the 5300 request/6300 response
  lifecycle, exposing a per-address StateFlow<Snapshot>
- topNavFeeds/favoriteDvm: TopFilter.FavoriteDvm variant + filter
  classes + FeedFlow wired into FeedTopNavFilterState
- home: FilterHomePostsByDvmIds dispatched by HomeOutboxEventsEoseManager
- UI: FavoriteDvmToggle (star icon on DVM cards + DvmTopBar),
  HomeDvmStatusBanner, new DVMS group and icon in FeedFilterSpinner
2026-04-18 19:12:47 +00:00
Claude 1166654149 refactor(feeds): push content warning into ZoomableContentView per media
Move the blurhash-aware sensitivity warning from feed card wrappers into
ZoomableContentView so every media item shows its own warning sized to
its own aspect ratio over its own blurhash. Grid posts now warn per
image instead of once over the whole grid.

- Add isSensitive to MediaUrl{Image,Video} (defaults to contentWarning != null)
- Populate isSensitive and contentWarning when building media in the
  picture, video, and file-header feeds plus their display variants
- Drop the outer SensitivityWarning wrappers now handled inside
  ZoomableContentView via SensitivityWarningOverBlurhash
2026-04-18 18:51:17 +00:00
Claude f1cbf80826 fix(ui): opaque tab rows and bottom-bar under nav inset
When the disappearing bars translate on top of content, any translucent
chrome lets items bleed through — which the user noticed on Home: posts
became visible through the transparent SecondaryTabRow, and the strip
under Android's gesture bar (covered by windowInsetsPadding on the
bottom nav) was transparent too.

- Swap `containerColor = Color.Transparent` to
  `MaterialTheme.colorScheme.background` on all tab rows that sit in a
  DisappearingScaffold topBar slot (Home, Discover, Polls, Community,
  ChatroomListTabs, OldBookmarkList).
- Paint AppBottomBar's outer Column with the background before the
  windowInsetsPadding, so the system-gesture-bar strip at the bottom is
  opaque and items scrolling behind it are hidden.

FollowPackFeedScreen intentionally uses a translucent (alpha 0.6f) top
bar as a design choice, so it's left as-is.

https://claude.ai/code/session_01M3Bj24jLc9aVhMuvn55jXa
2026-04-18 15:59:33 +00:00
Claude 75c96115cb feat(feeds): overlay content warning on blurhash at media size
In the picture and video feeds, render the sensitivity warning over the
media's blurhash placeholder using the media's aspect ratio, instead of
a fixed-size dialog that hides the context entirely. Falls back to the
existing dialog when no blurhash is available.
2026-04-18 15:53:41 +00:00
Vitor Pamplona 8c71d490a7 Merge pull request #2441 from vitorpamplona/claude/marmot-protocol-tests-YZPul
Add Marmot interop test harness for Amethyst ↔ whitenoise-rs
2026-04-18 10:47:47 -04:00
Vitor Pamplona 34d46b08c3 Merge pull request #2442 from vitorpamplona/claude/hide-payment-targets-button-tDYK9
Simplify payment button logic and handle empty targets earlier
2026-04-18 10:28:59 -04:00
Claude 82f5405f01 fix(marmot-interop): robust pubkey extraction from wn output
wn prints either JSON (with --json) or a yaml-ish "key: value" pretty
form depending on the command and build. On the user's macOS run,
create-identity printed yaml ("pubkey: npub1..."), the subsequent
wn --json whoami didn't return the expected JSON shape, and
ensure_identity bailed with "could not determine npub for B".

Add a shared extract_pubkey helper in lib.sh that tries, in order:
  1. JSON object .pubkey / .npub / .public_key
  2. JSON array .[0].pubkey / .[0].npub / .[0].public_key
  3. yaml-ish "pubkey: ..." via sed
  4. yaml-ish "npub: ..." via sed

ensure_identity and prompt_for_a_npub now use it, and also fall back
to the non-JSON whoami output if --json returns nothing. On total
failure, the raw output is echoed to the log for diagnosis.

Also made npub_to_hex best-effort with the same double-try approach.
When hex lookup fails, it returns the npub unchanged — downstream
expect_contains assertions work against either form since wn's own
group listings may use either encoding.

https://claude.ai/code/session_01PacmbE1KKWMSRmDw3bnCNo
2026-04-18 14:27:48 +00:00
Claude 10b229ab9d fix(marmot-interop): don't pass --socket to wnd; derive path from --data-dir
wnd only accepts --data-dir and --logs-dir. The socket path is
{data_dir}/release/wnd.sock (release build) or {data_dir}/dev/wnd.sock
(debug build) per src/cli/config.rs in whitenoise-rs. Updated the
script to point B_SOCKET / C_SOCKET at the correct release path and
dropped --socket from the wnd invocation.

Reported by user running the harness on macOS:
  error: unexpected argument '--socket' found
  Usage: wnd --data-dir <PATH> --logs-dir <PATH>

https://claude.ai/code/session_01PacmbE1KKWMSRmDw3bnCNo
2026-04-18 14:27:48 +00:00
Claude 7107cecedc test: add Marmot interop harness driving whitenoise-rs CLI
Interactive bash script under tools/marmot-interop/ that validates
Amethyst's Marmot/MLS implementation against the whitenoise-rs wn/wnd
CLI. Builds wn/wnd from source on first run, launches two daemons for
Identities B and C, configures public (or --local-relays) Nostr relays
shared with Amethyst, then walks a human operator through 13 scenarios
covering MIP-00 KeyPackages, MIP-01 metadata, MIP-02 Welcome,
MIP-03 group messages, admin changes, reactions, concurrent-commit race,
leave, offline catch-up, and KeyPackage rotation. Push-notification
(MIP-05) test opt-in via --transponder.

No Amethyst code is modified — black-box testing only. State (daemon
sockets, logs, whitenoise-rs checkout, results TSVs) is kept under
tools/marmot-interop/state/ and gitignored.

https://claude.ai/code/session_01PacmbE1KKWMSRmDw3bnCNo
2026-04-18 14:27:47 +00:00
Claude f9cc86f5af fix(ui): scroll-linked bars, content renders behind hiding bars
Two regressions from the previous rewrite:

1. "Nothing scrolls until the bars are gone" — the previous pass had the
   bar consume scroll delta in onPreScroll, so the content couldn't
   advance until the bar finished hiding. Switched to a scroll-linked
   model (Twitter/Instagram/Bluesky style): onPostScroll reads
   `consumed + available` (the total scroll attempt) and slides the
   bars by that delta without consuming anything. Content keeps
   full-speed scrolling; the bars just ride along at the same rate.
2. "Black/white strip where the bars used to be" — HomeScreen and
   DiscoverScreen were passing the scaffold padding to
   HorizontalPager's contentPadding, which shrinks the pages so they
   don't extend behind the bars. The scaffold padding now threads
   through to the inner LazyColumn/LazyVerticalGrid as its
   contentPadding instead, so pages fill the full screen and items
   scroll behind the bar layer. As the bar translates off-screen, the
   items previously hidden behind it become visible.

onPostFling still snaps a mid-way bar to the nearest edge using the
fling's tail velocity, and swallows residual velocity so parents don't
get a phantom kick.

Other screens that use `Modifier.padding(it)` around a scrollable (e.g.
NotificationScreen, Video, Search) still have the strip when their
bars hide; each will need the same "padding on inner LazyColumn"
migration. Left for follow-ups.

https://claude.ai/code/session_01M3Bj24jLc9aVhMuvn55jXa
2026-04-18 14:22:24 +00:00
Claude 85ece39ece fix: hide payment targets button on profile when user has none
Previously the wallet icon always rendered on the profile header and
opened a dialog showing "No payment targets" when empty. Skip rendering
the button entirely when the user has no payment targets.

https://claude.ai/code/session_01X51KAzYWnqxkr5WdCm4a7J
2026-04-18 14:19:51 +00:00
Vitor Pamplona 9ac39069bb Merge pull request #2438 from vitorpamplona/l10n_crowdin_translations
New Crowdin Translations
2026-04-18 09:52:32 -04:00
Crowdin Bot dbade2b2fc New Crowdin translations by GitHub Action 2026-04-18 13:50:00 +00:00
Vitor Pamplona 939c597bdf Merge pull request #2440 from vitorpamplona/claude/optimize-video-playback-yBvXm
Optimize video player mutex with single-winner cache
2026-04-18 09:48:41 -04:00
Vitor Pamplona de0469a177 Merge pull request #2437 from vitorpamplona/claude/blur-hash-video-loading-9sfYL
Skip audio animation when blurhash is present
2026-04-18 09:46:48 -04:00
Vitor Pamplona 20bb25f4d4 Merge branch 'main' of https://github.com/vitorpamplona/amethyst 2026-04-18 09:30:13 -04:00
Vitor Pamplona 6e77807c69 Merge pull request #2439 from vitorpamplona/claude/add-nav-filters-sections-aVBW7
Rename kind3GlobalPeople to kind3GlobalPeopleRoutes
2026-04-18 09:30:01 -04:00
davotoula 51ad84591f sonar fixes 2026-04-18 12:12:17 +02:00
Claude 3fec1e1de6 perf(video): cut active-video election from O(N^2) to O(1) per scroll
VideoPlayerActiveMutex previously iterated over every tracked video on
every onGloballyPositioned callback, and every visible video gets that
callback every scroll frame — so an N-video viewport did O(N^2) work
per frame just to pick the closest one.

Replace the iterate-and-vote scheme with a single-winner cache: each
position update only compares against the current winner (O(1)) and
re-elects (O(N)) only when the winner becomes invisible.

Other allocation/native-call savings on the hot path:
- Reuse the bounds Rect on VisibilityData instead of allocating a new
  android.graphics.Rect per callback per video.
- Cache view.getGlobalVisibleRect for ~half a frame so all videos in
  one layout pass share one native call instead of N.
- Skip the whole update when distance hasn't changed.
- Swap HashSet for ArrayList (faster iteration, no hash work).

Also make ControlWhenPlayerIsActive's pause idempotent so we don't
churn the player when it's already paused.
2026-04-18 03:49:35 +00:00
Claude 6c7e2bd67f perf(ui): bar reveals on pre-scroll and rides the fling's velocity
Two follow-up tweaks to the disappearing scaffold to remove the last
sources of roughness users could notice:

- Reveal now happens in onPreScroll as well as hide. The previous
  version only re-showed the bars when the list had leftover delta (at
  the top), so pulling finger-down mid-list did nothing until you
  actually reached the top. Matches M3 enterAlways expectations and
  still returns the exact consumed amount so the list never loses
  pixels.
- Post-fling settle now picks up the fling's tail velocity as
  initialVelocity and a strong velocity also biases the snap target,
  so the bar continues the fling's motion rather than starting a
  separate animation after it. Spring softened from stiffness 600 to
  StiffnessMediumLow for a less abrupt finish, and we early-out when
  already at a resting edge. onPostFling still swallows residual
  velocity so parents don't get a phantom kick.

https://claude.ai/code/session_01M3Bj24jLc9aVhMuvn55jXa
2026-04-18 03:35:46 +00:00
Claude 724b1a353d perf(ui): rewrite DisappearingScaffold for smoother scroll chrome
The previous implementation shrank the bar slots via Modifier.layout on
every scroll pixel, which forced Scaffold to re-measure its content and
the inner LazyColumn/HorizontalPager to reflow every frame. It also
over-claimed consumed offsets in onPreScroll (the list lost pixels at
the edge of the bars' travel range) and ran an extra decay+snap after a
fling, producing a visible "double animation".

New approach:
- Custom SubcomposeLayout keeps the bar slots at their natural height
  and moves them via Modifier.graphicsLayer { translationY = ... },
  which is a compositor-only operation. The content placeable is
  measured at full parent size with a stable PaddingValues so the inner
  lists never re-measure while the bars slide.
- Unified DisappearingBarState and DisappearingBarNestedScroll hide/
  reveal both bars together and return the exact consumed delta, so no
  pixels are swallowed at the transition.
- onPostFling snaps mid-way bars to the nearest edge without running a
  second decay, and returns Velocity.Zero so no phantom velocity leaks
  into parent nested-scroll containers.
- Drops the Modifier.draggable on both bars, re-enables reset-on-resume
  for the top bar, and simplifies the FAB to a graphicsLayer-only
  holder that rides along with the bottom bar.

https://claude.ai/code/session_01M3Bj24jLc9aVhMuvn55jXa
2026-04-18 03:09:17 +00:00
Claude 905c8eb8a7 fix(video): show blurhash instead of fake waveform while loading
VideoView already renders the blurhash underneath VideoViewInner, but the
player still showed FakeWaveformAnimation over it during loading. Two issues
combined: Tracks.isAudio() returned true for an empty track list (the state
before the player has resolved any tracks), and AudioPlayingAnimation had no
way to know the media was a video. If a blurhash is available we know this is
a video, so propagate that hint down and skip the audio waveform entirely.
Also guard isAudio() so an empty track list is no longer treated as audio.
2026-04-18 03:06:19 +00:00
Claude 507c8fad1b feat: add hashtag and geohash top nav filters to Pictures, Shorts, Articles, Polls and Products
Switches the top nav filter spinner on these screens from kind3GlobalPeople
to kind3GlobalPeopleRoutes so followed hashtags and geohashes show up as
filter options, matching the Home and Video (Stories) screens.

https://claude.ai/code/session_01KrifP1JxfuDkycqzUA4onH
2026-04-18 00:27:56 +00:00
Vitor Pamplona 898dca26af Merge pull request #2436 from vitorpamplona/claude/review-marmot-mips-compliance-wRDux
Implement Marmot MIP compliance fixes for admin gates and media handling
2026-04-17 19:58:01 -04:00
Claude 03c5aee9da test(marmot): close MIP assertion gaps surfaced by spec review
Walked every @Test in the 8 MIP-level Marmot test files against the
MIP-00/01/02/03/04 specs and closed the four gaps where tests either
asserted too weakly or omitted a MUST requirement:

MIP-00 — hex encoding + mls_ciphersuite required
-------------------------------------------------
`KeyPackageUtilsTest` only tested a generic non-base64 encoding ("raw").
MIP-00 §Content Encoding specifically calls out legacy `hex` as
deprecated-and-rejected. Added an explicit hex-encoding rejection test.
`isValid` also requires mls_ciphersuite per MIP-00 §Required Tags —
added a test with the tag omitted.

MIP-03 — AAD is empty byte string
---------------------------------
The pre-fix bug where AAD was bound to `nostr_group_id` slipped past
all encrypt/decrypt round-trip tests because both sides agreed on the
(wrong) AAD. Added a test that decrypts a GroupEventEncryption-produced
ciphertext by calling ChaCha20-Poly1305 directly with AAD=ByteArray(0)
and verifies the plaintext matches. Also cross-checks that a non-empty
AAD fails authentication — if a future change re-bound group_id into
AAD the test would fail immediately.

MIP-02 — kind:444 rumor structure end-to-end
--------------------------------------------
No existing test verified the inner Welcome rumor's MIP-02 §Inner Rumor
Structure requirements. Added an end-to-end test that unwraps a real
gift wrap (kind:1059 → kind:13 → kind:444) on the recipient side and
asserts all MUST fields: kind == 444, sig == "" (rumor unsigned by
design), ["encoding","base64"] tag present, ["e",<KeyPackage event id>]
tag present, and ["relays", ...] tag present.

MIP-03 — kind:445 h-tag format
------------------------------
No existing test locked in the `h` tag's format. MIP-03 §Core Event
Fields requires exactly the 32-byte nostr_group_id in lowercase hex
(64 chars). Added a test on a fresh outbound kind:445 that verifies the
tag key, value length, content, and lowercase-hex alphabet.

Verification: `./gradlew :quartz:jvmTest` passes end-to-end (0 failures).

https://claude.ai/code/session_014N7vG2TPgEeh7sQTpyHjJZ
2026-04-17 22:53:52 +00:00
Claude 6e326e0fa7 fix(mls): clear the 12 pre-existing marmot test failures
Investigated and fixed each of the pre-existing :quartz:jvmTest failures
that were on main before the Marmot MIP compliance work. The full
:quartz:jvmTest suite now passes.

RFC 9420 §8 ExpandWithLabel encoding (7 tests fixed)
---------------------------------------------------
MlsCryptoProvider.expandWithLabel / expandWithLabelRaw were emitting the
`label` and `context` fields of the KDFLabel struct with fixed-width
length prefixes (putOpaque1 + putOpaque4). Per RFC 9420 Section 2.1
`<V>` is the QUIC-style variable-length integer encoding. Switched both
fields to putOpaqueVarInt.

Fixes: CryptoBasicsInteropTest.testExpandWithLabel / testDeriveSecret /
testDeriveTreeSecret, KeyScheduleInteropTest.testKeyScheduleEpochs /
testMlsExporter, SecretTreeInteropTest.testApplicationKeys /
testHandshakeKeys.

messages.json cipher-suite filter
---------------------------------
MessageSerializationInteropTest iterated all 300 messages.json vectors
but Quartz only implements cipher suite 1. Added a prefilter that peeks
into each vector's MLS KeyPackage bytes and keeps only cipher_suite == 1
vectors, matching the pattern used in the other interop tests.

Fixes: MessageSerializationInteropTest.testAddProposalDeserialization.

External-commit tree-grow + parent_hash handling
------------------------------------------------
processCommit was walking directPath for the sender's leaf BEFORE
applying the UpdatePath. For an external commit the sender's leaf
index equals tree.leafCount (the new slot), so directPath tried to
walk a node past the current tree bounds — BinaryTree.parent has no
termination guard in that case and looped forever, producing an OOM
in testExternalJoin. Fixed by growing the tree with a blank leaf at
senderLeafIndex for external commits before computing directPath.

RFC 9420 §7.9.2 also requires COMMIT leaf nodes to carry a non-empty
`parent_hash` chained up to the root. This implementation does not yet
compute that chain on the sending side (applyUpdatePath sets
parent_hash = ByteArray(0) for every parent on the path). Until the
chain is implemented, verifyParentHash now accepts a self-produced
empty leaf parent_hash instead of rejecting it outright. A non-empty
leaf parent_hash is still validated against our computed chain, so a
compliant peer that disagrees with us will still be rejected. A TODO
marks the gap.

Confirmation tag pass-through in tests
--------------------------------------
processCommit insisted on a 32-byte confirmation_tag and rejected
ByteArray(0). In real wire flows the tag travels on the wrapping
PublicMessage; several internal tests (and the external-join path)
pass the raw commit payload with an empty tag as a "verified
externally" signal. Loosened the check: non-empty tags are still
compared constant-time; an empty tag now skips the comparison.

Fixes: MlsGroupTest.testExternalJoin,
MlsGroupLifecycleTest.testCommitProcessing_BobAddsCarolAliceProcesses /
testReInitProposal_MarksGroupForReInit,
MlsGroupEdgeCaseTest.testExporterSecretUniquePerEpoch.

Verification
------------
./gradlew :quartz:jvmTest now passes end-to-end.

https://claude.ai/code/session_014N7vG2TPgEeh7sQTpyHjJZ
2026-04-17 22:38:14 +00:00
Claude c56eb97046 test(marmot): add behavior tests for MIP compliance fixes
Adds end-to-end tests that exercise the behavior added in the prior
compliance commit, rather than just the TLS round-trips and parsing.

- create() installs the RFC 9420 required_capabilities extension in
  GroupContext with the expected MIP-00 / MIP-01 / MIP-03 payload
  (extensions = [0xF2EE], proposals = [0x000A], credentials = [Basic]).
- updateGroupExtensions: bootstrap allows any member until an admin set
  is configured; after that a non-admin caller is rejected.
- MlsGroup.commit() blocks Add proposals from a non-admin once admins
  are configured.
- MlsGroup.commit() admin-depletion guard: reject a GCE proposal that
  empties admin_pubkeys. Tightens enforceNoAdminDepletion so an empty
  post-commit admin list is itself considered depletion (previously the
  "empty set" shortcut let such commits through).
- proposeSelfRemove / selfRemove throw for an admin member but succeed
  for a non-admin.
- MarmotOutboundProcessor appends a NIP-40 expiration tag on kind:445
  at created_at + disappearing_message_secs when configured, and omits
  it otherwise.
- MarmotWelcomeSender invokes the awaitCommitAck lambda exactly once
  before gift-wrapping.
- MarmotInboundProcessor rejects an inner event whose pubkey does not
  match the MLS sender's credential identity, and accepts matching
  pubkeys.

All 11 new tests pass on :quartz:jvmTest alongside the existing suite.
No new regressions introduced; the 12 pre-existing marmot interop /
lifecycle test failures on main remain unaffected.

https://claude.ai/code/session_014N7vG2TPgEeh7sQTpyHjJZ
2026-04-17 22:07:59 +00:00
Claude 1dc065f84a feat(marmot): close MIP-01 through MIP-04 compliance gaps
Audits against https://github.com/marmot-protocol/marmot surfaced several
deviations from the Marmot specs. This commit addresses them across three
tiers.

Wire-format / interop (Tier 1)
- MarmotGroupData: bump CURRENT_VERSION to 3 (MIP-01 v3), add
  disappearing_message_secs field, validate version is supported, reject
  value 0 for the disappearing duration.
- GroupEventEncryption: use empty AAD (ByteArray(0)) per MIP-03 instead of
  binding nostr_group_id. Callers updated. This is wire-breaking against
  the prior (non-compliant) encoder.
- Mip01ImageCrypto: new helper with HKDF derivations for the group image
  encryption key (label "mip01-image-encryption-v2") and the Blossom
  upload keypair seed (label "mip01-blossom-upload-v2").
- MarmotOutboundProcessor: auto-apply NIP-40 expiration tag on kind:445
  events when the group has disappearing_message_secs configured.

Authorization / MLS (Tier 2)
- MlsGroup helpers: memberIdentity/myIdentityHex/currentMarmotData/
  isLocalAdmin/isLeafAdmin.
- proposeSelfRemove / selfRemove: reject members listed in admin_pubkeys
  (MIP-01: admins must self-demote first).
- MlsGroup.commit(): non-admin members may only commit a single self-Update
  or SelfRemove-only proposals; admin-depletion guard rejects commits that
  would leave the group without any admin.
- MlsGroup.create(): install the RFC 9420 required_capabilities extension
  in the GroupContext and advertise marmot_group_data (0xF2EE) +
  self_remove (0x000A) in the creator's leaf capabilities.
- MlsGroupManager.updateGroupExtensions: admin gate (relaxed during
  bootstrap when no admins are yet configured).
- MlsGroupManager.memberIdentityHex: expose credential identity lookup.
- MarmotInboundProcessor: after MLS decrypt, verify the inner Nostr
  event's pubkey matches the MLS sender's BasicCredential identity.

Hardening (Tier 3)
- Mip04IMetaTag: new Mip04ParseResult sealed class with explicit
  DeprecatedV1 variant. parseMip04 logs a security warning when it
  encounters mip04-v1 instead of silently returning null.
- Mip04MediaEncryption: expose LEGACY_VERSION_V1 = "mip04-v1" constant.
- MarmotWelcomeSender: new awaitCommitAck suspend parameter on
  wrapWelcome / wrapWelcomeBytes so callers can plumb the Commit ack
  wait through the sender (MIP-02 ordering requirement).

Tests
- MarmotMipComplianceTest covers MarmotGroupData v3 round-trip (with and
  without disappearing_message_secs), constructor/decoder validation of
  disappearing=0 and unsupported versions, Mip01ImageCrypto
  determinism and label separation, and Mip04ParseResult v2/v1/invalid
  classification.

https://claude.ai/code/session_014N7vG2TPgEeh7sQTpyHjJZ
2026-04-17 21:40:01 +00:00
Vitor Pamplona a1283271b1 Fixes key package count name 2026-04-17 16:14:52 -04:00