From eded18a70319dff79f4170388ef99b42ecc015c7 Mon Sep 17 00:00:00 2001
From: Mega Mind <146339422+M3gA-Mind@users.noreply.github.com>
Date: Wed, 8 Apr 2026 03:37:07 +0530
Subject: [PATCH] fix: refresh accessibility onboarding state after macOS grant
(#351) (#420)
* feat: display app version in settings panel
* fix(onboarding): auto-refresh accessibility state after grant (#351)
* style(onboarding): apply formatter for issue #351 fix
* fix(onboarding): ESLint + typed mock for ScreenPermissionsStep; clear flag in handler
Consolidate tauriCommands imports and drop redundant mock cast.
Handle granted accessibility in focus/visibility callback instead of a follow-up effect.
Made-with: Cursor
---
app/src/pages/Settings.tsx | 4 +
.../steps/ScreenPermissionsStep.tsx | 44 +++++-
.../__tests__/ScreenPermissionsStep.test.tsx | 141 ++++++++++++++++++
app/src/utils/config.ts | 4 +
4 files changed, 191 insertions(+), 2 deletions(-)
create mode 100644 app/src/pages/onboarding/steps/__tests__/ScreenPermissionsStep.test.tsx
diff --git a/app/src/pages/Settings.tsx b/app/src/pages/Settings.tsx
index e137c2761..ee4e8e0f6 100644
--- a/app/src/pages/Settings.tsx
+++ b/app/src/pages/Settings.tsx
@@ -27,6 +27,7 @@ import VoicePanel from '../components/settings/panels/VoicePanel';
import WebhooksDebugPanel from '../components/settings/panels/WebhooksDebugPanel';
import SettingsHome from '../components/settings/SettingsHome';
import SettingsSectionPage from '../components/settings/SettingsSectionPage';
+import { APP_VERSION } from '../utils/config';
const accountSettingsItems = [
{
@@ -331,6 +332,9 @@ const Settings = () => {
+ After granting access in System Settings, return here and OpenHuman will refresh + automatically. +
+ ) : null} {lastError ?{lastError}
: null} {status?.permission_check_process_path ? (
diff --git a/app/src/pages/onboarding/steps/__tests__/ScreenPermissionsStep.test.tsx b/app/src/pages/onboarding/steps/__tests__/ScreenPermissionsStep.test.tsx
new file mode 100644
index 000000000..a5258fb68
--- /dev/null
+++ b/app/src/pages/onboarding/steps/__tests__/ScreenPermissionsStep.test.tsx
@@ -0,0 +1,141 @@
+import { configureStore } from '@reduxjs/toolkit';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
+import type { PropsWithChildren } from 'react';
+import { Provider } from 'react-redux';
+import { MemoryRouter } from 'react-router-dom';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import accessibilityReducer from '../../../../store/accessibilitySlice';
+import authReducer from '../../../../store/authSlice';
+import socketReducer from '../../../../store/socketSlice';
+import teamReducer from '../../../../store/teamSlice';
+import userReducer from '../../../../store/userSlice';
+import {
+ type AccessibilityStatus,
+ openhumanAccessibilityRequestPermission,
+ openhumanAccessibilityStatus,
+ restartCoreProcess,
+} from '../../../../utils/tauriCommands';
+import ScreenPermissionsStep from '../ScreenPermissionsStep';
+
+vi.mock('../../../../utils/tauriCommands', async importOriginal => {
+ const actual = await importOriginal