com.cprot.ead 1.0.7207 → 1.0.7845

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.
@@ -87,5 +87,5 @@ project.afterEvaluate {
87
87
  dependencies {
88
88
  implementation("com.facebook.react:react-native:+")
89
89
  implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
90
- implementation("com.cprot:ead:1.0.7206")
90
+ implementation("com.cprot:ead:1.0.7845")
91
91
  }
@@ -88,6 +88,16 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
88
88
  }
89
89
  }
90
90
 
91
+ @ReactMethod
92
+ fun setCurrentActivity() {
93
+ val currentActivity = reactApplicationContext.currentActivity
94
+ module?.let {
95
+ if(currentActivity != null) {
96
+ it.setCurrentActivity(currentActivity)
97
+ }
98
+ }
99
+ }
100
+
91
101
  @ReactMethod
92
102
  fun addEvent() {
93
103
  val currentActivity = reactApplicationContext.currentActivity
@@ -265,7 +275,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
265
275
  } catch (e: Exception) {
266
276
  promise.resolve("")
267
277
  }
268
- }
278
+ }
269
279
 
270
280
  @ReactMethod
271
281
  fun getIntCurrentCallStatus(promise: Promise) {
@@ -277,7 +287,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
277
287
  } catch (e: Exception) {
278
288
  promise.reject("GET_CALL_STATUS_ERROR", "Failed to get current call status", e)
279
289
  }
280
- }
290
+ }
281
291
 
282
292
  @ReactMethod
283
293
  fun getDexCRC(promise: Promise) {
@@ -321,7 +331,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
321
331
  sb.append("\"isSuspiciousWifi\":").append(securityCheck.isPotentialEvilTwin()).append(",")
322
332
  sb.append("\"isKeyboardAppChanged\":").append(securityCheck.isKeyboardAppChanged())
323
333
  sb.append("}")
324
-
334
+
325
335
  val jsonString = sb.toString()
326
336
  promise.resolve(jsonString)
327
337
  } else {
@@ -408,10 +418,6 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
408
418
  override fun onThreatDetected(infectedApps: ArrayList<InfectedApp>) {
409
419
  sendLogEvent("Threat detected: $infectedApps")
410
420
 
411
- if (ConstHelper.DetectedThreats == null) {
412
- ConstHelper.DetectedThreats = ArrayList<String>()
413
- }
414
-
415
421
  for (infectedApp in infectedApps) {
416
422
  if (ConstHelper.DetectedThreats.contains(infectedApp.getPackageName())) {
417
423
  continue
@@ -438,8 +444,14 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
438
444
 
439
445
  CoroutineScope(Dispatchers.Main).launch {
440
446
  try {
447
+ val currentActivity = reactApplicationContext.currentActivity
448
+ if (currentActivity == null) {
449
+ sendLogEvent("Error: No valid Activity available to show uninstall dialog")
450
+ return@launch
451
+ }
452
+
441
453
  val uninstallHandler = UninstallHandler(
442
- context = reactApplicationContext,
454
+ context = currentActivity,
443
455
  installedAppName = infectedApp.getName() ?: "Unknown App",
444
456
  installedAppPackageName = infectedApp.getPackageName(),
445
457
  installedAppVersion = infectedApp.getVersion() ?: "Unknown Version",
@@ -468,7 +480,7 @@ class CProtEadModuleModule(reactContext: ReactApplicationContext) :
468
480
  if (incomingNumber != null) {
469
481
  isSpam = incomingNumber.isSpam
470
482
  }
471
-
483
+
472
484
  sendLogEvent("Incoming Call detected: $phoneNumber -> Is Spam: $isSpam")
473
485
  }
474
486
 
@@ -1,43 +1,43 @@
1
1
  package com.cproteadmodule
2
2
 
3
+ import android.app.Activity
3
4
  import android.app.AlertDialog
4
- import android.content.Context
5
5
  import android.content.Intent
6
6
  import com.cprot.ead.helpers.StringHelper
7
7
  import java.io.File
8
8
 
9
9
  class UninstallHandler(
10
- private val context: Context,
11
- private val installedAppName: String? = "",
12
- private val installedAppPackageName: String? = "",
13
- private val installedAppVersion: String? = "",
14
- private val threatName: String? = ""
10
+ private val context: Activity,
11
+ private val installedAppName: String? = "",
12
+ private val installedAppPackageName: String? = "",
13
+ private val installedAppVersion: String? = "",
14
+ private val threatName: String? = ""
15
15
  ) {
16
16
 
17
- fun showDialog() {
18
- val packageName = installedAppPackageName ?: return
17
+ fun showDialog() {
18
+ val packageName = installedAppPackageName ?: return
19
19
 
20
- val dialog = AlertDialog.Builder(context)
21
- .setTitle("Uninstall App")
22
- .setMessage("App Name: $installedAppName\nThreat Name: $threatName")
23
- .setPositiveButton("Uninstall") { dialog, _ ->
24
- removeFromList()
25
- val intent = Intent(Intent.ACTION_DELETE)
26
- intent.data = android.net.Uri.parse("package:$packageName")
27
- context.startActivity(intent)
28
- dialog.dismiss()
29
- }
30
- .setNegativeButton("Cancel") { dialog, _ ->
31
- dialog.dismiss()
32
- }
33
- .create()
34
- dialog.show()
35
- }
20
+ val dialog = AlertDialog.Builder(context)
21
+ .setTitle("Uninstall App")
22
+ .setMessage("App Name: $installedAppName\nThreat Name: $threatName")
23
+ .setPositiveButton("Uninstall") { dialog, _ ->
24
+ removeFromList()
25
+ val intent = Intent(Intent.ACTION_DELETE)
26
+ intent.data = android.net.Uri.parse("package:$packageName")
27
+ context.startActivity(intent)
28
+ dialog.dismiss()
29
+ }
30
+ .setNegativeButton("Cancel") { dialog, _ ->
31
+ dialog.dismiss()
32
+ }
33
+ .create()
34
+ dialog.show()
35
+ }
36
36
 
37
- private fun removeFromList() {
38
- val packageName = installedAppPackageName ?: return
39
- ConstHelper.DetectedThreats?.let { threats ->
40
- threats.removeAll { it.equals(packageName, ignoreCase = true) }
41
- }
37
+ private fun removeFromList() {
38
+ val packageName = installedAppPackageName ?: return
39
+ ConstHelper.DetectedThreats?.let { threats ->
40
+ threats.removeAll { it.equals(packageName, ignoreCase = true) }
42
41
  }
43
- }
42
+ }
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.cprot.ead",
3
- "version": "1.0.7207",
3
+ "version": "1.0.7845",
4
4
  "description": "c-prot ead android module",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "lib/commonjs/index.js",