react-native-device-defense 1.0.4 → 1.0.6

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.
@@ -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 = reactApplicationContext.currentActivity
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
+ reactApplicationContext.currentActivity?.finishAffinity()
388
388
  System.exit(0)
389
389
  }
390
390
  } else {
@@ -10,6 +10,7 @@ import com.facebook.react.uimanager.ViewManager
10
10
  /**
11
11
  * React Native package for device security module
12
12
  */
13
+ @Suppress("DEPRECATION")
13
14
  class DeviceSecurityPackage : ReactPackage {
14
15
 
15
16
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
@@ -19,40 +20,4 @@ class DeviceSecurityPackage : ReactPackage {
19
20
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
20
21
  return emptyList()
21
22
  }
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
23
  }
@@ -115,6 +115,7 @@ class EmulatorDetection(private val context: Context) {
115
115
  /**
116
116
  * Check for emulator features
117
117
  */
118
+ @Suppress("DEPRECATION", "MissingPermission")
118
119
  private fun checkEmulatorFeatures(): Boolean {
119
120
  try {
120
121
  val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-device-defense",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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",