@qusaieilouti99/call-manager 0.1.4 → 0.1.6

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.
@@ -12,7 +12,10 @@ import android.telecom.TelecomManager
12
12
  import android.util.Log
13
13
  import com.facebook.react.bridge.*
14
14
  import com.facebook.react.turbomodule.core.interfaces.TurboModule
15
+ import com.facebook.react.bridge.ReactApplicationContext
16
+ import com.facebook.react.module.annotations.ReactModule
15
17
 
18
+ @ReactModule(name = CallManagerModule.NAME)
16
19
  class CallManagerModule(reactContext: ReactApplicationContext) :
17
20
  NativeCallManagerSpec(reactContext), TurboModule {
18
21
 
@@ -40,6 +43,17 @@ class CallManagerModule(reactContext: ReactApplicationContext) :
40
43
  // 1. Report incoming call
41
44
  override fun reportIncomingCall(callId: String, callData: String) {
42
45
  Log.d(TAG, "reportIncomingCall called with callId=$callId, callData=$callData")
46
+ // Parse caller name from callData (or use a default)
47
+ val callerName = try {
48
+ val json = org.json.JSONObject(callData)
49
+ json.optString("name", "Unknown")
50
+ } catch (e: Exception) {
51
+ "Unknown"
52
+ }
53
+
54
+ // Show incoming call notification and play ringtone
55
+ notificationHelper.showIncomingCallNotification(callId, callerName)
56
+
43
57
  val context = reactApplicationContext
44
58
  val telecomManager = context.getSystemService(Context.TELECOM_SERVICE) as TelecomManager
45
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qusaieilouti99/call-manager",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "call manager",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",