fix(desktop): restore Device Settings page in settings sidebar#5926
fix(desktop): restore Device Settings page in settings sidebar#5926jschulman wants to merge 2 commits intoBasedHardware:mainfrom
Conversation
The Device settings section was accidentally removed in commit 43bc936 ("Fix desktop onboarding reset scoping" BasedHardware#5604), making it impossible to pair a BLE device from the macOS desktop app. Restores: - `case device = "Device"` in SettingsSection enum - DeviceSettingsPage() rendering in the settings switch - `selectedSettingsSection = .device` in navigateToDeviceSettings handler Fixes BasedHardware#5917 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR restores the Device Settings page that was accidentally dropped in #5604, re-enabling the only UI path for BLE device pairing on the macOS desktop app. The two-file change is correct in intent — re-adding Key findings:
Confidence Score: 2/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Device Widget\nin sidebar] -->|NotificationCenter\n.navigateToDeviceSettings| B[DesktopHomeView\nonReceive handler]
B --> C[selectedSettingsSection = .device ✅ restored]
C --> D[withAnimation\nselectedIndex = settings]
D --> E[SettingsSidebar renders\nSettingsSection.allCases]
E --> F{SettingsSidebarItem\nicon switch}
F -->|case .device ❌ missing| G[Compile Error]
F -->|all other cases| H[Sidebar item rendered]
H --> I[User selects Device section]
I --> J[SettingsContentView\nswitch selectedSection]
J -->|case .device ✅ restored| K[DeviceSettingsPage]
Reviews (1): Last reviewed commit: "fix(desktop): restore Device Settings pa..." | Re-trigger Greptile |
|
|
||
| enum SettingsSection: String, CaseIterable { | ||
| case general = "General" | ||
| case device = "Device" |
There was a problem hiding this comment.
Missing
.device case in SettingsSidebarItem.icon switch
Adding .device to SettingsSection (a CaseIterable enum with no default arm) will break exhaustive-switch compilation in SettingsSidebar.swift. The SettingsSidebarItem.icon computed property has a non-exhaustive switch over all SettingsSection cases (lines 317–329 of SettingsSidebar.swift):
private var icon: String {
switch section {
case .general: return "gearshape"
case .rewind: return "clock.arrow.circlepath"
// ... 9 more cases — but no .device, and no default
}
}Because .device is not listed and there is no default branch, the Swift compiler will emit a compile-time error ("switch must be exhaustive") when this case is added. The fix is to add a .device branch to that switch in SettingsSidebar.swift:
case .device: return "antenna.radiowaves.left.and.right"A suitable SF Symbol is "antenna.radiowaves.left.and.right" or "dot.radiowaves.left.and.right" to represent a Bluetooth/wireless device.
|
|
||
| enum SettingsSection: String, CaseIterable { | ||
| case general = "General" | ||
| case device = "Device" |
There was a problem hiding this comment.
Device section absent from settings search index
SettingsSearchItem.allSearchableItems in SettingsSidebar.swift (lines 19–130) is a static list that maps settings to searchable keywords. It includes entries for every section (General, Rewind, Transcription, …) but has no entries for the restored .device section. As a result, typing "bluetooth", "pair", "device", or "BLE" in the Settings search bar will return no results and users have no search-based path to reach the Device page.
Consider adding at least one entry, e.g.:
SettingsSearchItem(
name: "Device",
subtitle: "Pair and manage your Bluetooth device",
keywords: ["bluetooth", "ble", "pair", "device", "scan", "connect"],
section: .device,
icon: "antenna.radiowaves.left.and.right",
settingId: "device.device"
),Addresses Greptile review feedback: - Add case .device icon to exhaustive switch (fixes compile error) - Add device/bluetooth/firmware search items so users can find device settings via the search bar Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Updated to fix compile error flagged by Greptile — added |
Summary
43bc936b)Changes (4 lines added)
SettingsPage.swift:case device = "Device"in theSettingsSectionenumDeviceSettingsPage()rendering in the settings content switchDesktopHomeView.swift:selectedSettingsSection = .devicein thenavigateToDeviceSettingsnotification handler (so clicking the device widget navigates to Device settings instead of defaulting to General)Test plan
Fixes #5917
🤖 Generated with Claude Code