feat: Add SharedToggle component and reorganize settings tabs (PR #2)#70
Conversation
**SharedToggle Component** - Create reusable toggle that respects global settings - Show disabled state with optional clickable message - Support help text and custom disabled messages **Settings Reorganization** - Reorganize General tab: Terminal, Bin, Updates, Language, Uninstall, About - Reorganize Data & Security tab: Security, Data Storage, Data Protection - Move Uninstall section from Data & Security to General **Security Settings Updates** - Add allowTerminalsToRunAgentPrompts global setting (default: false) - Rename confirmExternalLLMModifications → allowExternalLLMModifications - Change all security defaults to FALSE (more secure by default) **Implementation Note**: Proper localization for new strings will be added in PR #7. Expected warnings: file_length (535 lines) and type_body_length (409 lines) in SettingsView.swift - will be addressed in PR #7 via view extraction. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code ReviewIssues Found1. 🌍 Hardcoded UI Strings Not LocalizedLocation: Two hardcoded English strings that should use the Strings localization system: Toggle("Allow Terminals to run Agent Prompts", isOn: $allowTerminalsToRunAgentPrompts)
.help("Allow terminals to execute prompts from agent context (global setting)")Issue: These strings will not be translatable to the 40+ supported languages. Reference: CLAUDE.md localization requirements requires all UI strings to use the Pattern: All other settings in this file correctly use
Fix: Add these strings to the 2. 🌍 Hardcoded Default Parameter in SharedToggleLocation: disabledMessage: String = "Disabled globally",Issue: This user-facing default parameter value is a hardcoded English string that won't be translated. Reference: CLAUDE.md localization requirements requires all user-facing strings to be localized. Fix: Either remove the default and require callers to provide localized strings, or use a localized reference like 3. 🐛 AppStorage Key MismatchLocation: @AppStorage("allowExternalLLMModifications") private var allowExternalLLMModifications = falseIssue: The PR renames the key from
Impact: Settings changes in SettingsView will NOT affect the actual behavior in CardEditorView and TermQApp because they're reading from different UserDefaults keys. The UI toggle will appear broken. Fix: Update CardEditorView.swift and TermQApp.swift to use the new key name, or revert this change and rename in a coordinated way across all files. 4. 🐛 Conflicting Default Values for allowOscClipboardLocation: @AppStorage("allowOscClipboard") private var allowOscClipboard = falseIssue: This PR changes the default from Impact: The effective default depends on which view loads first, causing unpredictable behavior for a security-related setting. Fix: Update SummaryFound 4 issues:
All issues should be addressed before merging to maintain code quality and prevent runtime bugs. |
Changes: - Use two-line layout: label + Browse button on line 1, full-width text field on line 2 - Matches PathInputField visual pattern for consistency - Full PathInputField component integration deferred to PR #5 Updated implementation plan to include TermQ Data Folder in PR #5 scope. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
Implements PR #2 from the settings UI improvement plan:
Changes
New Component: SharedToggle
General Tab Reorganization
New section order:
Rationale: Puts most frequently used settings at top, moves destructive action to end
Data & Security Tab Reorganization
New section order:
Rationale: Security settings at top as they're critical, followed by data management
Security Settings Updates
allowTerminalsToRunAgentPrompts(default: false)confirmExternalLLMModifications→allowExternalLLMModificationsallowTerminalsToRunAgentPrompts: falseallowExternalLLMModifications: falseallowOscClipboard: falseImplementation Notes
Localization
Proper localization for new strings (allowTerminalsToRunAgentPrompts) will be added in PR #7.
For now, using placeholder string "Allow Terminals to run Agent Prompts".
Expected Warnings
SwiftLint reports file_length (535 lines) and type_body_length (409 lines) violations in SettingsView.swift.
These are expected and will be resolved in PR #7 when we extract sections into dedicated views.
Testing
make formatNext Steps
🤖 Generated with Claude Code