feat: Add search, share to Websockets and SSE detail screens#64
Draft
skymansandy wants to merge 7 commits into
Draft
feat: Add search, share to Websockets and SSE detail screens#64skymansandy wants to merge 7 commits into
skymansandy wants to merge 7 commits into
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.