@qusaieilouti99/call-manager 0.1.0 → 0.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.
@@ -1,6 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.qusaieilouti99.callmanager">
3
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
2
  <application>
5
3
  <service
6
4
  android:name=".MyConnectionService"
@@ -1,16 +1,16 @@
1
1
  package com.qusaieilouti99.callmanager
2
2
 
3
- import android.app.*
3
+ import android.app.Notification
4
+ import android.app.NotificationChannel
5
+ import android.app.NotificationManager
6
+ import android.app.PendingIntent
7
+ import android.app.Person
4
8
  import android.content.Context
5
9
  import android.content.Intent
6
10
  import android.graphics.Color
7
11
  import android.media.AudioAttributes
8
12
  import android.media.RingtoneManager
9
13
  import android.os.Build
10
- import android.telecom.CallAttributes
11
- import android.telecom.CallStyle
12
- import android.telecom.CallAttributesCompat
13
- import android.telecom.CallStyleCompat
14
14
  import android.util.Log
15
15
 
16
16
  class CallNotificationHelper(private val context: Context) {
@@ -52,17 +52,24 @@ class CallNotificationHelper(private val context: Context) {
52
52
  context, 2, fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
53
53
  )
54
54
 
55
- // Build CallStyle notification (Android 12+)
56
- val builder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
55
+ val notification: Notification = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
56
+ val person = Person.Builder()
57
+ .setName(callerName)
58
+ .setImportant(true)
59
+ .build()
60
+
57
61
  Notification.Builder(context, CHANNEL_ID)
58
62
  .setStyle(
59
63
  Notification.CallStyle.forIncomingCall(
60
- callerName,
64
+ person,
61
65
  fullScreenPendingIntent,
62
66
  answerPendingIntent,
63
67
  declinePendingIntent
64
68
  )
65
69
  )
70
+ .setOngoing(true)
71
+ .setAutoCancel(false)
72
+ .build()
66
73
  } else {
67
74
  Notification.Builder(context, CHANNEL_ID)
68
75
  .setContentTitle("Incoming Call")
@@ -73,13 +80,11 @@ class CallNotificationHelper(private val context: Context) {
73
80
  .setFullScreenIntent(fullScreenPendingIntent, true)
74
81
  .addAction(android.R.drawable.sym_action_call, "Answer", answerPendingIntent)
75
82
  .addAction(android.R.drawable.ic_menu_close_clear_cancel, "Decline", declinePendingIntent)
83
+ .setOngoing(true)
84
+ .setAutoCancel(false)
85
+ .build()
76
86
  }
77
87
 
78
- val notification = builder
79
- .setOngoing(true)
80
- .setAutoCancel(false)
81
- .build()
82
-
83
88
  val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
84
89
  notificationManager.notify(NOTIFICATION_ID, notification)
85
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",