File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#import " JailBrokenHelper.h"
33
44@implementation DetectFrida
5+
6+
57RCT_EXPORT_MODULE ()
68
79// Example method
@@ -47,6 +49,18 @@ - (BOOL)isJailBroken {
4749RCT_REMAP_METHOD (isJailBroken,
4850 isJailBrokenWithResolver:(RCTPromiseResolveBlock)resolve
4951 rejecter:(RCTPromiseRejectBlock)reject) {
52+ [self isJailBroken: resolve reject: reject];
53+ }
54+
55+ RCT_EXPORT_METHOD (closeAppAfterDelay:(double )delay) {
56+ [self closeApp: delay];
57+ }
58+
59+ - (void )detectRoot : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
60+ reject (@" -1" , @" This function is only for Android" , nil );
61+ }
62+
63+ - (void )isJailBroken : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
5064 @try {
5165 BOOL isJailBroken = [self isJailBroken ];
5266 resolve (@{@" isRooted" : @(isJailBroken)});
@@ -57,10 +71,11 @@ - (BOOL)isJailBroken {
5771 }
5872}
5973
60- RCT_EXPORT_METHOD (closeAppAfterDelay:(double )delay) {
61- [self closeApp: delay];
62- }
63-
74+ #ifdef RCT_NEW_ARCH_ENABLED
6475
76+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule : (const facebook::react::ObjCTurboModule::InitParams &)params {
77+ return std::make_shared<facebook::react::NativeDetectFridaSpecJSI>(params);
78+ }
6579
80+ #endif
6681@end
Original file line number Diff line number Diff line change 168168 "jsSrcsDir" : " src" ,
169169 "android" : {
170170 "javaPackageName" : " com.detectfrida"
171+ },
172+ "ios" : {
173+ "modulesProvider" : {
174+ "DetectFrida" : " DetectFrida"
175+ }
171176 }
172177 }
173178}
Original file line number Diff line number Diff line change 1- import type { TurboModule } from 'react-native' ;
1+ import { type TurboModule } from 'react-native' ;
22import { TurboModuleRegistry } from 'react-native' ;
33
44export interface Spec extends TurboModule {
@@ -21,4 +21,4 @@ export interface Spec extends TurboModule {
2121 closeAppAfterDelay ?( delay : number ) : void ;
2222}
2323
24- export default TurboModuleRegistry . getEnforcing < Spec > ( 'DetectFrida' ) ;
24+ export default TurboModuleRegistry . get < Spec > ( 'DetectFrida' ) ;
Original file line number Diff line number Diff line change 11import { NativeModules , Platform } from 'react-native' ;
22import type { RootCheckResult } from './ValueTypes' ;
3+ import NativeDetectFrida from './NativeDetectFrida' ;
34
4- const LINKING_ERROR =
5- `The package 'react-native-detect-frida' doesn't seem to be linked. Make sure: \n\n` +
6- Platform . select ( { ios : "- You have run 'pod install'\n" , default : '' } ) +
7- '- You rebuilt the app after installing the package\n' +
8- '- You are not using Expo Go\n' ;
9-
10- const DetectFrida = NativeModules . DetectFrida
11- ? NativeModules . DetectFrida
12- : new Proxy (
13- { } ,
14- {
15- get ( ) {
16- throw new Error ( LINKING_ERROR ) ;
17- } ,
18- }
19- ) ;
5+ const DetectFrida = NativeDetectFrida
6+ ? NativeDetectFrida
7+ : NativeModules . DetectFrida ;
208
219const isAndroid = ( ) => {
2210 return Platform . OS === 'android' ;
You can’t perform that action at this time.
0 commit comments