Skip to content

Refactor EditableTextList to use Set - #240

Merged
Goooler merged 2 commits into
trunkfrom
use-set-for-edit-list
May 14, 2026
Merged

Goooler merged 2 commits into
trunkfrom
use-set-for-edit-list

Conversation

@Goooler

@Goooler Goooler commented May 14, 2026

Copy link
Copy Markdown
Owner

@Goooler
Goooler force-pushed the use-set-for-edit-list branch from f58d7e4 to b1d4707 Compare May 14, 2026 06:07
@Goooler
Goooler requested a review from Copilot May 14, 2026 06:10

Copilot AI left a comment

Copy link
Copy Markdown

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 EditableTextList screen to use Set<String> instead of List<String> for its values, to align with the patterns used in EditableTextMapScreen and naturally enforce uniqueness of entries. Callers convert at the boundary via toSet()/toList().

Changes:

  • Renamed EditableTextListScreen/editableTextListScreenEntry to EditableTextSetScreen/editableTextSetScreenEntry and switched parameter types from List<String>? to Set<String>?.
  • Added a duplicate guard in the add dialog (!values.contains(newValue)) since list semantics would have allowed duplicates.
  • Updated OverrideSettingsScreen and MetaFeatureSettingsScreen callers to convert between List and Set at the boundary.

Reviewed changes

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

File Description
ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/EditableTextSetScreen.kt Renames screen/entry and changes value collection to Set<String>, adds duplicate guard.
ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/OverrideSettingsScreen.kt Updates caller to use new entry name and converts to/from Set.
ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/MetaFeatureSettingsScreen.kt Updates caller to use new entry name and converts to/from Set.
Comments suppressed due to low confidence (1)

ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/EditableTextSetScreen.kt:47

  • After renaming the screen and entry function to use "Set", the @Serializable NavKey data class is still named EditableTextList and its property is initialValues (not e.g. initialValues: Set). Renaming the class to EditableTextSet would keep naming consistent with the rest of the file (EditableTextSetScreen, editableTextSetScreenEntry). This is a non-breaking change since the type is internal.

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

@Goooler
Goooler merged commit 1354b6f into trunk May 14, 2026
3 checks passed
@Goooler
Goooler deleted the use-set-for-edit-list branch May 14, 2026 06:12
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