Unwrap MetaFeatureSettingsScreen#131
Merged
Merged
Conversation
825caf1 to
6d6984b
Compare
6d6984b to
8d1df82
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
Author
|
@copilot apply changes based on the comments in this thread |
- Wrap importGeoFile() body in try/catch, setting importResult to
Failed on any exception so the UI is never left in a stale state
- Use uiState.update { ... } in updateState() for atomic read-modify-write
Agent-Logs-Url: https://github.com/Goooler/MihomoForAndroid/sessions/ae75f819-f7f0-4f0a-a5fb-374c5b0bfe06
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Applied both remaining unresolved comments in 534b402:
|
bb611a7 to
46e38f2
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR continues the “Design → @Composable + ViewModel” refactor for Meta feature settings (refs #119), moving state/persistence and geo-file import logic into a dedicated ViewModel while converting the UI into a standalone Compose screen.
Changes:
- Introduces
MetaFeatureSettingsViewModelto ownConfigurationOverrideUI state, persistence, and geo database import behavior. - Reworks
MetaFeatureSettingsScreeninto a pure Compose screen that binds to the ViewModel and delegates state updates through an actions interface. - Adds new preference-item overloads to support stateless/value-driven preference wiring (instead of
MutableStatewrite-through).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/src/main/kotlin/com/github/kr328/clash/ui/component/SettingsPreference.kt | Adds value/onValueChange overloads for list/edit-text preference items to better support ViewModel-backed state. |
| app/src/main/kotlin/com/github/kr328/clash/settings/vm/MetaFeatureSettingsViewModel.kt | New ViewModel for loading/patching overrides and importing geo database files. |
| app/src/main/kotlin/com/github/kr328/clash/settings/ui/MetaFeatureSettingsScreen.kt | Converts the previous design-based screen into a ViewModel-backed Compose screen and introduces an actions interface. |
| app/src/main/kotlin/com/github/kr328/clash/settings/MetaFeatureSettingsActivity.kt | Migrates the activity from DesignActivity to BaseActivity + setContent and wires in the ViewModel. |
Comments suppressed due to low confidence (2)
app/src/main/kotlin/com/github/kr328/clash/settings/ui/MetaFeatureSettingsScreen.kt:79
importResultis kept as the latestStateFlowvalue, andLaunchedEffect(importResult)will re-run when the Composable re-enters composition (e.g., configuration change) withimportResult == Success/UnsupportedFormat/Failed, causing the toast/dialog to show again without a new import. Consider modeling import results as one-shot events (SharedFlow/Channel) or clearing/resetting the result after it has been handled (e.g., set back toNotStartonce the toast/dialog is triggered).
app/src/main/kotlin/com/github/kr328/clash/settings/ui/MetaFeatureSettingsScreen.kt:71- Using
stringResource(R.string.geofile_imported)and then calling.format(...)bypasses Android's resource formatting helpers and relies onString.formatbehavior. Prefercontext.getString(R.string.geofile_imported, result.displayName)(orstringResource(R.string.geofile_imported, ...)in composition) so formatting is handled consistently with Android string resources and translations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.