Repository navigation
Fix desktop notification permission settings row #6960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
austinywang
merged 30 commits into
main
from
issue-5919-settings-desktop-notifications-row-stuck-on-p
Jul 28, 2026
Merged
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
3777d83
Add failing desktop notification settings test
306d4ef
Fix desktop notification permission settings row
8b5c288
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
71c057d
Retrigger Vercel checks
974de6b
Address notification settings review feedback
07781fe
Stabilize app host regression tests
2990e02
Address file explorer cancellation cleanup
3b65799
Fix Claude stream accumulator delta accounting
7f9d45f
Use revision guard for file explorer loads
972e886
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
08b736e
Stabilize app host appearance tests
7928b0f
Fix panel background test import boundary
8571f47
Update hook persistence expectations
e8a3ae5
Stabilize CLI integration process capture
7176c4c
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 0e3ca21
Cover BrowserPanel ghostty-background subscription via injected center
austinywang 89d9c0e
Remove BrowserPanel test-only background seam
austinywang d3fdf04
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang d89f1be
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 8836294
Capture content revision before prefetch debounce
austinywang a24c9ed
Refresh Swift file length budget for prefetch revision capture
austinywang 2f56dac
Make chrome/panel background tests independent oracles; cover provisi…
austinywang e7ae720
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 4b697f1
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 70d38ef
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 95c4b59
Merge origin/main into issue-5919-settings-desktop-notifications-row-…
austinywang a2ae99b
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang 5eafea6
Make screenshot recovery test deterministic
austinywang d74fb67
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang ff63482
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
49 changes: 49 additions & 0 deletions
49
...muxSettingsUI/Sources/CmuxSettingsUI/Bindings/DesktopNotificationAuthorizationModel.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import Observation | ||
|
|
||
| /// `@Observable` view-model for the host's live macOS notification permission state. | ||
| @MainActor | ||
| @Observable | ||
| final class DesktopNotificationAuthorizationModel { | ||
| /// The most recent authorization state supplied by the host. | ||
| private(set) var current: DesktopNotificationAuthorizationState = .unknown | ||
|
|
||
| @ObservationIgnored private let currentStatus: () -> DesktopNotificationAuthorizationState | ||
| @ObservationIgnored private let makeStream: () -> AsyncStream<DesktopNotificationAuthorizationState> | ||
| @ObservationIgnored private let refreshStatus: () -> Void | ||
| @ObservationIgnored private let driver = SettingReadDriver<DesktopNotificationAuthorizationState>() | ||
| @ObservationIgnored private var hasStarted = false | ||
|
|
||
| /// Creates a model bound to the host's desktop-notification authorization stream. | ||
| /// | ||
| /// - Parameter hostActions: The host bridge that supplies the current state, | ||
| /// refreshes from `UNUserNotificationCenter`, and emits later changes. | ||
| convenience init(hostActions: SettingsHostActions) { | ||
| self.init( | ||
| currentStatus: { hostActions.desktopNotificationAuthorizationStatus() }, | ||
| makeStream: { hostActions.desktopNotificationAuthorizationStatusUpdates() }, | ||
| refreshStatus: { hostActions.refreshDesktopNotificationAuthorizationStatus() } | ||
| ) | ||
| } | ||
|
|
||
| init( | ||
| currentStatus: @escaping () -> DesktopNotificationAuthorizationState, | ||
| makeStream: @escaping () -> AsyncStream<DesktopNotificationAuthorizationState>, | ||
| refreshStatus: @escaping () -> Void | ||
| ) { | ||
| self.currentStatus = currentStatus | ||
| self.makeStream = makeStream | ||
| self.refreshStatus = refreshStatus | ||
| } | ||
|
|
||
| /// Starts live observation and asks the host to refresh the OS permission state. | ||
| func startObserving() { | ||
| current = currentStatus() | ||
| if !hasStarted { | ||
| hasStarted = true | ||
| driver.activate(makeStream) { [weak self] state in | ||
| self?.current = state | ||
| } | ||
| } | ||
| refreshStatus() | ||
| } | ||
| } | ||
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
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
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
15 changes: 15 additions & 0 deletions
15
...muxSettingsUI/Sources/CmuxSettingsUI/Sections/DesktopNotificationAuthorizationState.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /// Host-provided macOS notification authorization state for the Settings UI. | ||
| public enum DesktopNotificationAuthorizationState: Equatable, Sendable { | ||
| /// The host has not reported a concrete permission state yet. | ||
| case unknown | ||
| /// macOS has not asked the user for permission yet. | ||
| case notDetermined | ||
| /// macOS allows cmux to deliver desktop notifications. | ||
| case authorized | ||
| /// macOS blocks cmux desktop notifications. | ||
| case denied | ||
| /// macOS allows quiet desktop notification delivery. | ||
| case provisional | ||
| /// macOS granted temporary notification delivery. | ||
| case ephemeral | ||
| } |
4 changes: 4 additions & 0 deletions
4
.../CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/DesktopNotificationPermissionAction.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| enum DesktopNotificationPermissionAction: Equatable, Sendable { | ||
| case requestAuthorization | ||
| case openSystemSettings | ||
| } |
96 changes: 96 additions & 0 deletions
96
...ettingsUI/Sources/CmuxSettingsUI/Sections/DesktopNotificationPermissionPresentation.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import Foundation | ||
|
|
||
| struct DesktopNotificationPermissionPresentation: Equatable, Sendable { | ||
| var statusLabel: DesktopNotificationPermissionStatusLabel | ||
| var subtitle: DesktopNotificationPermissionSubtitle? | ||
| var primaryAction: DesktopNotificationPermissionAction? | ||
| var sendTestEnabled: Bool | ||
|
|
||
| static func make( | ||
| for state: DesktopNotificationAuthorizationState | ||
| ) -> DesktopNotificationPermissionPresentation { | ||
| switch state { | ||
| case .unknown: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .unknown, | ||
| subtitle: nil, | ||
| primaryAction: nil, | ||
| sendTestEnabled: false | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| case .notDetermined: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .notRequested, | ||
| subtitle: .notDetermined, | ||
| primaryAction: .requestAuthorization, | ||
| sendTestEnabled: false | ||
| ) | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| case .authorized: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .allowed, | ||
| subtitle: .allowed, | ||
| primaryAction: .openSystemSettings, | ||
| sendTestEnabled: true | ||
| ) | ||
| case .denied: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .denied, | ||
| subtitle: .denied, | ||
| primaryAction: .openSystemSettings, | ||
| sendTestEnabled: false | ||
| ) | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| case .provisional: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .deliverQuietly, | ||
| subtitle: .allowed, | ||
| primaryAction: .openSystemSettings, | ||
| sendTestEnabled: true | ||
| ) | ||
| case .ephemeral: | ||
| return DesktopNotificationPermissionPresentation( | ||
| statusLabel: .temporary, | ||
| subtitle: .allowed, | ||
| primaryAction: .openSystemSettings, | ||
| sendTestEnabled: true | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| var statusText: String { | ||
| switch statusLabel { | ||
| case .unknown: | ||
| return String(localized: "settings.notifications.desktop.status.unknown", defaultValue: "Permission unknown") | ||
| case .notRequested: | ||
| return String(localized: "settings.notifications.desktop.status.notRequested", defaultValue: "Not Requested") | ||
| case .allowed: | ||
| return String(localized: "settings.notifications.desktop.status.allowed", defaultValue: "Allowed") | ||
| case .denied: | ||
| return String(localized: "settings.notifications.desktop.status.denied", defaultValue: "Denied") | ||
| case .deliverQuietly: | ||
| return String(localized: "settings.notifications.desktop.status.deliverQuietly", defaultValue: "Deliver Quietly") | ||
| case .temporary: | ||
| return String(localized: "settings.notifications.desktop.status.temporary", defaultValue: "Temporary") | ||
| } | ||
| } | ||
|
|
||
| var subtitleText: String? { | ||
| guard let subtitle else { return nil } | ||
| switch subtitle { | ||
| case .notDetermined: | ||
| return String(localized: "settings.notifications.desktop.subtitle.notDetermined", defaultValue: "Desktop notifications are not enabled yet.") | ||
| case .allowed: | ||
| return String(localized: "settings.notifications.desktop.subtitle.allowed", defaultValue: "Desktop notifications are enabled.") | ||
| case .denied: | ||
| return String(localized: "settings.notifications.desktop.subtitle.denied", defaultValue: "Desktop notifications are disabled in System Settings.") | ||
| } | ||
| } | ||
|
|
||
| var primaryActionTitle: String? { | ||
| guard let primaryAction else { return nil } | ||
| switch primaryAction { | ||
| case .requestAuthorization: | ||
| return String(localized: "settings.notifications.desktop.action.enable", defaultValue: "Enable") | ||
| case .openSystemSettings: | ||
| return String(localized: "settings.notifications.desktop.action.openSettings", defaultValue: "Open System Settings") | ||
| } | ||
| } | ||
| } | ||
8 changes: 8 additions & 0 deletions
8
...SettingsUI/Sources/CmuxSettingsUI/Sections/DesktopNotificationPermissionStatusLabel.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| enum DesktopNotificationPermissionStatusLabel: Equatable, Sendable { | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| case unknown | ||
| case notRequested | ||
| case allowed | ||
| case denied | ||
| case deliverQuietly | ||
| case temporary | ||
| } | ||
5 changes: 5 additions & 0 deletions
5
...muxSettingsUI/Sources/CmuxSettingsUI/Sections/DesktopNotificationPermissionSubtitle.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| enum DesktopNotificationPermissionSubtitle: Equatable, Sendable { | ||
| case notDetermined | ||
| case allowed | ||
| case denied | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.