From 158b141c4f2e874a194d0a3a7746996b06ca608b Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:28:36 +1000 Subject: [PATCH] fix: stop looping startup permission prompts --- src/components/launch/LaunchWindow.tsx | 3 +-- .../launch/hooks/useLaunchWindowSystemState.ts | 8 +------- src/hooks/useScreenRecorder.ts | 12 ++++-------- src/i18n/locales/en/launch.json | 8 ++++---- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsx index 66cbe608..7321b2b2 100644 --- a/src/components/launch/LaunchWindow.tsx +++ b/src/components/launch/LaunchWindow.tsx @@ -78,7 +78,6 @@ function LaunchWindowContent() { setWebcamDeviceId, countdownDelay, setCountdownDelay, - preparePermissions, } = useScreenRecorder(); const { elapsed, formatTime } = useRecordingTimer(recording, paused); @@ -114,7 +113,7 @@ function LaunchWindowContent() { hideHudFromCapture, chooseRecordingsDirectory, toggleHudCaptureProtection, - } = useLaunchWindowSystemState(preparePermissions); + } = useLaunchWindowSystemState(); const hudCaptureProtectionSupported = supportsHudCaptureProtection(platform ?? ""); diff --git a/src/components/launch/hooks/useLaunchWindowSystemState.ts b/src/components/launch/hooks/useLaunchWindowSystemState.ts index 56793fa3..58dc42dd 100644 --- a/src/components/launch/hooks/useLaunchWindowSystemState.ts +++ b/src/components/launch/hooks/useLaunchWindowSystemState.ts @@ -1,8 +1,6 @@ import { useCallback, useEffect, useState } from "react"; -export function useLaunchWindowSystemState( - preparePermissions: (args: { startup?: boolean }) => Promise, -) { +export function useLaunchWindowSystemState() { const [recordingsDirectory, setRecordingsDirectory] = useState(null); const [hudOverlayMousePassthroughSupported, setHudOverlayMousePassthroughSupported] = useState< boolean | null @@ -65,10 +63,6 @@ export function useLaunchWindowSystemState( }; }, []); - useEffect(() => { - void preparePermissions({ startup: true }); - }, [preparePermissions]); - useEffect(() => { let cancelled = false; const loadVersion = async () => { diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts index 45965241..82984539 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -135,7 +135,7 @@ type UseScreenRecorderReturn = { pauseRecording: () => void; resumeRecording: () => void; cancelRecording: () => void; - preparePermissions: (options?: { startup?: boolean }) => Promise; + preparePermissions: () => Promise; isMacOS: boolean; microphoneEnabled: boolean; setMicrophoneEnabled: (enabled: boolean) => void; @@ -546,7 +546,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn { micFallbackPauseIntervals.current = []; }, []); - const preparePermissions = useCallback(async (options: { startup?: boolean } = {}) => { + const preparePermissions = useCallback(async () => { const platform = await window.electronAPI.getPlatform(); if (platform !== "darwin") { return true; @@ -556,9 +556,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn { if (!screenPermission.success || screenPermission.status !== "granted") { await window.electronAPI.openScreenRecordingPreferences(); alert( - options.startup - ? "Recordly needs Screen Recording permission before you start. System Settings has been opened. After enabling it, quit and reopen Recordly." - : "Screen Recording permission is still missing. System Settings has been opened again. Enable it, then quit and reopen Recordly before recording.", + "Recordly needs Screen Recording permission before you can record. Enable it in System Settings, then quit and reopen Recordly.", ); return false; } @@ -579,9 +577,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn { await window.electronAPI.openAccessibilityPreferences(); alert( - options.startup - ? "Recordly also needs Accessibility permission for cursor tracking. System Settings has been opened. After enabling it, quit and reopen Recordly." - : "Accessibility permission is still missing. System Settings has been opened again. Enable it, then quit and reopen Recordly before recording.", + "Recordly also needs Accessibility permission for cursor tracking. Enable it in System Settings, then quit and reopen Recordly.", ); return false; diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json index d4f7aba9..eee1c3f0 100644 --- a/src/i18n/locales/en/launch.json +++ b/src/i18n/locales/en/launch.json @@ -67,10 +67,10 @@ "share": "Share" }, "permissions": { - "screenRecordingNeeded": "Recordly needs Screen Recording permission before you start. System Settings has been opened. After enabling it, quit and reopen Recordly.", - "screenRecordingMissing": "Screen Recording permission is still missing. System Settings has been opened again. Enable it, then quit and reopen Recordly before recording.", - "accessibilityNeeded": "Recordly also needs Accessibility permission for cursor tracking. System Settings has been opened. After enabling it, quit and reopen Recordly.", - "accessibilityMissing": "Accessibility permission is still missing. System Settings has been opened again. Enable it, then quit and reopen Recordly before recording.", + "screenRecordingNeeded": "Recordly needs Screen Recording permission before you can record. Enable it in System Settings, then quit and reopen Recordly.", + "screenRecordingMissing": "Recordly still needs Screen Recording permission. Enable it in System Settings, then quit and reopen Recordly.", + "accessibilityNeeded": "Recordly needs Accessibility permission for cursor tracking. Enable it in System Settings, then quit and reopen Recordly.", + "accessibilityMissing": "Recordly still needs Accessibility permission for cursor tracking. Enable it in System Settings, then quit and reopen Recordly.", "selectSource": "Please select a source to record", "systemAudioUnavailable": "System audio is not available for this source. Recording will continue without system audio.", "microphoneDenied": "Microphone access was denied. Recording will continue without microphone audio.",