-
-
Notifications
You must be signed in to change notification settings - Fork 10
method
Platform: iOS v1.5.0⬆️
, Android v1.5.0⬆️
Context Api Provider
recommend use top-level
export default function App() {
return (
<CaptureProtectionProvider>
<NavigationContainer>
{...}
</NavigationContainer>
</CaptureProtectionProvider>
);
}
Platform: iOS v1.5.0⬆️
, Android v1.5.0⬆️
custom hook with CaptureProtectionProvider
it return isPrevent
, status
as var, bindProtection
, releaseProtection
as function
releaseProtection(rollback?:boolean)
return allow all capture event
bindProtection()
return prevent all capture event
const { isPrevent, status, bindProtection, releaseProtection } = useCaptureProtection();
React.useEffect(() => {
bindProtection();
return () => {
releaseProtection(true);
};
}, []);
...
Platform: iOS
, Android v1.9.2⬆️
CaptureProtection.addEventListener(({ status, isPrevent }) => {
// do event
});
Platform: iOS
setting record protect screen
when draw preventScreenRecord
and screen is recording
CaptureProtection.setScreenRecordScreenWithText("WRITE_TEXT");
Platform: iOS
setting record protect screen
when draw preventScreenRecord
and screen is recording
CaptureProtection.setScreenRecordScreenWithImage(require("image.png"));
Platform: iOS
, Android v1.1.0⬆️
disable prevent screenshot event, if use true
parameter, remove take screenshot event
// only allow screenshot
await CaptureProtection.allowScreenshot();
// allow screenshot and remove listener
await CaptureProtection.allowScreenshot(true);
Platform: iOS
, Android v1.1.0⬆️
prevent screenshot event, if user take screenshot, screenshot image will show black screen
await CaptureProtection.preventScreenshot();
Platform: iOS
, Android v1.1.0⬆️
disable prevent screen recording event, if use true
parameter, remove take screen recording event
// only allow screen recording
await CaptureProtection.allowScreenRecord();
// allow screen recording and remove listener
await CaptureProtection.allowScreenRecord(true);
Platform: iOS
, Android v1.1.0⬆️
prevent screen recording event, if user recording screen, screen change record protect screen
when prevent recording to already record, use true
parameter
// prevent screen record
await CaptureProtection.preventScreenRecord();
// prevent screen record, if user already record, change immediate
await CaptureProtection.preventScreenRecord(true);
Platform: iOS
, Android v1.9.2⬆️
regist screenshot listener
await CaptureProtection.addScreenshotListener();
Platform: iOS
, Android v1.9.2⬆️
remove screenshot listener
await CaptureProtection.removeScreenshotListener();
Platform: iOS
regist screen record listener
await CaptureProtection.addScreenRecordListener();
Platform: iOS
remove screen record listener
await CaptureProtection.removeScreenRecordListener();
Platform: iOS
, Android v1.9.2⬆️
return listener regist status
const captureListener = await CaptureProtection.hasListener();
if (captureListener?.record) {
// record listener is exist
}
if (captureListener?.screenshot) {
// screenshot listener is exist
}
Platform: iOS
return user recoding screen now
const isScreenRecord = await CaptureProtection.isScreenRecording();
if (isScreenRecord) {
// user already recoding
}
Platform: iOS
, Android v1.1.0⬆️
return prevent event status
const preventStatus = await CaptureProtection.getPreventStatus();
if (preventStatus?.record) {
// screen record is prevent
}
if (preventStatus?.screenshot) {
// screenshot is prevent
}