Fix final 4 resilience edge cases
This commit is contained in:
@@ -23,7 +23,7 @@ import Animated, {
|
||||
FadeIn,
|
||||
FadeOut,
|
||||
withSequence,
|
||||
Easing,
|
||||
withDelay,
|
||||
runOnJS,
|
||||
} from 'react-native-reanimated';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
|
||||
@@ -210,16 +210,8 @@ export default function CameraScreen({
|
||||
if (burstTimerRef.current) clearTimeout(burstTimerRef.current);
|
||||
if (countdownTimerRef.current) clearTimeout(countdownTimerRef.current);
|
||||
if (completionTimerRef.current) clearTimeout(completionTimerRef.current);
|
||||
|
||||
// Clean up any temp files from a partially completed burst
|
||||
for (const uri of burstUris) {
|
||||
try {
|
||||
await FileSystem.deleteAsync(uri, { idempotent: true });
|
||||
} catch (e) {
|
||||
console.warn('Failed to delete temp file on cancel:', e);
|
||||
}
|
||||
}
|
||||
|
||||
const urisToDelete = [...burstUris];
|
||||
|
||||
setCountdown(countdownDuration);
|
||||
setIsCapturing(false);
|
||||
setIsBurstWaiting(false);
|
||||
@@ -228,6 +220,15 @@ export default function CameraScreen({
|
||||
setBurstUris([]);
|
||||
setShowBurstIndicator('');
|
||||
onCancel();
|
||||
|
||||
// Clean up any temp files from a partially completed burst in the background
|
||||
Promise.all(
|
||||
urisToDelete.map(uri =>
|
||||
FileSystem.deleteAsync(uri, { idempotent: true }).catch(e => {
|
||||
console.warn('Failed to delete temp file on cancel:', e);
|
||||
})
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
// 3. Start the countdown on screen load (only when NOT idle)
|
||||
|
||||
Reference in New Issue
Block a user