react-native-device-defense 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,10 +20,12 @@ buildscript {
20
20
  }
21
21
  dependencies {
22
22
  classpath('com.android.tools.build:gradle:7.4.2')
23
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.8.0')}")
23
24
  }
24
25
  }
25
26
 
26
27
  apply plugin: 'com.android.library'
28
+ apply plugin: 'kotlin-android'
27
29
  apply plugin: 'com.facebook.react'
28
30
 
29
31
  android {
@@ -81,6 +83,7 @@ android {
81
83
 
82
84
  dependencies {
83
85
  implementation 'com.facebook.react:react-native:+'
86
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion', '1.8.0')}"
84
87
 
85
88
  // RootBeer for root detection
86
89
  implementation 'com.scottyab:rootbeer-lib:0.1.1'
@@ -370,7 +370,7 @@ class DeviceSecurityModule(reactContext: ReactApplicationContext) :
370
370
 
371
371
  // Show alert if requested
372
372
  if (showAlert) {
373
- val activity = currentActivity
373
+ val activity = getCurrentActivity()
374
374
  activity?.runOnUiThread {
375
375
  android.app.AlertDialog.Builder(activity)
376
376
  .setCancelable(false)
@@ -384,7 +384,7 @@ class DeviceSecurityModule(reactContext: ReactApplicationContext) :
384
384
  }
385
385
  } else {
386
386
  // Exit without alert
387
- currentActivity?.finishAffinity()
387
+ getCurrentActivity()?.finishAffinity()
388
388
  System.exit(0)
389
389
  }
390
390
  } else {
@@ -19,40 +19,4 @@ class DeviceSecurityPackage : ReactPackage {
19
19
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
20
20
  return emptyList()
21
21
  }
22
-
23
- override fun getModuleInfoProvider(): ReactModuleInfoProvider {
24
- return ReactModuleInfoProvider {
25
- val moduleInfo: MutableMap<String, ReactModuleInfo> = java.util.HashMap()
26
-
27
- val methods = listOf(
28
- "isRooted",
29
- "isRootedWithDetails",
30
- "hasFrida",
31
- "hasXposed",
32
- "hasMagisk",
33
- "isDebuggable",
34
- "isEmulator",
35
- "getSecurityStatus",
36
- "isDeviceSecure",
37
- "blockOnSecurityThreat"
38
- )
39
-
40
- val constants = listOf("NAME", "NATIVE_LIBRARY_LOADED")
41
-
42
- moduleInfo["DeviceSecurity"] = ReactModuleInfo(
43
- "DeviceSecurity",
44
- "DeviceSecurity",
45
- false, // isTurboModule
46
- false, // isCxxModule
47
- true, // canOverrideExistingModule
48
- methods,
49
- constants,
50
- false, // supportsEventEmitter
51
- false, // needsDispatchEvent
52
- true // hasConstants
53
- )
54
-
55
- moduleInfo
56
- }
57
- }
58
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-device-defense",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Multi-layer device security detection for React Native (root, hook, debugger, emulator detection)",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",