Skip to content

Refresh permission warnings after returning to Speaky - #6

Open
amrshawqy wants to merge 2 commits into
bedriyan:mainfrom
amrshawqy:fix/refresh-permission-status
Open

Refresh permission warnings after returning to Speaky#6
amrshawqy wants to merge 2 commits into
bedriyan:mainfrom
amrshawqy:fix/refresh-permission-status

Conversation

@amrshawqy

Copy link
Copy Markdown

Summary

Refresh Speaky's permission-dependent state when the app becomes active so the main-window warning clears automatically after a user grants access in System Settings.

This keeps permission handling responsive without adding another timer or polling loop.

Problem

The Settings screen already rechecks macOS permissions, but the main warning banner is backed by AppState.permissionWarning, which was only refreshed at launch. As a result:

  • a user could grant Microphone and Accessibility access in System Settings;
  • the Settings screen would show both permissions as granted;
  • the main window could continue showing the stale "Accessibility access is missing" warning until it was dismissed or Speaky was restarted.

With the global Escape work in #5, a second piece of state also needs refreshing: if the active Escape event tap could not be created before Accessibility was granted, Speaky should retry it after the user returns.

Changes

  • Refresh the central permission state when Speaky becomes active.
  • Recheck Microphone and Accessibility status in one AppState method.
  • Retry the active Escape event tap only when Accessibility is granted.
  • Remove the passive global Escape fallback once the active tap is recovered, preventing duplicate monitoring.
  • Keep warning selection in a small pure function and cover every state with focused tests.

Scope

The production change is limited to three existing files:

  • AppState.swift
  • HotkeyManager.swift
  • SpeakyApp.swift

One focused test file covers the warning policy. This PR does not reset TCC, alter permission prompts, add background polling, or change signing/build identity.

Validation

Review / merge order

This PR is intentionally stacked on #5 because it refreshes the Escape event-tap state introduced there.

Please merge #5 first. Until then, GitHub will show the #5 commit in this PR as well; after #5 is merged, this PR should reduce to the single permission-refresh commit.

Manual verification

  1. Start Speaky without Accessibility permission and confirm the main warning is visible.
  2. Open Settings > Permissions, choose Grant Access, enable Speaky in macOS System Settings, then return to Speaky.
  3. Confirm the Settings status changes to Granted and the main warning disappears without a restart or manual dismissal.
  4. Start recording while another app is focused, press Escape, and confirm global cancellation still works.

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.

1 participant