@qusaieilouti99/call-manager 0.1.35 → 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.
@@ -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 for Bundle
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 for Log
19
25
  import android.graphics.Color
20
26
  import android.app.Person
21
27
  import org.json.JSONArray
@@ -55,7 +61,6 @@ object CallEngine {
55
61
  }
56
62
 
57
63
  // --- Event handler for JS ---
58
- // Changed listener type to generated Func_void_CallEventType_std__string
59
64
  private var eventHandler: ((CallEventType, String) -> Unit)? = null
60
65
  private val cachedEvents = mutableListOf<Pair<CallEventType, String>>() // For caching events
61
66
 
@@ -72,7 +77,6 @@ object CallEngine {
72
77
  }
73
78
  }
74
79
 
75
- // Emit event uses the generated CallEventType enum directly
76
80
  fun emitEvent(type: CallEventType, data: JSONObject) {
77
81
  Log.d(TAG, "Emitting event: $type, data: $data")
78
82
  val dataString = data.toString()
@@ -120,7 +124,6 @@ object CallEngine {
120
124
  return result
121
125
  }
122
126
 
123
- // Removed callType param, now extracted from callData
124
127
  fun reportIncomingCall(context: Context, callId: String, callData: String) {
125
128
  appContext = context.applicationContext
126
129
  Log.d(TAG, "reportIncomingCall: $callId, $callData")
@@ -168,7 +171,6 @@ object CallEngine {
168
171
  notifyCallStateChanged(context)
169
172
  }
170
173
 
171
- // Removed callType param, now extracted from callData
172
174
  fun startOutgoingCall(context: Context, callId: String, callData: String) {
173
175
  appContext = context.applicationContext
174
176
  Log.d(TAG, "startOutgoingCall: $callId, $callData")
@@ -205,7 +207,10 @@ object CallEngine {
205
207
  }
206
208
 
207
209
  try {
208
- telecomManager.addNewOutgoingCall(phoneAccountHandle, extras) // Resolved
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+.
213
+ telecomManager.addNewOutgoingCall(phoneAccountHandle, extras)
209
214
  startForegroundService(context)
210
215
  Log.d(TAG, "Successfully reported outgoing call to TelecomManager for $callId")
211
216
  startRingback()
@@ -358,7 +363,6 @@ object CallEngine {
358
363
  Log.d(TAG, "Showing incoming call UI for $callId, caller: $callerName, callType: $callType")
359
364
  createNotificationChannel(context)
360
365
  val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
361
- // Resolved by `getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager`
362
366
 
363
367
  val answerIntent = Intent(context, CallNotificationActionReceiver::class.java).apply {
364
368
  action = "com.qusaieilouti99.callmanager.ANSWER_CALL"
@@ -659,7 +663,7 @@ object CallEngine {
659
663
  channel.setSound(null, null)
660
664
  channel.importance = NotificationManager.IMPORTANCE_HIGH
661
665
  }
662
- val manager = context.getSystemService(NotificationManager::class.java) // Corrected type inference
666
+ val manager = context.getSystemService(NotificationManager::class.java)
663
667
  manager.createNotificationChannel(channel)
664
668
  Log.d(TAG, "Notification channel '$NOTIF_CHANNEL_ID' created/updated.")
665
669
  }
@@ -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.os.IBinder
10
9
  import android.util.Log
10
+ import android.os.IBinder
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 type inference and explicit import
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
 
@@ -49,7 +49,7 @@ class CallManager : HybridCallManagerSpec() {
49
49
  Log.d(TAG, "keepScreenAwake requested: $keepAwake")
50
50
  CallEngine.getAppContext()?.let {
51
51
  CallEngine.keepScreenAwake(it, keepAwake)
52
- } ?: Log.e(TAG, "App context not set for keepScreenAwake.")
52
+ } ?: Log.e(TAG, "App context not set for keepAwake.")
53
53
  }
54
54
 
55
55
  // Corrected addListener signature to match generated HybridCallManagerSpec
@@ -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,9 +121,8 @@ 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
124
  override fun onConnectionEvent(event: String, extras: Bundle?) { // Resolved
126
- super.onConnectionEvent(event, extras)
125
+ super.onConnectionEvent(event, extras) // Correct super call
127
126
  Log.d(TAG, "Connection event: $event, extras: $extras for callId: $callId")
128
127
  }
129
128
 
@@ -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
 
@@ -53,7 +53,7 @@ class MyConnectionService : ConnectionService() {
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.37",
4
4
  "description": "Call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",