@qusaieilouti99/call-manager 0.1.36 → 0.1.37

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,7 +12,7 @@ import android.media.MediaPlayer
12
12
  import android.media.RingtoneManager
13
13
  import android.net.Uri
14
14
  import android.os.Build
15
- import android.os.Bundle // Explicit import
15
+ import android.os.Bundle // Explicit import for Bundle
16
16
  import android.os.PowerManager
17
17
  import android.telecom.CallAudioState // Explicit import
18
18
  import android.telecom.Connection // Explicit import
@@ -21,7 +21,7 @@ import android.telecom.PhoneAccount // Explicit import
21
21
  import android.telecom.PhoneAccountHandle // Explicit import
22
22
  import android.telecom.TelecomManager // Explicit import
23
23
  import android.telecom.VideoProfile // Explicit import
24
- import android.util.Log // Explicit import
24
+ import android.util.Log // Explicit import for Log
25
25
  import android.graphics.Color
26
26
  import android.app.Person
27
27
  import org.json.JSONArray
@@ -61,7 +61,6 @@ object CallEngine {
61
61
  }
62
62
 
63
63
  // --- Event handler for JS ---
64
- // Changed listener type to generated Func_void_CallEventType_std__string
65
64
  private var eventHandler: ((CallEventType, String) -> Unit)? = null
66
65
  private val cachedEvents = mutableListOf<Pair<CallEventType, String>>() // For caching events
67
66
 
@@ -78,7 +77,6 @@ object CallEngine {
78
77
  }
79
78
  }
80
79
 
