Skip to content

feat: Add search, share to Websockets and SSE detail screens#64

Draft
skymansandy wants to merge 7 commits into
mainfrom
feat/wssharesearch
Draft

feat: Add search, share to Websockets and SSE detail screens#64
skymansandy wants to merge 7 commits into
mainfrom
feat/wssharesearch

Conversation

@skymansandy

Copy link
Copy Markdown
Owner

No description provided.

- New common shareLogText / shareLogAsFile(content, fileName) actuals in LogShareUtil; HTTP share migrates to them.
- New SocketLogUtil.buildSocketShareText emits a full transcript (connection metadata, request headers, per-message timestamped lines).
- Share IconButton + DropdownMenu on SocketDetailScreen offers "Share as text" and "Share as file"; snackbar host added for clipboard-style feedback (JVM).
- SearchField cursorBrush set to white so the caret is visible against the dark TopAppBar background.
Mirrors the WS detail search: SearchField-swapped TopAppBar with debounced query, a navigator row showing match index/count with up/down to jump between matches, and highlighted occurrences in each SseEventBubble's data text. Auto-scroll-to-bottom is suppressed while searching so it doesn't fight the navigator.
- SseLogUtil.buildSseShareText emits a full SSE transcript (connection metadata, request headers, per-event timestamped block).
- SseDetailScreen gains Share IconButton + DropdownMenu (text/file) and a snackbar host, mirroring the WS pattern.
- Extracted SseDetailTopBar / SocketDetailTopBar (top-bar branching) and SseDetailContent / SocketDetailContent (navigator row + LazyColumn) so the screen functions stay under detekt's CC=15 ceiling without a Suppress annotation.
- Hoisted the 450 ms search debounce into a shared rememberDebouncedQuery helper used by both screens.
SocketDetailViewModel now owns searchQuery / isSearchActive, the 450 ms debouncedQuery (same shape as SocketLogListViewModel), the derived matches list (combine of messages + debouncedQuery), and currentMatchIndex with an automatic reset when the match set changes. activateSearch / closeSearch / setSearchQuery / goToPreviousMatch / goToNextMatch drive the state machine, and buildShareText / shareSubject / shareFileName let the composable delegate share-text construction instead of inlining it.

The screen drops its local rememberDebouncedQuery / computeSocketMatches / SocketMatchPosition copies in favor of collectAsStateWithLifecycle reads and VM method references; only Compose-bound state (focus requester, snackbar host, dropdown open, scroll LaunchedEffects) stays. Search state now survives configuration changes and the behavior is covered by unit tests on the VM directly.
Mirrors the WS Phase 1 change for SSE: SseDetailViewModel now owns searchQuery / isSearchActive / the 450 ms debouncedQuery, the derived matches list (combine of events + debouncedQuery), and currentMatchIndex with an automatic reset when the match set changes. Actions (activateSearch / closeSearch / setSearchQuery / goToPreviousMatch / goToNextMatch) and share helpers (buildShareText / shareSubject / shareFileName) drive the screen.

SseDetailScreen drops its local rememberDebouncedQuery / computeSseMatches / SseMatchPosition copies in favor of collectAsStateWithLifecycle reads and VM method references. The now-unused rememberDebouncedQuery helper is deleted from SearchField.kt since neither screen needs it anymore.
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.

1 participant