rns-nativecall 1.0.9 → 1.1.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.
|
@@ -142,12 +142,9 @@ class CallModule(
|
|
|
142
142
|
|
|
143
143
|
@ReactMethod
|
|
144
144
|
fun endNativeCall(uuid: String) {
|
|
145
|
-
NativeCallManager.dismissIncomingCall(
|
|
145
|
+
NativeCallManager.dismissIncomingCall(reactApplicationContext, uuid)
|
|
146
146
|
CallState.clear(uuid)
|
|
147
147
|
pendingCallDataMap = null
|
|
148
|
-
|
|
149
|
-
val notificationManager = reactApplicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
150
|
-
notificationManager.cancel(101)
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
@ReactMethod fun addListener(eventName: String) {}
|
|
@@ -14,13 +14,15 @@ import androidx.core.app.Person
|
|
|
14
14
|
import androidx.core.content.ContextCompat
|
|
15
15
|
|
|
16
16
|
object NativeCallManager {
|
|
17
|
-
const val channelId = "
|
|
17
|
+
const val channelId = "CALL_CHANNEL_V0_URGENT"
|
|
18
18
|
private var currentCallData: Map<String, String>? = null
|
|
19
19
|
|
|
20
20
|
@JvmStatic internal var pendingCallNotification: Notification? = null
|
|
21
21
|
|
|
22
22
|
@JvmStatic internal var pendingNotificationId: Int? = null
|
|
23
23
|
|
|
24
|
+
fun getCurrentCallData(): Map<String, String>? = currentCallData
|
|
25
|
+
|
|
24
26
|
fun handleIncomingPush(
|
|
25
27
|
context: Context,
|
|
26
28
|
data: Map<String, String>,
|
|
@@ -100,6 +102,7 @@ object NativeCallManager {
|
|
|
100
102
|
.setOngoing(true)
|
|
101
103
|
.setFullScreenIntent(fullScreenPendingIntent, true)
|
|
102
104
|
.setStyle(NotificationCompat.CallStyle.forIncomingCall(caller, rejectPendingIntent, answerPendingIntent))
|
|
105
|
+
.setAutoCancel(false)
|
|
103
106
|
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
|
|
104
107
|
|
|
105
108
|
val notification = builder.build()
|
|
@@ -121,6 +124,7 @@ object NativeCallManager {
|
|
|
121
124
|
) {
|
|
122
125
|
pendingCallNotification = null
|
|
123
126
|
pendingNotificationId = null
|
|
127
|
+
currentCallData = null
|
|
124
128
|
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
125
129
|
uuid?.let { manager.cancel(it.hashCode()) }
|
|
126
130
|
context.stopService(Intent(context, CallUiForegroundService::class.java))
|
|
@@ -3,22 +3,24 @@ package com.rnsnativecall
|
|
|
3
3
|
import android.content.BroadcastReceiver
|
|
4
4
|
import android.content.Context
|
|
5
5
|
import android.content.Intent
|
|
6
|
+
import android.util.Log
|
|
6
7
|
|
|
7
8
|
class UnlockReceiver : BroadcastReceiver() {
|
|
8
9
|
override fun onReceive(
|
|
9
10
|
context: Context,
|
|
10
11
|
intent: Intent,
|
|
11
12
|
) {
|
|
12
|
-
android.util.Log.d("UnlockReceiver", "Device Unlocked! Action: ${intent.action}")
|
|
13
|
-
|
|
14
13
|
if (intent.action == Intent.ACTION_USER_PRESENT) {
|
|
15
|
-
|
|
14
|
+
Log.d("UnlockReceiver", "Device Unlocked - Re-triggering Notification Pill")
|
|
15
|
+
|
|
16
|
+
val activeData = NativeCallManager.getCurrentCallData()
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
if (activeData != null) {
|
|
19
|
+
// We don't launch the app!
|
|
20
|
+
// We just tell the Manager to show the notification again.
|
|
21
|
+
// This forces the "Heads-Up" (Pill) to appear on the home screen.
|
|
22
|
+
NativeCallManager.handleIncomingPush(context, activeData)
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
}
|