@qusaieilouti99/call-manager 0.1.35 → 0.1.36

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.
@@ -74,8 +74,6 @@ class CallActivity : Activity() {
74
74
 
75
75
  override fun onBackPressed() {
76
76
  Log.d(TAG, "CallActivity onBackPressed for callId: $callId. Treating as decline/dismiss.")
77
- // Decision: User pressing back on the incoming call screen is treated as declining the call.
78
- // If you want the call to continue ringing in the background, remove the CallEngine.endCall() line.
79
77
  finishReason = FinishReason.MANUAL_DISMISS
80
78
  CallEngine.endCall(this, callId)
81
79
  finishCallActivity()
@@ -12,10 +12,16 @@ 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 // Added import
15
+ import android.os.Bundle // Explicit import
16
16
  import android.os.PowerManager
17
- import android.telecom.*
18
- import android.util.Log // Added import
17
+ import android.telecom.CallAudioState // Explicit import
18
+ import android.telecom.Connection // Explicit import
19
+ import android.telecom.DisconnectCause // Explicit import
20
+ import android.telecom.PhoneAccount // Explicit import
21
+ import android.telecom.PhoneAccountHandle // Explicit import
22
+ import android.telecom.TelecomManager // Explicit import
23
+ import android.telecom.VideoProfile // Explicit import
24
+ import android.util.Log // Explicit import
19
25
  import android.graphics.Color
20
26
  import android.app.Person
21
27
  import org.json.JSONArray
@@ -205,7 +211,7 @@ object CallEngine {
205
211
  }
206
212
 
207
213
  try {
208
- telecomManager.addNewOutgoingCall(phoneAccountHandle, extras) // Resolved
214
+ telecomManager.addNewOutgoingCall(phoneAccountHandle, extras)
209
215
  startForegroundService(context)
210
216
  Log.d(TAG, "Successfully reported outgoing call to TelecomManager for $callId")
211
217
  startRingback()
@@ -358,7 +364,6 @@ object CallEngine {
358
364
  Log.d(TAG, "Showing incoming call UI for $callId, caller: $callerName, callType: $callType")
359
365
  createNotificationChannel(context)
360
366
  val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
361
- // Resolved by `getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager`
362
367
 
363
368
  val answerIntent = Intent(context, CallNotificationActionReceiver::class.java).apply {
364
369
  action = "com.qusaieilouti99.callmanager.ANSWER_CALL"
@@ -471,6 +476,7 @@ object CallEngine {
471
476
  // Earpiece is active if speaker, bluetooth, and headset are off
472
477
  // This heuristic is tricky, relies on other routes being off
473
478
  if (audioManager?.isSpeakerphoneOn == false && audioManager?.isWiredHeadsetOn == false && audioManager?.isBluetoothScoOn == false && !device.isSource) {
479
+ // This heuristic is tricky, relies on other routes being off
474
480
  currentRoute = "Earpiece"
475
481
  }
476
482
  }
@@ -659,7 +665,7 @@ object CallEngine {
659
665
  channel.setSound(null, null)
660
666
  channel.importance = NotificationManager.IMPORTANCE_HIGH
661
667
  }
662
- val manager = context.getSystemService(NotificationManager::class.java) // Corrected type inference
668
+ val manager = context.getSystemService(NotificationManager::class.java)
663
669
  manager.createNotificationChannel(channel)
664
670
  Log.d(TAG, "Notification channel '$NOTIF_CHANNEL_ID' created/updated.")
665
671
  }
@@ -670,7 +676,7 @@ object CallEngine {
670
676
  val phoneAccountHandle = getPhoneAccountHandle(context)
671
677
  if (telecomManager.getPhoneAccount(phoneAccountHandle) == null) {
672
678
  val phoneAccount = PhoneAccount.builder(phoneAccountHandle, "PingMe Call")
673
- .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED or PhoneAccount.CAPABILITY_SUPPORTS_HOLD) // Resolved
679
+ .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED or PhoneAccount.CAPABILITY_SUPPORTS_HOLD)
674
680
  .build()
675
681
  try {
676
682
  telecomManager.registerPhoneAccount(phoneAccount)
@@ -3,11 +3,12 @@ package com.margelo.nitro.qusaieilouti99.callmanager
3
3
  import android.app.Notification
4
4
  import android.app.NotificationChannel
5
5
  import android.app.Service
6
- import android.content.Context // Added import
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
10
  import android.os.IBinder
10
- import android.util.Log
11
+ import android.app.NotificationManager // Explicit import
11
12
 
12
13
  class CallForegroundService : Service() {
13
14
 
@@ -60,7 +61,7 @@ class CallForegroundService : Service() {
60
61
  NotificationManager.IMPORTANCE_LOW
61
62
  )
62
63
  channel.description = "Notification for ongoing calls"
63
- val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager // Corrected type inference
64
+ val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager // Corrected usage
64
65
  manager.createNotificationChannel(channel)
65
66
  Log.d(TAG, "Foreground notification channel '$CHANNEL_ID' created/updated.")
66
67
  }
@@ -1,7 +1,7 @@
1
1
  package com.margelo.nitro.qusaieilouti99.callmanager
2
2
 
3
3
  import com.facebook.proguard.annotations.DoNotStrip
4
- import android.util.Log // Added import
4
+ import android.util.Log // Explicit import
5
5
  import org.json.JSONArray
6
6
  import org.json.JSONObject
7
7
 
@@ -11,6 +11,7 @@ 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.
14
15
  private var currentListener: Func_void_CallEventType_std__string? = null
15
16
 
16
17
  override fun endCall(callId: String) {
@@ -53,6 +54,7 @@ class CallManager : HybridCallManagerSpec() {
53
54
  }
54
55
 
55
56
  // Corrected addListener signature to match generated HybridCallManagerSpec
57
+ // This is the primary fix for the `addListener overrides nothing` error.
56
58
  override fun addListener(
57
59
  listener: Func_void_CallEventType_std__string // Use generated type directly
58
60
  ): Func_void { // Return generated type
@@ -2,12 +2,12 @@ package com.margelo.nitro.qusaieilouti99.callmanager
2
2
 
3
3
  import android.content.Context
4
4
  import android.net.Uri
5
- import android.os.Bundle // Added import
5
+ import android.os.Bundle // Explicit import
6
6
  import android.telecom.Connection
7
7
  import android.telecom.DisconnectCause
8
- import android.telecom.CallAudioState // Added import
8
+ import android.telecom.CallAudioState // Explicit import
9
9
  import android.telecom.VideoProfile
10
- import android.util.Log // Added import
10
+ import android.util.Log // Explicit import
11
11
  import org.json.JSONObject
12
12
  import java.util.UUID
13
13
 
@@ -20,7 +20,7 @@ class MyConnection(
20
20
  const val TAG = "MyConnection"
21
21
  }
22
22
 
23
- // Changed to internal val to allow access from MyConnectionService
23
+ // Changed to internal val to allow access from MyConnectionService for logging
24
24
  internal val callId: String = try {
25
25
  JSONObject(callDataJson).optString("callId", UUID.randomUUID().toString())
26
26
  } catch (e: Exception) {
@@ -110,10 +110,10 @@ class MyConnection(
110
110
  // NOTE: DTMF_TONE is not in your current CallEventType.ts enum.
111
111
  // If you need to emit this event, you MUST add 'DTMF_TONE' to your CallEventType.ts
112
112
  // and re-run nitro-codegen. For now, it's commented out to prevent compilation error.
113
- CallEngine.emitEvent(
114
- CallEventType.DTMF_TONE,
115
- JSONObject().put("callId", callId).put("digit", digit.toString())
116
- )
113
+ // CallEngine.emitEvent(
114
+ // CallEventType.DTMF_TONE,
115
+ // JSONObject().put("callId", callId).put("digit", digit.toString())
116
+ // )
117
117
  }
118
118
 
119
119
  override fun onStopDtmfTone() {
@@ -121,8 +121,7 @@ class MyConnection(
121
121
  Log.d(TAG, "Stopping DTMF tone for callId: $callId")
122
122
  }
123
123
 
124
- // @Suppress("Override") // Suppress if minSdkVersion < 26 and you want to keep the method
125
- override fun onConnectionEvent(event: String, extras: Bundle?) { // Resolved
124
+ override fun onConnectionEvent(event: String, extras: Bundle?) { // Resolved - signature is correct
126
125
  super.onConnectionEvent(event, extras)
127
126
  Log.d(TAG, "Connection event: $event, extras: $extras for callId: $callId")
128
127
  }
@@ -6,8 +6,8 @@ import android.telecom.ConnectionService
6
6
  import android.telecom.PhoneAccountHandle
7
7
  import android.telecom.TelecomManager
8
8
  import android.telecom.VideoProfile
9
- import android.telecom.CallAudioState // Added import
10
- import android.util.Log // Added import
9
+ import android.telecom.CallAudioState // Explicit import
10
+ import android.util.Log // Explicit import
11
11
 
12
12
  class MyConnectionService : ConnectionService() {
13
13
 
@@ -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") // Accesses internal callId
34
+ Log.d(TAG, "Created incoming connection for callId: ${connection.callId}. Status: RINGING, VideoState: $videoState")
35
35
  return connection
36
36
  }
37
37
 
@@ -49,11 +49,11 @@ 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") // Accesses internal callId
52
+ Log.d(TAG, "Created outgoing connection for callId: ${connection.callId}. Status: DIALING, VideoState: $videoState")
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.")
56
- connection.setAudioRoute(CallAudioState.ROUTE_SPEAKER) // Resolved
56
+ connection.setAudioRoute(CallAudioState.ROUTE_SPEAKER)
57
57
  }
58
58
 
59
59
  return connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",