From 194c5de45d287d82a6ea55b14409789e88022fc7 Mon Sep 17 00:00:00 2001 From: Lethe <37437842+0xlethe@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:13:48 +0900 Subject: [PATCH 1/3] feat: iOS background prevent --- example/0.73/src/Main.tsx | 28 ++++-- example/under0.73/src/Main.tsx | 13 +++ ios/CaptureProtection.mm | 96 ++++++++++++++++++- .../project.pbxproj | 4 +- package.json | 2 +- react-native-capture-protection.podspec | 2 +- src/index.tsx | 16 ++++ 7 files changed, 145 insertions(+), 16 deletions(-) diff --git a/example/0.73/src/Main.tsx b/example/0.73/src/Main.tsx index a96d179..0149e73 100644 --- a/example/0.73/src/Main.tsx +++ b/example/0.73/src/Main.tsx @@ -1,13 +1,13 @@ import * as React from 'react'; -import { StyleSheet, View, Button, Text } from 'react-native'; +import {StyleSheet, View, Button, Text} from 'react-native'; import { CaptureProtection, CaptureProtectionModuleStatus, useCaptureProtection, } from 'react-native-capture-protection'; -import { useNavigation } from '@react-navigation/native'; +import {useNavigation} from '@react-navigation/native'; export default function Main() { - const { isPrevent, status } = useCaptureProtection(); + const {isPrevent, status} = useCaptureProtection(); const navigation = useNavigation(); React.useEffect(() => { @@ -16,19 +16,19 @@ export default function Main() { React.useEffect(() => { console.log( 'Main Prevent Status is', - status ? CaptureProtectionModuleStatus?.[status] : undefined + status ? CaptureProtectionModuleStatus?.[status] : undefined, ); }, [status]); return ( - + {'Record Prevent : ' + isPrevent?.record} - + {'Screenshot Prevent : ' + isPrevent?.screenshot} - + {'Status : ' + (status ? CaptureProtectionModuleStatus?.[status] : undefined)} @@ -36,7 +36,7 @@ export default function Main() { title="set Record Protect Screen by Text" onPress={() => { CaptureProtection.setScreenRecordScreenWithText?.( - 'This is Text Message!' + 'This is Text Message!', ); }} /> @@ -70,6 +70,18 @@ export default function Main() { CaptureProtection.preventScreenshot(); }} /> +