Unwrap LogsDesign#120
Merged
Merged
Conversation
There was a problem hiding this comment.
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
LogsViewModelto load and delete log files viaStateFlow. - Refactors
LogsScreento collect state with lifecycle awareness and removes theLogsDesignwrapper. - Simplifies
LogsActivityto aBaseActivityusingsetContent { ... }.
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
LogsScreenwas previously file-private but is now a public top-level composable. If it’s only intended to be used byLogsActivity, consider making itinternal/privateto 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:82LogsScreenonly triggersviewModel.init()once viaLaunchedEffect(viewModel). After returning fromLogcatActivity(e.g., deleting/exporting a log file), the list may be stale because it won’t reload onON_STARTlike the oldDesignActivityimplementation did. Consider reloading on lifecycle start/resume (e.g.,LifecycleEventEffect(Lifecycle.Event.ON_START)calling arefresh()), 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.
…l.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Refs #119.