Skip to content

fix(desktop): restore Device Settings page in settings sidebar#5926

Open
jschulman wants to merge 2 commits intoBasedHardware:mainfrom
jschulman:fix/restore-device-settings-page
Open

fix(desktop): restore Device Settings page in settings sidebar#5926
jschulman wants to merge 2 commits intoBasedHardware:mainfrom
jschulman:fix/restore-device-settings-page

Conversation

@jschulman
Copy link
Copy Markdown

Summary

Changes (4 lines added)

SettingsPage.swift:

  • Restores case device = "Device" in the SettingsSection enum
  • Restores DeviceSettingsPage() rendering in the settings content switch

DesktopHomeView.swift:

  • Restores selectedSettingsSection = .device in the navigateToDeviceSettings notification handler (so clicking the device widget navigates to Device settings instead of defaulting to General)

Test plan

  • Launch desktop app with a paired device
  • Click the device widget in the sidebar → should navigate to Settings > Device (not General)
  • Verify "Device" appears in the Settings sidebar between General and Rewind
  • Verify scan/pair functionality works from the Device settings page

Fixes #5917

🤖 Generated with Claude Code

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-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This 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 case device to the SettingsSection enum and restoring the selectedSettingsSection = .device assignment in the notification handler — but it is incomplete: the SettingsSidebarItem.icon switch in SettingsSidebar.swift is exhaustive with no default arm and is not updated for the new case, which will produce a compile-time error.

Key findings:

  • P0 – Compile error: SettingsSidebar.swift's SettingsSidebarItem.icon switch covers every SettingsSection case exhaustively with no default. Adding .device without also adding case .device: return "<sfSymbol>" to that switch will prevent the project from building.
  • P2 – Search not indexed: SettingsSearchItem.allSearchableItems has no entries for the .device section, so searching for "bluetooth", "pair", or "BLE" in the Settings search bar returns nothing.

Confidence Score: 2/5

  • Not safe to merge — the PR will not compile as-is due to an unhandled enum case in an exhaustive switch in SettingsSidebar.swift.
  • The fix is a one-liner away from being correct, but the missing .device case in the SettingsSidebarItem.icon switch is a hard compile error that blocks the build entirely.
  • desktop/Desktop/Sources/MainWindow/SettingsSidebar.swift — needs a case .device branch added to the icon switch and ideally a search entry in allSearchableItems.

Important Files Changed

Filename Overview
desktop/Desktop/Sources/MainWindow/Pages/SettingsPage.swift Adds case device = "Device" to SettingsSection enum and routes it to DeviceSettingsPage() — correct intent, but the companion exhaustive switch in SettingsSidebar.swift is not updated, causing a compile error.
desktop/Desktop/Sources/MainWindow/DesktopHomeView.swift Restores selectedSettingsSection = .device before the animation so the navigateToDeviceSettings notification correctly lands on the Device tab instead of defaulting to General. Change is correct and consistent with how other navigation handlers (.rewind, .floatingBar, etc.) are implemented.

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]
Loading

Reviews (1): Last reviewed commit: "fix(desktop): restore Device Settings pa..." | Re-trigger Greptile


enum SettingsSection: String, CaseIterable {
case general = "General"
case device = "Device"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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>
@jschulman
Copy link
Copy Markdown
Author

Updated to fix compile error flagged by Greptile — added case .device to the exhaustive icon switch in SettingsSidebar.swift and restored device search items. Ready for re-review.

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.

macOS: Device Settings page unreachable - cannot pair BLE device

1 participant