@stream-io/react-native-callingx 0.1.0-beta.5 → 0.1.0-beta.7
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.
- package/android/build.gradle +9 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +28 -43
- package/android/src/main/java/io/getstream/rn/callingx/CallingxEventEmitterAdapter.kt +7 -0
- package/android/src/main/java/io/getstream/rn/callingx/{CallingxModule.kt → CallingxModuleImpl.kt} +53 -51
- package/android/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +9 -9
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +8 -8
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +7 -7
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +7 -7
- package/android/src/newarch/java/io/getstream/rn/callingx/CallingxModule.kt +148 -0
- package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxModule.kt +177 -0
- package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxPackage.kt +16 -0
- package/dist/module/EventManager.js +11 -4
- package/dist/module/EventManager.js.map +1 -1
- package/dist/module/spec/NativeCallingx.js +4 -2
- package/dist/module/spec/NativeCallingx.js.map +1 -1
- package/dist/module/utils/utils.js +3 -0
- package/dist/module/utils/utils.js.map +1 -1
- package/dist/typescript/src/EventManager.d.ts.map +1 -1
- package/dist/typescript/src/spec/NativeCallingx.d.ts +2 -2
- package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -1
- package/dist/typescript/src/utils/utils.d.ts +1 -0
- package/dist/typescript/src/utils/utils.d.ts.map +1 -1
- package/ios/Callingx.mm +312 -18
- package/package.json +1 -1
- package/src/EventManager.ts +18 -5
- package/src/spec/NativeCallingx.ts +11 -2
- package/src/utils/utils.ts +3 -0
- package/android/bin/build/generated/source/buildConfig/debug/io/getstream/rn/callingx/BuildConfig.class +0 -0
- package/android/bin/build/generated/source/codegen/java/io/getstream/rn/callingx/NativeCallingxSpec.class +0 -0
- package/android/bin/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec-generated.cpp +0 -167
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec.h +0 -31
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI-generated.cpp +0 -196
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI.h +0 -283
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.cpp +0 -22
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.h +0 -24
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.cpp +0 -16
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.h +0 -17
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.cpp +0 -19
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.h +0 -18
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.cpp +0 -17
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.h +0 -23
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.cpp +0 -16
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.h +0 -20
- package/android/bin/build/generated/source/codegen/schema.json +0 -1
- package/android/bin/src/main/AndroidManifest.xml +0 -29
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationChannelsManager.kt +0 -104
- /package/android/src/{main → newarch}/java/io/getstream/rn/callingx/CallingxPackage.kt +0 -0
package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt
CHANGED
|
@@ -4,7 +4,7 @@ import android.app.Service
|
|
|
4
4
|
import android.content.Intent
|
|
5
5
|
import android.os.IBinder
|
|
6
6
|
import android.util.Log
|
|
7
|
-
import io.getstream.rn.callingx.
|
|
7
|
+
import io.getstream.rn.callingx.CallingxModuleImpl
|
|
8
8
|
|
|
9
9
|
class NotificationReceiverService : Service() {
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ class NotificationReceiverService : Service() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
when (action) {
|
|
25
|
-
|
|
25
|
+
CallingxModuleImpl.CALL_ANSWERED_ACTION -> onCallAnswered(intent)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
stopSelf(startId)
|
|
@@ -30,20 +30,20 @@ class NotificationReceiverService : Service() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
private fun onCallAnswered(intent: Intent) {
|
|
33
|
-
val callId = intent.getStringExtra(
|
|
34
|
-
val source = intent.getStringExtra(
|
|
33
|
+
val callId = intent.getStringExtra(CallingxModuleImpl.EXTRA_CALL_ID)
|
|
34
|
+
val source = intent.getStringExtra(CallingxModuleImpl.EXTRA_SOURCE)
|
|
35
35
|
callId?.let {
|
|
36
36
|
try {
|
|
37
37
|
NotificationIntentFactory.getPendingBroadcastIntent(
|
|
38
38
|
applicationContext,
|
|
39
|
-
|
|
39
|
+
CallingxModuleImpl.CALL_ANSWERED_ACTION,
|
|
40
40
|
it
|
|
41
|
-
) { putExtra(
|
|
41
|
+
) { putExtra(CallingxModuleImpl.EXTRA_SOURCE, source) }
|
|
42
42
|
.send()
|
|
43
43
|
|
|
44
44
|
NotificationIntentFactory.getLaunchActivityIntent(
|
|
45
45
|
applicationContext,
|
|
46
|
-
|
|
46
|
+
CallingxModuleImpl.CALL_ANSWERED_ACTION,
|
|
47
47
|
it,
|
|
48
48
|
source
|
|
49
49
|
)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
package io.getstream.rn.callingx
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReadableMap
|
|
6
|
+
import com.facebook.react.bridge.WritableArray
|
|
7
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
9
|
+
|
|
10
|
+
@ReactModule(name = CallingxModule.NAME)
|
|
11
|
+
class CallingxModule(reactContext: ReactApplicationContext) :
|
|
12
|
+
NativeCallingxSpec(reactContext), CallingxEventEmitterAdapter {
|
|
13
|
+
|
|
14
|
+
companion object {
|
|
15
|
+
const val NAME = CallingxModuleImpl.NAME
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private val impl = CallingxModuleImpl(reactContext, this)
|
|
19
|
+
|
|
20
|
+
override fun emitNewEvent(value: WritableMap) {
|
|
21
|
+
emitOnNewEvent(value)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun getName(): String = NAME
|
|
25
|
+
|
|
26
|
+
override fun initialize() {
|
|
27
|
+
super.initialize()
|
|
28
|
+
impl.initialize()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun invalidate() {
|
|
32
|
+
impl.invalidate()
|
|
33
|
+
super.invalidate()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun setupiOS(options: ReadableMap) {
|
|
37
|
+
// leave empty
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun setupAndroid(options: ReadableMap) {
|
|
41
|
+
impl.setupAndroid(options)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override fun canPostNotifications(): Boolean {
|
|
45
|
+
return impl.canPostNotifications()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun setShouldRejectCallWhenBusy(shouldReject: Boolean) {
|
|
49
|
+
// leave empty
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override fun getInitialVoipEvents(): WritableArray {
|
|
53
|
+
// leave empty
|
|
54
|
+
return com.facebook.react.bridge.Arguments.createArray()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun registerVoipToken() {
|
|
58
|
+
// leave empty
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun getInitialEvents(): WritableArray {
|
|
62
|
+
return impl.getInitialEvents()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override fun setCurrentCallActive(callId: String, promise: Promise) {
|
|
66
|
+
impl.setCurrentCallActive(callId, promise)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override fun displayIncomingCall(
|
|
70
|
+
callId: String,
|
|
71
|
+
phoneNumber: String,
|
|
72
|
+
callerName: String,
|
|
73
|
+
hasVideo: Boolean,
|
|
74
|
+
displayOptions: ReadableMap?,
|
|
75
|
+
promise: Promise
|
|
76
|
+
) {
|
|
77
|
+
impl.displayIncomingCall(callId, phoneNumber, callerName, hasVideo, displayOptions, promise)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
override fun answerIncomingCall(callId: String, promise: Promise) {
|
|
81
|
+
impl.answerIncomingCall(callId, promise)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
override fun startCall(
|
|
85
|
+
callId: String,
|
|
86
|
+
phoneNumber: String,
|
|
87
|
+
callerName: String,
|
|
88
|
+
hasVideo: Boolean,
|
|
89
|
+
displayOptions: ReadableMap?,
|
|
90
|
+
promise: Promise
|
|
91
|
+
) {
|
|
92
|
+
impl.startCall(callId, phoneNumber, callerName, hasVideo, displayOptions, promise)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
override fun updateDisplay(
|
|
96
|
+
callId: String,
|
|
97
|
+
phoneNumber: String,
|
|
98
|
+
callerName: String,
|
|
99
|
+
displayOptions: ReadableMap?,
|
|
100
|
+
promise: Promise
|
|
101
|
+
) {
|
|
102
|
+
impl.updateDisplay(callId, phoneNumber, callerName, displayOptions, promise)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
override fun endCallWithReason(callId: String, reason: Double, promise: Promise) {
|
|
106
|
+
impl.endCallWithReason(callId, reason, promise)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
override fun endCall(callId: String, promise: Promise) {
|
|
110
|
+
impl.endCall(callId, promise)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
override fun isCallTracked(callId: String): Boolean {
|
|
114
|
+
return impl.isCallTracked(callId)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
override fun hasRegisteredCall(): Boolean {
|
|
118
|
+
return impl.hasRegisteredCall()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
override fun setMutedCall(callId: String, isMuted: Boolean, promise: Promise) {
|
|
122
|
+
impl.setMutedCall(callId, isMuted, promise)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
override fun setOnHoldCall(callId: String, isOnHold: Boolean, promise: Promise) {
|
|
126
|
+
impl.setOnHoldCall(callId, isOnHold, promise)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
override fun startBackgroundTask(taskName: String, timeout: Double, promise: Promise) {
|
|
130
|
+
impl.startBackgroundTask(taskName, timeout, promise)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
override fun stopBackgroundTask(taskName: String, promise: Promise) {
|
|
134
|
+
impl.stopBackgroundTask(taskName, promise)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
override fun registerBackgroundTaskAvailable() {
|
|
138
|
+
impl.registerBackgroundTaskAvailable()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
override fun isServiceStarted(promise: Promise) {
|
|
142
|
+
impl.isServiceStarted(promise)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
override fun log(message: String, level: String) {
|
|
146
|
+
impl.log(message, level)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
package io.getstream.rn.callingx
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
|
+
import com.facebook.react.bridge.ReactMethod
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
9
|
+
import com.facebook.react.bridge.WritableArray
|
|
10
|
+
import com.facebook.react.bridge.WritableMap
|
|
11
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
12
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
13
|
+
|
|
14
|
+
@ReactModule(name = CallingxModule.NAME)
|
|
15
|
+
class CallingxModule(private val reactContext: ReactApplicationContext) :
|
|
16
|
+
ReactContextBaseJavaModule(reactContext), CallingxEventEmitterAdapter {
|
|
17
|
+
|
|
18
|
+
companion object {
|
|
19
|
+
const val NAME = CallingxModuleImpl.NAME
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private val impl = CallingxModuleImpl(reactContext, this)
|
|
23
|
+
|
|
24
|
+
override fun emitNewEvent(value: WritableMap) {
|
|
25
|
+
reactContext
|
|
26
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
27
|
+
.emit("onNewEvent", value)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun getName(): String = NAME
|
|
31
|
+
|
|
32
|
+
override fun initialize() {
|
|
33
|
+
super.initialize()
|
|
34
|
+
impl.initialize()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun invalidate() {
|
|
38
|
+
impl.invalidate()
|
|
39
|
+
super.invalidate()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@ReactMethod
|
|
43
|
+
fun setupiOS(options: ReadableMap) {
|
|
44
|
+
// leave empty
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun setupAndroid(options: ReadableMap) {
|
|
49
|
+
impl.setupAndroid(options)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
53
|
+
fun canPostNotifications(): Boolean {
|
|
54
|
+
return impl.canPostNotifications()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@ReactMethod
|
|
58
|
+
fun setShouldRejectCallWhenBusy(shouldReject: Boolean) {
|
|
59
|
+
// leave empty
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
63
|
+
fun getInitialVoipEvents(): WritableArray {
|
|
64
|
+
// leave empty
|
|
65
|
+
return Arguments.createArray()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@ReactMethod
|
|
69
|
+
fun registerVoipToken() {
|
|
70
|
+
// leave empty
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
74
|
+
fun getInitialEvents(): WritableArray {
|
|
75
|
+
return impl.getInitialEvents()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@ReactMethod
|
|
79
|
+
fun setCurrentCallActive(callId: String, promise: Promise) {
|
|
80
|
+
impl.setCurrentCallActive(callId, promise)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@ReactMethod
|
|
84
|
+
fun displayIncomingCall(
|
|
85
|
+
callId: String,
|
|
86
|
+
phoneNumber: String,
|
|
87
|
+
callerName: String,
|
|
88
|
+
hasVideo: Boolean,
|
|
89
|
+
displayOptions: ReadableMap?,
|
|
90
|
+
promise: Promise
|
|
91
|
+
) {
|
|
92
|
+
impl.displayIncomingCall(callId, phoneNumber, callerName, hasVideo, displayOptions, promise)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@ReactMethod
|
|
96
|
+
fun answerIncomingCall(callId: String, promise: Promise) {
|
|
97
|
+
impl.answerIncomingCall(callId, promise)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@ReactMethod
|
|
101
|
+
fun startCall(
|
|
102
|
+
callId: String,
|
|
103
|
+
phoneNumber: String,
|
|
104
|
+
callerName: String,
|
|
105
|
+
hasVideo: Boolean,
|
|
106
|
+
displayOptions: ReadableMap?,
|
|
107
|
+
promise: Promise
|
|
108
|
+
) {
|
|
109
|
+
impl.startCall(callId, phoneNumber, callerName, hasVideo, displayOptions, promise)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@ReactMethod
|
|
113
|
+
fun updateDisplay(
|
|
114
|
+
callId: String,
|
|
115
|
+
phoneNumber: String,
|
|
116
|
+
callerName: String,
|
|
117
|
+
displayOptions: ReadableMap?,
|
|
118
|
+
promise: Promise
|
|
119
|
+
) {
|
|
120
|
+
impl.updateDisplay(callId, phoneNumber, callerName, displayOptions, promise)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@ReactMethod
|
|
124
|
+
fun endCallWithReason(callId: String, reason: Double, promise: Promise) {
|
|
125
|
+
impl.endCallWithReason(callId, reason, promise)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@ReactMethod
|
|
129
|
+
fun endCall(callId: String, promise: Promise) {
|
|
130
|
+
impl.endCall(callId, promise)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
134
|
+
fun isCallTracked(callId: String): Boolean {
|
|
135
|
+
return impl.isCallTracked(callId)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
139
|
+
fun hasRegisteredCall(): Boolean {
|
|
140
|
+
return impl.hasRegisteredCall()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@ReactMethod
|
|
144
|
+
fun setMutedCall(callId: String, isMuted: Boolean, promise: Promise) {
|
|
145
|
+
impl.setMutedCall(callId, isMuted, promise)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactMethod
|
|
149
|
+
fun setOnHoldCall(callId: String, isOnHold: Boolean, promise: Promise) {
|
|
150
|
+
impl.setOnHoldCall(callId, isOnHold, promise)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@ReactMethod
|
|
154
|
+
fun startBackgroundTask(taskName: String, timeout: Double, promise: Promise) {
|
|
155
|
+
impl.startBackgroundTask(taskName, timeout, promise)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@ReactMethod
|
|
159
|
+
fun stopBackgroundTask(taskName: String, promise: Promise) {
|
|
160
|
+
impl.stopBackgroundTask(taskName, promise)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@ReactMethod
|
|
164
|
+
fun registerBackgroundTaskAvailable() {
|
|
165
|
+
impl.registerBackgroundTaskAvailable()
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@ReactMethod
|
|
169
|
+
fun isServiceStarted(promise: Promise) {
|
|
170
|
+
impl.isServiceStarted(promise)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@ReactMethod
|
|
174
|
+
fun log(message: String, level: String) {
|
|
175
|
+
impl.log(message, level)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package io.getstream.rn.callingx
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
class CallingPackage : ReactPackage {
|
|
9
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
10
|
+
return listOf(CallingxModule(reactContext))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
14
|
+
return emptyList()
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { NativeEventEmitter } from 'react-native';
|
|
3
4
|
import NativeCallingModule from "./spec/NativeCallingx.js";
|
|
4
|
-
import { isVoipEvent } from "./utils/utils.js";
|
|
5
|
+
import { isVoipEvent, isTurboModuleEnabled } from "./utils/utils.js";
|
|
5
6
|
class EventManager {
|
|
6
7
|
listenersCount = 0;
|
|
7
8
|
eventListeners = new Map();
|
|
@@ -16,10 +17,16 @@ class EventManager {
|
|
|
16
17
|
const eventListeners = this.eventListeners.get(event.eventName) || [];
|
|
17
18
|
eventListeners.forEach(listener => listener(event.params));
|
|
18
19
|
};
|
|
19
|
-
if (
|
|
20
|
-
|
|
20
|
+
if (isTurboModuleEnabled) {
|
|
21
|
+
if (isVoipEvent(eventName)) {
|
|
22
|
+
this.subscription = NativeCallingModule.onNewVoipEvent(eventHandler);
|
|
23
|
+
} else {
|
|
24
|
+
this.subscription = NativeCallingModule.onNewEvent(eventHandler);
|
|
25
|
+
}
|
|
21
26
|
} else {
|
|
22
|
-
|
|
27
|
+
const nativeEmitter = new NativeEventEmitter(NativeCallingModule);
|
|
28
|
+
const nativeEventName = isVoipEvent(eventName) ? 'onNewVoipEvent' : 'onNewEvent';
|
|
29
|
+
this.subscription = nativeEmitter.addListener(nativeEventName, eventHandler);
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeCallingModule","isVoipEvent","EventManager","listenersCount","eventListeners","Map","subscription","addListener","eventName","callback","listeners","get","push","set","eventHandler","event","forEach","listener","params","onNewVoipEvent","onNewEvent","removeListener","updatedListeners","filter","c","length","remove"],"sourceRoot":"../../src","sources":["EventManager.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeCallingModule","isVoipEvent","isTurboModuleEnabled","EventManager","listenersCount","eventListeners","Map","subscription","addListener","eventName","callback","listeners","get","push","set","eventHandler","event","forEach","listener","params","onNewVoipEvent","onNewEvent","nativeEmitter","nativeEventName","removeListener","updatedListeners","filter","c","length","remove"],"sourceRoot":"../../src","sources":["EventManager.ts"],"mappings":";;AAAA,SAASA,kBA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CAACd,WAAW,CAC3Ce,eAAe,EACfR,YACF,CAAC;MACH;IACF;EACF;EAEAS,cAAcA,CACZf,SAAY,EACZC,QAA+B,EACzB;IACN,MAAMC,SAAS,GAAG,IAAI,CAACN,cAAc,CAACO,GAAG,CAACH,SAAS,CAAC,IAAI,EAAE;IAC1D,MAAMgB,gBAAgB,GAAGd,SAAS,CAACe,MAAM,CAAEC,CAAC,IAAKA,CAAC,KAAKjB,QAAQ,CAAC;IAChE,IAAI,CAACL,cAAc,CAACS,GAAG,CAACL,SAAS,EAAEgB,gBAAgB,CAAC;IAEpD,IAAIA,gBAAgB,CAACG,MAAM,KAAKjB,SAAS,CAACiB,MAAM,EAAE;MAChD,IAAI,CAACxB,cAAc,EAAE;IACvB;IAEA,IAAI,IAAI,CAACA,cAAc,KAAK,CAAC,EAAE;MAC7B,IAAI,CAACG,YAAY,EAAEsB,MAAM,CAAC,CAAC;MAC3B,IAAI,CAACtB,YAAY,GAAG,IAAI;IAC1B;EACF;AACF;AAEA,SAASJ,YAAY","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry, NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
// @ts-expect-error - CodegenTypes is not properly typed
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { isTurboModuleEnabled } from "../utils/utils.js";
|
|
8
|
+
const CallingxModule = isTurboModuleEnabled ? TurboModuleRegistry.getEnforcing('Callingx') : NativeModules.Callingx;
|
|
9
|
+
export default CallingxModule;
|
|
8
10
|
//# sourceMappingURL=NativeCallingx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["spec/NativeCallingx.ts"],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","NativeModules","isTurboModuleEnabled","CallingxModule","getEnforcing","Callingx"],"sourceRoot":"../../../src","sources":["spec/NativeCallingx.ts"],"mappings":";;AAAA,SACEA,mBAAmB,EACnBC,aAAa,QAER,cAAc;;AAErB;;AAEA,SAASC,oBAAoB,QAAQ,mBAAgB;AA4KrD,MAAMC,cAAoB,GAAGD,oBAAoB,GAC7CF,mBAAmB,CAACI,YAAY,CAAO,UAAU,CAAC,GACjDH,aAAa,CAACI,QAAiB;AAEpC,eAAeF,cAAc","ignoreList":[]}
|
|
@@ -3,4 +3,7 @@
|
|
|
3
3
|
export const isVoipEvent = eventName => {
|
|
4
4
|
return eventName === 'voipNotificationsRegistered' || eventName === 'voipNotificationReceived';
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
// @ts-expect-error - RN$Bridgeless is not properly typed
|
|
8
|
+
export const isTurboModuleEnabled = global.RN$Bridgeless === true;
|
|
6
9
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isVoipEvent","eventName"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAIC,SAAiB,IAAK;EAChD,OACEA,SAAS,KAAK,6BAA6B,IAC3CA,SAAS,KAAK,0BAA0B;AAE5C,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["isVoipEvent","eventName","isTurboModuleEnabled","global","RN$Bridgeless"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAIC,SAAiB,IAAK;EAChD,OACEA,SAAS,KAAK,6BAA6B,IAC3CA,SAAS,KAAK,0BAA0B;AAE5C,CAAC;;AAED;AACA,OAAO,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,aAAa,KAAK,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventManager.d.ts","sourceRoot":"","sources":["../../../src/EventManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,SAAS,EAET,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAE5C,cAAM,YAAY,CAAC,IAAI,SAAS,SAAS,GAAG,aAAa,EAAE,MAAM;IAC/D,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,YAAY,CAAkC;IAEtD,WAAW,CAAC,CAAC,SAAS,IAAI,EACxB,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,IAAI;
|
|
1
|
+
{"version":3,"file":"EventManager.d.ts","sourceRoot":"","sources":["../../../src/EventManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,SAAS,EAET,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAE5C,cAAM,YAAY,CAAC,IAAI,SAAS,SAAS,GAAG,aAAa,EAAE,MAAM;IAC/D,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,YAAY,CAAkC;IAEtD,WAAW,CAAC,CAAC,SAAS,IAAI,EACxB,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,IAAI;IAkCP,cAAc,CAAC,CAAC,SAAS,IAAI,EAC3B,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,IAAI;CAcR;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
|
@@ -127,6 +127,6 @@ export interface Spec extends TurboModule {
|
|
|
127
127
|
}>;
|
|
128
128
|
log(message: string, level: 'debug' | 'info' | 'warn' | 'error'): void;
|
|
129
129
|
}
|
|
130
|
-
declare const
|
|
131
|
-
export default
|
|
130
|
+
declare const CallingxModule: Spec;
|
|
131
|
+
export default CallingxModule;
|
|
132
132
|
//# sourceMappingURL=NativeCallingx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeCallingx.d.ts","sourceRoot":"","sources":["../../../../src/spec/NativeCallingx.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NativeCallingx.d.ts","sourceRoot":"","sources":["../../../../src/spec/NativeCallingx.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAG9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,OAAO,EAAE;QAChB,aAAa,EAAE,OAAO,CAAC;QACvB,wBAAwB,EAAE,MAAM,CAAC;QACjC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,YAAY,EAAE,OAAO,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;KAC5B,GAAG,IAAI,CAAC;IAET,YAAY,CAAC,OAAO,EAAE;QACpB,eAAe,EAAE;YACf,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,OAAO,CAAC;SACpB,CAAC;QACF,cAAc,EAAE;YACd,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,GAAG,IAAI,CAAC;IAET,2BAA2B,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzD,oBAAoB,IAAI,OAAO,CAAC;IAEhC,gBAAgB,IAAI,KAAK,C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AG,OAAO,GAAG,IAAI,CAAC;CACxE;AAED,QAAA,MAAM,cAAc,EAAE,IAEc,CAAC;AAErC,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,4EAK5C,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,4EAK5C,CAAC;AAGF,eAAO,MAAM,oBAAoB,SAAgC,CAAC"}
|