rns-nativecall 1.0.0 → 1.0.1

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.
@@ -20,32 +20,35 @@ class CallActionReceiver : BroadcastReceiver() {
20
20
  intent.extras?.get(key)?.let { fullDataMap[key] = it.toString() }
21
21
  }
22
22
 
23
- // --- HANDLE REJECT ---
24
- if (action == "ACTION_REJECT") {
23
+ // --- HANDLE ANSWER ---
24
+ if (action == "ACTION_ANSWER") {
25
+ // 1. Kill the ringing notification and service immediately
25
26
  NativeCallManager.dismissIncomingCall(context, uuid)
26
- CallForegroundService.stop(context)
27
27
 
28
+ // 2. Queue or Send the accept event
28
29
  if (CallModule.isReady()) {
29
- CallModule.sendEventToJS("onCallRejected", fullDataMap)
30
+ CallModule.sendEventToJS("onCallAccepted", fullDataMap)
30
31
  } else {
31
- CallModule.setPendingCallData("onCallRejected_pending", fullDataMap)
32
+ CallModule.setPendingCallData("onCallAccepted_pending", fullDataMap)
32
33
  }
33
- // Just close the shade
34
+
35
+ // 3. Bring the app to the front
36
+ launchApp(context, intent.extras)
34
37
  collapseNotificationShade(context)
35
38
  }
36
39
 
37
- // --- HANDLE ANSWER ---
38
- if (action == "ACTION_ANSWER") {
40
+ // --- HANDLE REJECT ---
41
+ if (action == "ACTION_REJECT") {
42
+ // This kills the Notification AND the Foreground Service (via our updated Manager)
39
43
  NativeCallManager.dismissIncomingCall(context, uuid)
40
44
 
45
+ // Notify JS
41
46
  if (CallModule.isReady()) {
42
- CallModule.sendEventToJS("onCallAccepted", fullDataMap)
47
+ CallModule.sendEventToJS("onCallRejected", fullDataMap)
43
48
  } else {
44
- CallModule.setPendingCallData("onCallAccepted_pending", fullDataMap)
49
+ CallModule.setPendingCallData("onCallRejected_pending", fullDataMap)
45
50
  }
46
51
 
47
- // This will open your app and the system usually collapses the shade automatically
48
- launchApp(context, intent.extras)
49
52
  collapseNotificationShade(context)
50
53
  }
51
54
  }
@@ -18,8 +18,7 @@ class CallForegroundService : Service() {
18
18
  private var unlockReceiver: UnlockReceiver? = null // Store reference for unregistering
19
19
 
20
20
  companion object {
21
- private const val NOTIFICATION_ID = 101
22
- private const val CHANNEL_ID = "incoming_call_service"
21
+ private const val CHANNEL_ID = "CALL_CHANNEL_V10_URGENT"
23
22
 
24
23
  fun stop(context: Context) {
25
24
  val intent = Intent(context, CallForegroundService::class.java)
@@ -19,7 +19,7 @@ object NativeCallManager {
19
19
  // because the system NotificationManager handles the sound.
20
20
 
21
21
  // Incrementing version to V3 to force fresh channel settings on the device
22
- const val channelId = "CALL_CHANNEL_V9_URGENT"
22
+ const val channelId = "CALL_CHANNEL_V10_URGENT"
23
23
  private var currentCallData: Map<String, String>? = null
24
24
 
25
25
  fun getCurrentCallData(): Map<String, String>? = currentCallData
@@ -129,10 +129,6 @@ object NativeCallManager {
129
129
  }
130
130
  }
131
131
 
132
- /**
133
- * Stop the ringtone by canceling the notification itself.
134
- * The system manages the sound, so when the notification dies, the sound dies.
135
- */
136
132
  fun dismissIncomingCall(
137
133
  context: Context,
138
134
  uuid: String?,
@@ -190,7 +186,6 @@ object NativeCallManager {
190
186
  notificationManager.notify(uuid.hashCode(), builder.build())
191
187
  }
192
188
 
193
- // Deprecated manual method - kept for signature compatibility but does nothing
194
189
  fun stopRingtone() {
195
190
  // No-op: Sound is now managed by the Notification Channel life-cycle
196
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rns-nativecall",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "High-performance React Native module for handling native VoIP call UI on Android and iOS.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",