BlueWallet/hooks/useScreenProtect.ts
2026-02-20 11:21:37 -05:00

27 lines
724 B
TypeScript

import { CaptureProtection } from 'react-native-capture-protection';
import { isDesktop } from '../blue_modules/environment';
import { useCallback } from 'react';
export const useScreenProtect = () => {
const enableScreenProtect = useCallback(async () => {
if (isDesktop) return;
await CaptureProtection.prevent();
}, []);
const disableScreenProtect = useCallback(async () => {
if (isDesktop) return;
await CaptureProtection.allow();
}, []);
const isScreenBeingRecorded = useCallback(async () => {
if (isDesktop) return false;
return await CaptureProtection.isScreenRecording();
}, []);
return {
enableScreenProtect,
disableScreenProtect,
isScreenBeingRecorded,
};
};