rns-nativecall 0.5.5 → 0.5.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.
|
@@ -12,39 +12,46 @@ class AcceptCallActivity : Activity() {
|
|
|
12
12
|
|
|
13
13
|
val extras = intent.extras
|
|
14
14
|
val dataMap = mutableMapOf<String, String>()
|
|
15
|
+
|
|
16
|
+
// Extract data into our map
|
|
15
17
|
extras?.keySet()?.forEach { key ->
|
|
16
18
|
extras.get(key)?.let { dataMap[key] = it.toString() }
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
val uuid = dataMap["callUuid"]
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
val stopHeadlessIntent = Intent(this, CallHeadlessTask::class.java)
|
|
23
|
-
stopService(stopHeadlessIntent)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// 1. Stop UI/Ringtone immediately
|
|
27
|
-
NativeCallManager.stopRingtone()
|
|
28
|
-
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
23
|
+
// FIX: Only call these if uuid is not null to satisfy the compiler
|
|
29
24
|
if (uuid != null) {
|
|
25
|
+
// 1. Kill background tasks immediately
|
|
26
|
+
CallMessagingService.stopBackupTimer(uuid)
|
|
27
|
+
|
|
28
|
+
val stopHeadlessIntent = Intent(this, CallHeadlessTask::class.java)
|
|
29
|
+
stopService(stopHeadlessIntent)
|
|
30
|
+
|
|
31
|
+
// 2. Stop UI/Ringtone and Notification
|
|
32
|
+
NativeCallManager.stopRingtone()
|
|
33
|
+
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
30
34
|
notificationManager.cancel(uuid.hashCode())
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 2. SYNC WITH CALLMODULE: Save data for getInitialCallData()
|
|
34
|
-
CallModule.setPendingCallData(dataMap)
|
|
35
|
-
|
|
36
|
-
// 3. SYNC WITH CALLMODULE: Emit event for the active Bridge
|
|
37
|
-
CallModule.sendEventToJS("onCallAccepted", dataMap)
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
// 3. SYNC WITH CALLMODULE: Save data for getInitialCallData()
|
|
37
|
+
CallModule.setPendingCallData(dataMap)
|
|
38
|
+
|
|
39
|
+
// 4. SYNC WITH CALLMODULE: Emit event for the active Bridge
|
|
40
|
+
CallModule.sendEventToJS("onCallAccepted", dataMap)
|
|
41
|
+
|
|
42
|
+
// 5. Launch Main App with data
|
|
43
|
+
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
|
|
44
|
+
launchIntent?.apply {
|
|
45
|
+
// Using Intent.FLAG_ACTIVITY_NEW_TASK to ensure it opens correctly from a "killed" state
|
|
46
|
+
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
47
|
+
putExtras(extras ?: Bundle())
|
|
48
|
+
putExtra("navigatingToCall", true)
|
|
49
|
+
putExtra("callUuid", uuid) // Explicitly pass uuid again for easy access in JS
|
|
50
|
+
}
|
|
51
|
+
startActivity(launchIntent)
|
|
45
52
|
}
|
|
46
|
-
startActivity(launchIntent)
|
|
47
53
|
|
|
54
|
+
// Always finish the trampoline activity
|
|
48
55
|
finish()
|
|
49
56
|
}
|
|
50
57
|
}
|
package/package.json
CHANGED