chore:safewrapper consistency and hide countdown overlay before starting recording setup.

This commit is contained in:
Galactic99
2026-04-19 12:57:17 +05:30
parent 7e02856836
commit 4a65ab8171
2 changed files with 20 additions and 11 deletions
+3 -1
View File
@@ -25,12 +25,14 @@ export default function App() {
document.documentElement.style.background = "transparent";
document.getElementById("root")?.style.setProperty("background", "transparent");
}
}, [windowType]);
useEffect(() => {
// Load custom fonts on app initialization
loadAllCustomFonts().catch((error) => {
console.error("Failed to load custom fonts:", error);
});
}, [windowType]);
}, []);
const content = (() => {
switch (windowType) {
+17 -10
View File
@@ -370,15 +370,6 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
};
}, [teardownMedia]);
const cancelCountdown = () => {
const activeRunId = countdownRunId.current;
countdownRunId.current += 1;
setCountdownActive(false);
void window.electronAPI.hideCountdownOverlay(activeRunId).catch((error) => {
console.warn("Failed to hide countdown overlay during cancel:", error);
});
};
const safeShowCountdownOverlay = async (value: number, runId: number) => {
try {
await window.electronAPI.showCountdownOverlay(value, runId);
@@ -389,6 +380,13 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
}
};
const cancelCountdown = () => {
const activeRunId = countdownRunId.current;
countdownRunId.current += 1;
setCountdownActive(false);
void safeHideCountdownOverlay(activeRunId);
};
const safeSetCountdownOverlayValue = async (value: number, runId: number) => {
try {
await window.electronAPI.setCountdownOverlayValue(value, runId);
@@ -436,6 +434,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
return;
}
let overlayHiddenBeforeStart = false;
try {
const values = [3, 2, 1];
const overlayShown = await safeShowCountdownOverlay(values[0], runId);
@@ -464,9 +463,17 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
return;
}
setCountdownActive(false);
await safeHideCountdownOverlay(runId);
overlayHiddenBeforeStart = true;
if (countdownRunId.current !== runId) {
return;
}
await startRecording(runId);
} finally {
if (countdownRunId.current === runId) {
if (!overlayHiddenBeforeStart && countdownRunId.current === runId) {
setCountdownActive(false);
await safeHideCountdownOverlay(runId);
}