Skip to content

Unwrap LogcatDesign#137

Merged
Goooler merged 11 commits into
trunkfrom
unwrap-logcat-design
Apr 26, 2026
Merged

Unwrap LogcatDesign#137
Goooler merged 11 commits into
trunkfrom
unwrap-logcat-design

Conversation

@Goooler
Copy link
Copy Markdown
Owner

@Goooler Goooler commented Apr 26, 2026

Refs #119.

@Goooler Goooler force-pushed the unwrap-logcat-design branch from 27b3c34 to 463885b Compare April 26, 2026 02:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the logcat feature to align with issue #119 by moving UI logic into a @Composable screen and extracting side effects/state management into a ViewModel, replacing the prior Design-based implementation.

Changes:

  • Introduces LogcatViewModel to own logcat streaming, file loading, export, and one-shot UI events.
  • Reworks LogcatScreen into a composable that renders state, handles events, and uses activity-result APIs for export.
  • Simplifies LogcatActivity to a BaseActivity hosting Compose content.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
app/src/main/kotlin/com/github/kr328/clash/log/vm/LogcatViewModel.kt New ViewModel encapsulating logcat streaming, file operations, export progress, and event signaling
app/src/main/kotlin/com/github/kr328/clash/log/util/LogcatReader.kt Makes log reading suspendable and moves execution onto Dispatchers.IO
app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt Converts the old design-driven UI into a composable screen driven by the ViewModel’s flows
app/src/main/kotlin/com/github/kr328/clash/log/LogcatActivity.kt Replaces coroutine-driven DesignActivity logic with a simple Compose host activity
Comments suppressed due to low confidence (1)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:73

  • Local name evenState looks like a typo for eventState, which makes the event-handling code harder to read/grep. Rename it to eventState (or similar) for clarity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/kotlin/com/github/kr328/clash/log/vm/LogcatViewModel.kt Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:73

  • evenState looks like a typo for eventState. Since this is the main event flow used by the screen, the misspelling makes the code harder to read and increases the chance of mistakes when editing the event handling logic later.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:73

  • Typo in local state name: evenState should be eventState to match the ViewModel and avoid confusion/incorrect future usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/kotlin/com/github/kr328/clash/log/util/LogcatReader.kt Outdated
Comment thread app/src/main/kotlin/com/github/kr328/clash/log/vm/LogcatViewModel.kt Outdated
Goooler and others added 3 commits April 26, 2026 11:10
…er.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…del.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:73

  • Typo/unclear naming: evenState is collecting viewModel.eventState, and later when (val event = evenState) uses it as an event. Rename this local to eventState (or similar) to avoid confusion and improve readability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:35

  • This file imports androidx.compose.runtime.setValue, but there is no delegated mutable state using by here anymore. Unused imports are compilation errors in Kotlin; remove this import (and any other unused ones) to fix the build.
    app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:73
  • Local variable evenState looks like a typo for eventState (it actually holds viewModel.eventState). Renaming it will reduce confusion and make the LaunchedEffect(...) block easier to read.
    app/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt:128
  • Auto-follow while streaming likely won't work reliably: listState.isBottom is evaluated after uiState.messages.size increases, so the list is no longer considered "bottom" once a new item is appended, and the scroll won't trigger. Track whether the user was at bottom before the list grows (e.g., keep a wasAtBottom state updated from snapshotFlow { listState.isBottom }, or compute shouldAutoFollow using the previous size) and use that to decide whether to scroll.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Goooler Goooler merged commit 7c6cbc8 into trunk Apr 26, 2026
7 checks passed
@Goooler Goooler deleted the unwrap-logcat-design branch April 26, 2026 03:30
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