Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/main/ipc/developer-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,32 @@ async function requestPermission(
}

if (id === 'microphone' || id === 'camera') {
// Why: askForMediaAccess only surfaces the TCC prompt when status is
// 'not-determined'. If the user previously denied (or macOS set the status
// to 'denied'/'restricted'), it resolves false with no prompt — leaving
// the user stuck. Fall through to the Privacy pane so they can toggle it.
const granted = await systemPreferences.askForMediaAccess(id)
return { id, status: granted ? 'granted' : getMediaStatus(id), openedSystemSettings: false }
if (granted) {
return { id, status: 'granted', openedSystemSettings: false }
}
const status = getMediaStatus(id)
if (status === 'denied' || status === 'restricted' || status === 'unknown') {
await openPrivacyPane(id)
return { id, status, openedSystemSettings: true }
}
return { id, status, openedSystemSettings: false }
}

if (id === 'accessibility') {
systemPreferences.isTrustedAccessibilityClient(true)
return { id, status: getAccessibilityStatus(), openedSystemSettings: false }
// Why: isTrustedAccessibilityClient(true) shows the prompt only the first
// time for a given bundle. Once the user has dismissed or denied, calling
// it again is a no-op. Fall through to the Privacy pane when not granted.
const trusted = systemPreferences.isTrustedAccessibilityClient(true)
if (trusted) {
return { id, status: 'granted', openedSystemSettings: false }
}
await openPrivacyPane(id)
return { id, status: getAccessibilityStatus(), openedSystemSettings: true }
}

if (id === 'automation') {
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ export function DeveloperPermissionsPane(): React.JSX.Element {
void refresh()
}, [refresh])

// Why: after the user flips a permission in System Settings and switches
// back to Orca, the chip should reflect the new status without a manual
// Refresh click. Tied to window focus rather than a polling interval so
// we don't keep hammering `systemPreferences` while the pane is idle.
useEffect(() => {
const onFocus = (): void => {
void refresh()
}
window.addEventListener('focus', onFocus)
return () => window.removeEventListener('focus', onFocus)
}, [refresh])

const request = async (id: DeveloperPermissionId): Promise<void> => {
setPendingId(id)
try {
Expand Down
Loading