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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
package/withNativeCallVoip.js
CHANGED
|
@@ -18,7 +18,7 @@ function withMainActivityDataFix(config) {
|
|
|
18
18
|
super.onNewIntent(intent)
|
|
19
19
|
setIntent(intent)
|
|
20
20
|
|
|
21
|
-
//
|
|
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
|
|
30
|
-
|
|
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
|
}
|