From 490eb546f19cee442e56d2a7586f7eb2a0871920 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:31:26 +1000 Subject: [PATCH] Revert "fix: stop looping startup permission prompts" This reverts commit 158b141c4f2e874a194d0a3a7746996b06ca608b. --- 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, 21 insertions(+), 10 deletions(-) diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsx index 7321b2b2..66cbe608 100644 --- a/src/components/launch/LaunchWindow.tsx +++ b/src/components/launch/LaunchWindow.tsx @@ -78,6 +78,7 @@ function LaunchWindowContent() { setWebcamDeviceId, countdownDelay, setCountdownDelay, + preparePermissions, } = useScreenRecorder(); const { elapsed, formatTime } = useRecordingTimer(recording, paused); @@ -113,7 +114,7 @@ function LaunchWindowContent() { hideHudFromCapture, chooseRecordingsDirectory, toggleHudCaptureProtection, - } = useLaunchWindowSystemState(); + } = useLaunchWindowSystemState(preparePermissions); const hudCaptureProtectionSupported = supportsHudCaptureProtection(platform ?? ""); diff --git a/src/components/launch/hooks/useLaunchWindowSystemState.ts b/src/components/launch/hooks/useLaunchWindowSystemState.ts index 58dc42dd..56793fa3 100644 --- a/src/components/launch/hooks/useLaunchWindowSystemState.ts +++ b/src/components/launch/hooks/useLaunchWindowSystemState.ts @@ -1,6 +1,8 @@ import { useCallback, useEffect, useState } from "react"; -export function useLaunchWindowSystemState() { +export function useLaunchWindowSystemState( + preparePermissions: (args: { startup?: boolean }) => Promise, +) { const [recordingsDirectory, setRecordingsDirectory] = useState(null); const [hudOverlayMousePassthroughSupported, setHudOverlayMousePassthroughSupported] = useState< boolean | null @@ -63,6 +65,10 @@ 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 82984539..45965241 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -135,7 +135,7 @@ type UseScreenRecorderReturn = { pauseRecording: () => void; resumeRecording: () => void; cancelRecording: () => void; - preparePermissions: () => Promise; + preparePermissions: (options?: { startup?: boolean }) => Promise; isMacOS: boolean; microphoneEnabled: boolean; setMicrophoneEnabled: (enabled: boolean) => void; @@ -546,7 +546,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn { micFallbackPauseIntervals.current = []; }, []); - const preparePermissions = useCallback(async () => { + const preparePermissions = useCallback(async (options: { startup?: boolean } = {}) => { const platform = await window.electronAPI.getPlatform(); if (platform !== "darwin") { return true; @@ -556,7 +556,9 @@ export function useScreenRecorder(): UseScreenRecorderReturn { if (!screenPermission.success || screenPermission.status !== "granted") { await window.electronAPI.openScreenRecordingPreferences(); alert( - "Recordly needs Screen Recording permission before you can record. Enable it in System Settings, then quit and reopen Recordly.", + 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.", ); return false; } @@ -577,7 +579,9 @@ export function useScreenRecorder(): UseScreenRecorderReturn { await window.electronAPI.openAccessibilityPreferences(); alert( - "Recordly also needs Accessibility permission for cursor tracking. Enable it in System Settings, then quit and reopen Recordly.", + 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.", ); return false; diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json index eee1c3f0..d4f7aba9 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 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.", + "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.", "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.",