@qusaieilouti99/call-manager 0.1.40 → 0.1.41

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.
@@ -100,6 +100,10 @@ object CallEngine {
100
100
  Log.d(TAG, "Removed Telecom Connection for callId: $callId. Total: ${telecomConnections.size}")
101
101
  }
102
102
 
103
+ fun getTelecomConnection(callId: String): Connection? {
104
+ return telecomConnections[callId]
105
+ }
106
+
103
107
  // --- Public API ---
104
108
 
105
109
  fun setCanMakeMultipleCalls(allow: Boolean) {
@@ -438,8 +442,20 @@ object CallEngine {
438
442
  val packageName = context.packageName
439
443
  val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
440
444
  launchIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
445
+
446
+ // If there are active calls, add the lock screen bypass flags
447
+ if (isCallActive()) {
448
+ launchIntent?.addFlags(
449
+ Intent.FLAG_ACTIVITY_SHOW_WHEN_LOCKED or
450
+ Intent.FLAG_ACTIVITY_TURN_SCREEN_ON or
451
+ Intent.FLAG_ACTIVITY_DISMISS_KEYGUARD
452
+ )
453
+ Log.d(TAG, "App brought to foreground with lock screen bypass flags due to active call")
454
+ } else {
455
+ Log.d(TAG, "App brought to foreground via normal launchIntent")
456
+ }
457
+
441
458
  context.startActivity(launchIntent)
442
- Log.d(TAG, "App brought to foreground via launchIntent")
443
459
  }
444
460
 
445
461
  // --- Audio Device Management ---
@@ -12,9 +12,23 @@ class CallNotificationActionReceiver : BroadcastReceiver() {
12
12
  override fun onReceive(context: Context, intent: Intent) {
13
13
  val callId = intent.getStringExtra("callId") ?: return
14
14
  Log.d(TAG, "onReceive called with action=${intent.action}, callId=$callId")
15
+
15
16
  when (intent.action) {
16
17
  "com.qusaieilouti99.callmanager.ANSWER_CALL" -> {
17
- Log.d(TAG, "Answer action received for callId: $callId. Bringing app to foreground.")
18
+ Log.d(TAG, "Answer action received for callId: $callId. Answering call via Telecom.")
19
+
20
+ // Get the telecom connection and answer it
21
+ val connection = CallEngine.getTelecomConnection(callId)
22
+ if (connection != null) {
23
+ // This will trigger MyConnection.onAnswer() which handles the rest
24
+ connection.onAnswer()
25
+ Log.d(TAG, "Call answered via Telecom connection for callId: $callId")
26
+ } else {
27
+ Log.e(TAG, "No Telecom connection found for callId: $callId. Falling back to direct answer.")
28
+ // Fallback: answer directly via CallEngine
29
+ CallEngine.answerCall(context, callId)
30
+ }
31
+
18
32
  CallEngine.bringAppToForeground(context)
19
33
  }
20
34
  "com.qusaieilouti99.callmanager.DECLINE_CALL" -> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "Call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",