@poolse/react-native-calls 0.1.1 → 0.1.2
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.
|
@@ -25,6 +25,23 @@ class CallForegroundService : Service() {
|
|
|
25
25
|
|
|
26
26
|
override fun onBind(intent: Intent?): IBinder? = null
|
|
27
27
|
|
|
28
|
+
// The ongoing-call notification has its own channel, created here so it
|
|
29
|
+
// exists on an OUTGOING call too — the incoming ring surface's channel
|
|
30
|
+
// is only made when a ring shows, so a placed call would otherwise post
|
|
31
|
+
// to a missing channel and startForeground would crash.
|
|
32
|
+
private fun ensureChannel() {
|
|
33
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
|
34
|
+
val manager = getSystemService(android.app.NotificationManager::class.java)
|
|
35
|
+
if (manager.getNotificationChannel(CHANNEL_ID) != null) return
|
|
36
|
+
manager.createNotificationChannel(
|
|
37
|
+
android.app.NotificationChannel(
|
|
38
|
+
CHANNEL_ID,
|
|
39
|
+
"Ongoing calls",
|
|
40
|
+
android.app.NotificationManager.IMPORTANCE_LOW,
|
|
41
|
+
).apply { setSound(null, null) },
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
28
45
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
|
29
46
|
val media = intent?.getStringExtra(EXTRA_MEDIA) ?: "audio"
|
|
30
47
|
startInForeground(media)
|
|
@@ -34,8 +51,9 @@ class CallForegroundService : Service() {
|
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
private fun startInForeground(media: String) {
|
|
54
|
+
ensureChannel()
|
|
37
55
|
val config = CallCore.peekConfig()
|
|
38
|
-
val notification: Notification = NotificationCompat.Builder(this,
|
|
56
|
+
val notification: Notification = NotificationCompat.Builder(this, CHANNEL_ID)
|
|
39
57
|
.setSmallIcon(config?.smallIcon ?: android.R.drawable.sym_call_outgoing)
|
|
40
58
|
.setContentTitle("Ongoing call")
|
|
41
59
|
.setContentText(if (media == "video") "Video call" else "Voice call")
|
|
@@ -58,6 +76,7 @@ class CallForegroundService : Service() {
|
|
|
58
76
|
companion object : CallSessionPort {
|
|
59
77
|
private const val NOTIFICATION_ID = 0x9C0FE
|
|
60
78
|
private const val EXTRA_MEDIA = "media"
|
|
79
|
+
private const val CHANNEL_ID = "poolse_ongoing_call"
|
|
61
80
|
|
|
62
81
|
private lateinit var appContext: Context
|
|
63
82
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poolse/react-native-calls",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Native call core for poolse — Kotlin/Swift calling engine with a thin React Native bridge. Ring, answer and carry audio with the app killed and the phone locked.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|