81
- // Emit event uses the generated CallEventType enum directly
82
80
  fun emitEvent(type: CallEventType, data: JSONObject) {
83
81
  Log.d(TAG, "Emitting event: $type, data: $data")
84
82
  val dataString = data.toString()
@@ -126,7 +124,6 @@ object CallEngine {
126
124
  return result
127
125
  }
128
126
 
129
- // Removed callType param, now extracted from callData
130
127
  fun reportIncomingCall(context: Context, callId: String, callData: String) {
131
128
  appContext = context.applicationContext
132
129
  Log.d(TAG, "reportIncomingCall: $callId, $callData")
@@ -174,7 +171,6 @@ object CallEngine {
174
171
  notifyCallStateChanged(context)
175
172
  }
176
173
 
177
- // Removed callType param, now extracted from callData
178
174
  fun startOutgoingCall(context: Context, callId: String, callData: String) {
179
175
  appContext = context.applicationContext
180
176
  Log.d(TAG, "startOutgoingCall: $callId, $callData")
@@ -211,6 +207,9 @@ object CallEngine {
211
207
  }
212
208
 
213
209
  try {
210
+ // Error: Unresolved reference 'addNewOutgoingCall'. This usually means TelecomManager is not correctly imported
211
+ // or the minSdkVersion is too low for this method (requires API 23+).
212
+ // Imports already checked; assuming minSdkVersion 26+.
214
213
  telecomManager.addNewOutgoingCall(phoneAccountHandle, extras)
215
214
  startForegroundService(context)
216
215
  Log.d(TAG, "Successfully reported outgoing call to TelecomManager for $callId")
@@ -476,7 +475,6 @@ object CallEngine {
476
475
  // Earpiece is active if speaker, bluetooth, and headset are off
477
476
  // This heuristic is tricky, relies on other routes being off
478
477
  if (audioManager?.isSpeakerphoneOn == false && audioManager?.isWiredHeadsetOn == false && audioManager?.isBluetoothScoOn == false && !device.isSource) {
479
- // This heuristic is tricky, relies on other routes being off
480
478
  currentRoute = "Earpiece"
481
479
  }
482
480
  }
@@ -676,7 +674,7 @@ object CallEngine {
676
674
  val phoneAccountHandle = getPhoneAccountHandle(context)
677
675
  if (telecomManager.getPhoneAccount(phoneAccountHandle) == null) {
678
676
  val phoneAccount = PhoneAccount.builder(phoneAccountHandle, "PingMe Call")
679
- .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED or PhoneAccount.CAPABILITY_SUPPORTS_HOLD)
677
+ .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED or PhoneAccount.CAPABILITY_SUPPORTS_HOLD) // Resolved
680
678
  .build()
681
679
  try {
682
680
  telecomManager.registerPhoneAccount(phoneAccount)
@@ -6,7 +6,7 @@ import android.app.Service
6
6
  import android.content.Context
7
7
  import android.content.Intent
8
8
  import android.os.Build
9
- import android.util.Log // Explicit import
9
+ import android.util.Log
10
10
  import android.os.IBinder
11
11
  import android.app.NotificationManager // Explicit import
12
12
 
@@ -61,7 +61,7 @@ class CallForegroundService : Service() {
61
61
  NotificationManager.IMPORTANCE_LOW
62
62
  )
63
63
  channel.description = "Notification for ongoing calls"
64
- val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager // Corrected usage
64
+ val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager // Corrected type inference and explicit import
65
65
  manager.createNotificationChannel(channel)
66
66
  Log.d(TAG, "Foreground notification channel '$CHANNEL_ID' created/updated.")
67
67
  }
@@ -11,7 +11,6 @@ class CallManager : HybridCallManagerSpec() {
11
11
  private val TAG = "CallManager"
12
12
 
13
13
  // Listener type now directly matches the generated Func_void_CallEventType_std__string
14
- // This is the correct type from your Nitro codegen output.
15
14
  private var currentListener: Func_void_CallEventType_std__string? = null
16
15
 
17
16
  override fun endCall(callId: String) {
@@ -50,11 +49,10 @@ class CallManager : HybridCallManagerSpec() {
50
49
  Log.d(TAG, "keepScreenAwake requested: $keepAwake")
51
50
  CallEngine.getAppContext()?.let {
52
51
  CallEngine.keepScreenAwake(it, keepAwake)
53
- } ?: Log.e(TAG, "App context not set for keepScreenAwake.")
52
+ } ?: Log.e(TAG, "App context not set for keepAwake.")
54
53
  }
55
54
 
56
55
  // Corrected addListener signature to match generated HybridCallManagerSpec
57
- // This is the primary fix for the `addListener overrides nothing` error.
58
56
  override fun addListener(
59
57
  listener: Func_void_CallEventType_std__string // Use generated type directly
60
58
  ): Func_void { // Return generated type
@@ -121,8 +121,8 @@ class MyConnection(
121
121
  Log.d(TAG, "Stopping DTMF tone for callId: $callId")
122
122
  }
123
123
 
124
- override fun onConnectionEvent(event: String, extras: Bundle?) { // Resolved - signature is correct
125
- super.onConnectionEvent(event, extras)
124
+ override fun onConnectionEvent(event: String, extras: Bundle?) { // Resolved
125
+ super.onConnectionEvent(event, extras) // Correct super call
126
126
  Log.d(TAG, "Connection event: $event, extras: $extras for callId: $callId")
127
127
  }
128
128
 
@@ -31,7 +31,7 @@ class MyConnectionService : ConnectionService() {
31
31
  val videoState = if (isVideoCallBoolean) VideoProfile.STATE_BIDIRECTIONAL else VideoProfile.STATE_AUDIO_ONLY
32
32
  connection.setVideoState(videoState)
33
33
  connection.setRinging()
34
- Log.d(TAG, "Created incoming connection for callId: ${connection.callId}. Status: RINGING, VideoState: $videoState")
34
+ Log.d(TAG, "Created incoming connection for callId: ${connection.callId}. Status: RINGING, VideoState: $videoState") // Accesses internal callId
35
35
  return connection
36
36
  }
37
37
 
@@ -49,7 +49,7 @@ class MyConnectionService : ConnectionService() {
49
49
  val videoState = if (isVideoCallBoolean) VideoProfile.STATE_BIDIRECTIONAL else VideoProfile.STATE_AUDIO_ONLY
50
50
  connection.setVideoState(videoState)
51
51
  connection.setDialing()
52
- Log.d(TAG, "Created outgoing connection for callId: ${connection.callId}. Status: DIALING, VideoState: $videoState")
52
+ Log.d(TAG, "Created outgoing connection for callId: ${connection.callId}. Status: DIALING, VideoState: $videoState") // Accesses internal callId
53
53
 
54
54
  if (request.extras?.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false) == true) {
55
55
  Log.d(TAG, "Hinting Telecom to start outgoing call with speakerphone as per request extras.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "Call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",