@qusaieilouti99/call-manager 0.1.12 → 0.1.13

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.
@@ -25,11 +25,13 @@ class CallManagerModule(reactContext: ReactApplicationContext) :
25
25
 
26
26
  // Register JS event handler
27
27
  override fun setEventHandler(callback: Callback) {
28
+ Log.d(TAG, "setEventHandler called, registering JS callback")
28
29
  eventHandler = callback
29
30
  }
30
31
 
31
32
  // Helper to emit events to JS
32
33
  fun emitEvent(event: String, callData: String) {
34
+ Log.d(TAG, "emitEvent: event=$event, callData=$callData")
33
35
  eventHandler?.invoke(event, callData)
34
36
  }
35
37
 
@@ -42,23 +44,28 @@ class CallManagerModule(reactContext: ReactApplicationContext) :
42
44
 
43
45
  // 2. End call
44
46
  override fun endCall(callId: String) {
47
+ Log.d(TAG, "endCall called with callId=$callId")
45
48
  val context = reactApplicationContext
46
49
  val intent = Intent(context, CallForegroundService::class.java)
47
- context.stopService(intent)
50
+ val stopped = context.stopService(intent)
51
+ Log.d(TAG, "CallForegroundService stopped: $stopped")
48
52
  }
49
53
 
50
54
  // 3. Answer call
51
55
  override fun answerCall(callId: String) {
56
+ Log.d(TAG, "answerCall called with callId=$callId")
52
57
  bringAppToForeground()
53
58
  }
54
59
 
55
60
  // 4. Silence ringtone
56
61
  override fun silenceRingtone() {
62
+ Log.d(TAG, "silenceRingtone called")
57
63
  // TODO: Implement ringtone silencing logic if you play a custom ringtone
58
64
  }
59
65
 
60
66
  // 5. Reject current and answer new
61
67
  override fun rejectCurrentAndAnswerNew(callId: String, callData: String) {
68
+ Log.d(TAG, "rejectCurrentAndAnswerNew called with callId=$callId, callData=$callData")
62
69
  endCall(currentCallId ?: "")
63
70
  CallNativeHelper.reportIncomingCall(reactApplicationContext, callId, callData)
64
71
  }
@@ -70,10 +77,14 @@ class CallManagerModule(reactContext: ReactApplicationContext) :
70
77
  val packageName = context.packageName
71
78
  val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
72
79
  val tasks = activityManager.appTasks
80
+ Log.d(TAG, "bringAppToForeground called. tasks.isNullOrEmpty()=${tasks.isNullOrEmpty()}")
73
81
  if (tasks.isNullOrEmpty()) {
74
82
  val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
75
83
  launchIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
76
84
  context.startActivity(launchIntent)
85
+ Log.d(TAG, "App brought to foreground via launchIntent")
86
+ } else {
87
+ Log.d(TAG, "App already in foreground or has tasks")
77
88
  }
78
89
  }
79
90
  }
@@ -17,12 +17,7 @@ class CallNotificationActionReceiver : BroadcastReceiver() {
17
17
 
18
18
  when (action) {
19
19
  "com.qusaieilouti99.callmanager.ANSWER_CALL" -> {
20
- if (module != null) {
21
- module.answerCall(callId)
22
- } else {
23
- // ReactContext not ready, bring app to foreground
24
- bringAppToForeground(context)
25
- }
20
+ bringAppToForeground(context)
26
21
  }
27
22
  "com.qusaieilouti99.callmanager.DECLINE_CALL" -> {
28
23
  module?.endCall(callId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",