Skip to content

Unwrap LogsDesign#120

Merged
Goooler merged 3 commits into
trunkfrom
unwrap-logs-design
Apr 23, 2026
Merged

Unwrap LogsDesign#120
Goooler merged 3 commits into
trunkfrom
unwrap-logs-design

Conversation

@Goooler
Copy link
Copy Markdown
Owner

@Goooler Goooler commented Apr 23, 2026

Refs #119.

@Goooler Goooler requested a review from Copilot April 23, 2026 06:39
@Goooler Goooler changed the title Unwrap LogsScreen Unwrap LogsDesign Apr 23, 2026
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

This PR continues the “Design → @Composable + ViewModel” refactor (Issue #119) by migrating the Logs UI away from the Design/request channel pattern into a Compose screen backed by a LogsViewModel.

Changes:

  • Introduces LogsViewModel to load and delete log files via StateFlow.
  • Refactors LogsScreen to collect state with lifecycle awareness and removes the LogsDesign wrapper.
  • Simplifies LogsActivity to a BaseActivity using setContent { ... }.

Reviewed changes

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

File Description
app/src/main/kotlin/com/github/kr328/clash/log/vm/LogsViewModel.kt New ViewModel for loading/deleting log files and exposing them as StateFlow.
app/src/main/kotlin/com/github/kr328/clash/log/ui/LogsScreen.kt Converts the UI to a ViewModel-driven composable (LogsScreen + LogsContent).
app/src/main/kotlin/com/github/kr328/clash/log/LogsActivity.kt Replaces DesignActivity event loop with a Compose setContent activity.
Comments suppressed due to low confidence (2)

app/src/main/kotlin/com/github/kr328/clash/log/ui/LogsScreen.kt:55

  • LogsScreen was previously file-private but is now a public top-level composable. If it’s only intended to be used by LogsActivity, consider making it internal/private to avoid accidentally expanding the app module’s API surface (and to steer callers toward the right entrypoint).
    app/src/main/kotlin/com/github/kr328/clash/log/ui/LogsScreen.kt:82
  • LogsScreen only triggers viewModel.init() once via LaunchedEffect(viewModel). After returning from LogcatActivity (e.g., deleting/exporting a log file), the list may be stale because it won’t reload on ON_START like the old DesignActivity implementation did. Consider reloading on lifecycle start/resume (e.g., LifecycleEventEffect(Lifecycle.Event.ON_START) calling a refresh()), and/or moving the initial load into the ViewModel so it always stays consistent.

💡 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/LogsViewModel.kt Outdated
Comment thread app/src/main/kotlin/com/github/kr328/clash/log/vm/LogsViewModel.kt Outdated
Goooler and others added 2 commits April 23, 2026 14:43
…l.kt

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Goooler Goooler enabled auto-merge (squash) April 23, 2026 06:44
@Goooler Goooler merged commit 13a8402 into trunk Apr 23, 2026
3 checks passed
@Goooler Goooler deleted the unwrap-logs-design branch April 23, 2026 06:48
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