rns-nativecall 0.6.4 → 0.6.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.
@@ -41,15 +41,29 @@ class AcceptCallActivity : Activity() {
41
41
  }
42
42
 
43
43
  private fun openMainApp(extras: Bundle?) {
44
- // We look for the MainActivity class specifically
45
- val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
46
- launchIntent?.apply {
47
- // ✅ CRITICAL: Identify this as a deliberate "Answer" click
48
- action = "com.rnsnativecall.ACTION_ANSWER"
44
+ try {
45
+ // Get the actual MainActivity class name (e.g., com.yourapp.MainActivity)
46
+ val mainActivityClassName = "${packageName}.MainActivity"
49
47
 
50
- addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
51
- putExtras(extras ?: Bundle())
52
- startActivity(this)
48
+ val intent = Intent().apply {
49
+ setClassName(packageName, mainActivityClassName)
50
+ action = "com.rnsnativecall.ACTION_ANSWER"
51
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
52
+
53
+ // Ensure extras are carried over
54
+ extras?.let { putExtras(it) }
55
+ }
56
+
57
+ startActivity(intent)
58
+ } catch (e: Exception) {
59
+ // Fallback: If explicit mapping fails, try the launch intent but force the action
60
+ val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
61
+ launchIntent?.apply {
62
+ action = "com.rnsnativecall.ACTION_ANSWER"
63
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
64
+ extras?.let { putExtras(it) }
65
+ startActivity(this)
66
+ }
53
67
  }
54
68
  }
55
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rns-nativecall",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "High-performance React Native module for handling native VoIP call UI on Android and iOS.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,7 +18,7 @@ function withMainActivityDataFix(config) {
18
18
  super.onNewIntent(intent)
19
19
  setIntent(intent)
20
20
 
21
- // Only fire JS event if the user actually pressed "Answer"
21
+ // Check for the specific Answer Action
22
22
  val isAnswerAction = intent.action == "com.rnsnativecall.ACTION_ANSWER"
23
23
 
24
24
  val dataMap = mutableMapOf<String, String>()
@@ -26,8 +26,9 @@ function withMainActivityDataFix(config) {
26
26
  dataMap[key] = intent.extras?.get(key)?.toString() ?: ""
27
27
  }
28
28
 
29
- if (dataMap.isNotEmpty() && isAnswerAction) {
30
- com.rnsnativecall.CallModule.setPendingCallData(dataMap)
29
+ // FIRE if it's the answer action, even if extras are slim
30
+ if (isAnswerAction) {
31
+ com.rnsnativecall.CallModule.setPendingCallData("onCallAccepted_pending", dataMap)
31
32
  com.rnsnativecall.CallModule.sendEventToJS("onCallAccepted", dataMap)
32
33
  }
33
34
  }