mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 07:16:02 +00:00
fix: stop looping startup permission prompts
This commit is contained in:
@@ -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 ?? "");
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
export function useLaunchWindowSystemState(
|
||||
preparePermissions: (args: { startup?: boolean }) => Promise<unknown>,
|
||||
) {
|
||||
export function useLaunchWindowSystemState() {
|
||||
const [recordingsDirectory, setRecordingsDirectory] = useState<string | null>(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 () => {
|
||||
|
||||
@@ -135,7 +135,7 @@ type UseScreenRecorderReturn = {
|
||||
pauseRecording: () => void;
|
||||
resumeRecording: () => void;
|
||||
cancelRecording: () => void;
|
||||
preparePermissions: (options?: { startup?: boolean }) => Promise<boolean>;
|
||||
preparePermissions: () => Promise<boolean>;
|
||||
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;
|
||||
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user