react-native-sinch-calling 0.2.0 → 0.5.0
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/CHANGELOG.md +17 -0
- package/README.md +17 -1
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/sinchcalling/SinchCallManager.kt +70 -0
- package/android/src/main/java/com/sinchcalling/SinchCallingModule.kt +8 -0
- package/ios/Sinch/SinchCallManager.swift +25 -0
- package/ios/Sinch/SinchPushManager.swift +27 -2
- package/ios/SinchCalling.mm +11 -0
- package/lib/module/NativeSinchCalling.js.map +1 -1
- package/lib/module/SinchCalling.js +23 -0
- package/lib/module/SinchCalling.js.map +1 -1
- package/lib/typescript/src/NativeSinchCalling.d.ts +5 -0
- package/lib/typescript/src/NativeSinchCalling.d.ts.map +1 -1
- package/lib/typescript/src/SinchCalling.d.ts +18 -1
- package/lib/typescript/src/SinchCalling.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeSinchCalling.ts +21 -0
- package/src/SinchCalling.ts +26 -0
- package/src/index.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.4.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `configureCustomCancelCallPush(typeField, cancelValue)` — opt in to recognizing your backend's cancel/end push payloads (e.g. `{ type: "call_cancelled", callId, ... }`), so a push carrying the configured cancel marker ends the already-shown call UI (`reportCallEnded` / `SinchTelecomManager.reportCallEnded`) instead of being reported as a new incoming call.
|
|
10
|
+
- `onIncomingCallUICancelled` event, fired once the cancel push has been handled and the system call UI torn down, so app code can clean up any state keyed by `callId`.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Previously, a "cancel this call" push reusing the same `idField` as the configured incoming-call push (a natural payload design, since both need to identify which call they're about) was indistinguishable from a genuinely new incoming call — the push handler only checked for the id field's presence, so cancel pushes rang as phantom incoming calls instead of dismissing the real one.
|
|
15
|
+
|
|
16
|
+
## 0.3.0
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Automatic proximity-screen-off management during established earpiece calls, same behavior as the system Phone app: on while a call is `ESTABLISHED` and the speaker is off, off otherwise (speaker toggle or call end). Handled entirely inside `SinchCallManager` on both platforms — no new public API.
|
|
21
|
+
|
|
5
22
|
## 0.2.0
|
|
6
23
|
|
|
7
24
|
### Added
|
package/README.md
CHANGED
|
@@ -160,6 +160,21 @@ SinchCalling.onCallUIAnswered(async ({ callId }) => {
|
|
|
160
160
|
SinchCalling.onCallUIDeclined(({ callId }) => {
|
|
161
161
|
declineOnYourBackend(callId);
|
|
162
162
|
});
|
|
163
|
+
|
|
164
|
+
// If your backend can also cancel/end a call that's already ringing on this
|
|
165
|
+
// device (caller hung up, answered on another device, forwarded elsewhere,
|
|
166
|
+
// etc.), it needs a way to tell a "cancel" push apart from a "new call" push
|
|
167
|
+
// — reusing the same `idField` for both (a natural design, since both need
|
|
168
|
+
// to say which call they're about) would otherwise make every cancel push
|
|
169
|
+
// look like a new incoming call. Configure the field/value your backend
|
|
170
|
+
// uses to mark a cancel, e.g. `{ type: "call_cancelled", callId, reason }`:
|
|
171
|
+
SinchCalling.configureCustomCancelCallPush('type', 'call_cancelled');
|
|
172
|
+
|
|
173
|
+
// Fires once a cancel push has ended the system call UI natively — clean up
|
|
174
|
+
// any app-side state keyed by `callId` (a pending caller-ID lookup, etc.).
|
|
175
|
+
SinchCalling.onIncomingCallUICancelled(({ callId }) => {
|
|
176
|
+
cleanUpPendingCallState(callId);
|
|
177
|
+
});
|
|
163
178
|
```
|
|
164
179
|
|
|
165
180
|
This is the one place iOS can't be fully "hands off": Apple requires every VoIP push to synchronously trigger a CallKit report from inside the native push handler, so the payload-shape check happens natively (using the field names you configured) rather than round-tripping through JS first.
|
|
@@ -210,12 +225,13 @@ SinchCalling.onClientStartFailed(({ code }) => {
|
|
|
210
225
|
| `enablePushNotifications(useProductionAps)` | iOS | No-op on Android |
|
|
211
226
|
| `relayRemotePushNotification(payload)` | Android | No-op on iOS |
|
|
212
227
|
| `configureCustomIncomingCallPush(idField, displayField)` | both | Opt-in — see [Custom incoming-call flows](#custom-incoming-call-flows) |
|
|
228
|
+
| `configureCustomCancelCallPush(typeField, cancelValue)` | both | Opt-in — distinguishes a cancel/end push from a new-call push, see [Custom incoming-call flows](#custom-incoming-call-flows) |
|
|
213
229
|
| `reportIncomingCallUI(callId, displayName)` | both | Shows a call UI for any reason you decide to |
|
|
214
230
|
| `resolveCallUIToConference(callId, conferenceId, callerId)` → `callId` | both | Turns a shown call UI into a real call |
|
|
215
231
|
| `dismissCallUI(callId)` | both | Cleans up a call UI that couldn't be resolved |
|
|
216
232
|
| `updateIncomingCallDisplayName(callId, displayName)` | both | Overrides the shown caller name |
|
|
217
233
|
|
|
218
|
-
Events: `onClientStarted`, `onClientStartFailed`, `onRegistrationCredentialsRequired` (internal — handled by `setRegistrationCredentialsProvider`), `onIncomingCall`, `onCallProgressing`, `onCallEstablished`, `onCallEnded`, `onPushTokenRegistered`, `onPushTokenRegistrationFailed`, `onVoipPushTokenUpdated` (iOS — forward to your backend), `onIncomingCallUIShown`, `onCallUIAnswered`, `onCallUIDeclined`.
|
|
234
|
+
Events: `onClientStarted`, `onClientStartFailed`, `onRegistrationCredentialsRequired` (internal — handled by `setRegistrationCredentialsProvider`), `onIncomingCall`, `onCallProgressing`, `onCallEstablished`, `onCallEnded`, `onPushTokenRegistered`, `onPushTokenRegistrationFailed`, `onVoipPushTokenUpdated` (iOS — forward to your backend), `onIncomingCallUIShown`, `onCallUIAnswered`, `onCallUIDeclined`, `onIncomingCallUICancelled`.
|
|
219
235
|
|
|
220
236
|
## Known limitations
|
|
221
237
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
|
6
6
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
|
7
7
|
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
|
|
8
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
8
9
|
|
|
9
10
|
<application>
|
|
10
11
|
<service
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.sinchcalling
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
+
import android.os.PowerManager
|
|
4
5
|
import com.sinch.android.rtc.AudioController
|
|
5
6
|
import com.sinch.android.rtc.ClientRegistration
|
|
6
7
|
import com.sinch.android.rtc.PushConfiguration
|
|
@@ -39,6 +40,10 @@ interface SinchCallManagerListener {
|
|
|
39
40
|
fun onIncomingCallUIShown(callId: String, displayName: String)
|
|
40
41
|
fun onCallUIAnswered(callId: String)
|
|
41
42
|
fun onCallUIDeclined(callId: String)
|
|
43
|
+
|
|
44
|
+
// A configured cancel push was detected for a call already reported via
|
|
45
|
+
// `onIncomingCallUIShown` — see `configureCustomCancelCallPush`.
|
|
46
|
+
fun onIncomingCallUICancelled(callId: String)
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
private fun endCauseString(endCause: CallEndCause): String = when (endCause) {
|
|
@@ -65,6 +70,15 @@ class SinchCallManager(private val context: Context) {
|
|
|
65
70
|
private val calls = mutableMapOf<String, Call>()
|
|
66
71
|
private var customPushIdField: String? = null
|
|
67
72
|
private var customPushDisplayField: String? = null
|
|
73
|
+
private var customCancelTypeField: String? = null
|
|
74
|
+
private var customCancelValue: String? = null
|
|
75
|
+
|
|
76
|
+
// Proximity-screen-off during an established earpiece call, same as the
|
|
77
|
+
// system Phone app: on while at least one call is established and the
|
|
78
|
+
// speaker isn't in use, off otherwise.
|
|
79
|
+
private val establishedCallIds = mutableSetOf<String>()
|
|
80
|
+
private var isSpeakerEnabled = false
|
|
81
|
+
private var proximityWakeLock: PowerManager.WakeLock? = null
|
|
68
82
|
|
|
69
83
|
private val callListener = object : CallListener {
|
|
70
84
|
override fun onCallProgressing(call: Call) {
|
|
@@ -73,11 +87,15 @@ class SinchCallManager(private val context: Context) {
|
|
|
73
87
|
|
|
74
88
|
override fun onCallEstablished(call: Call) {
|
|
75
89
|
SinchTelecomManager.reportCallActive(call.callId)
|
|
90
|
+
establishedCallIds.add(call.callId)
|
|
91
|
+
updateProximityMonitoring()
|
|
76
92
|
listener?.onCallEstablished(call.callId)
|
|
77
93
|
}
|
|
78
94
|
|
|
79
95
|
override fun onCallEnded(call: Call) {
|
|
80
96
|
calls.remove(call.callId)
|
|
97
|
+
establishedCallIds.remove(call.callId)
|
|
98
|
+
updateProximityMonitoring()
|
|
81
99
|
SinchTelecomManager.reportCallEnded(call.callId)
|
|
82
100
|
listener?.onCallEnded(call.callId, endCauseString(call.details.endCause))
|
|
83
101
|
}
|
|
@@ -123,10 +141,29 @@ class SinchCallManager(private val context: Context) {
|
|
|
123
141
|
customPushDisplayField = displayField
|
|
124
142
|
}
|
|
125
143
|
|
|
144
|
+
// Opts into recognizing a cancel/end push shaped like the configured
|
|
145
|
+
// incoming-call push but carrying `typeField == cancelValue` — e.g. the
|
|
146
|
+
// backend reuses the same `idField` but sets `type: "call_cancelled"`
|
|
147
|
+
// instead of `"incoming_call"`. Checked before the incoming-call match in
|
|
148
|
+
// `relayRemotePushNotification`, so a payload satisfying both is treated
|
|
149
|
+
// as a cancel.
|
|
150
|
+
fun configureCustomCancelCallPush(typeField: String, cancelValue: String) {
|
|
151
|
+
customCancelTypeField = typeField
|
|
152
|
+
customCancelValue = cancelValue
|
|
153
|
+
}
|
|
154
|
+
|
|
126
155
|
fun relayRemotePushNotification(payload: Map<String, String>) {
|
|
127
156
|
val idField = customPushIdField
|
|
128
157
|
val callId = idField?.let { payload[it] }
|
|
129
158
|
if (callId != null) {
|
|
159
|
+
val typeField = customCancelTypeField
|
|
160
|
+
val cancelValue = customCancelValue
|
|
161
|
+
if (typeField != null && cancelValue != null && payload[typeField] == cancelValue) {
|
|
162
|
+
SinchTelecomManager.reportCallEnded(callId)
|
|
163
|
+
listener?.onIncomingCallUICancelled(callId)
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
|
|
130
167
|
val displayName = customPushDisplayField?.let { payload[it] } ?: ""
|
|
131
168
|
reportIncomingCallUI(callId, displayName)
|
|
132
169
|
return
|
|
@@ -216,6 +253,9 @@ class SinchCallManager(private val context: Context) {
|
|
|
216
253
|
client?.terminateGracefully()
|
|
217
254
|
client = null
|
|
218
255
|
calls.clear()
|
|
256
|
+
establishedCallIds.clear()
|
|
257
|
+
isSpeakerEnabled = false
|
|
258
|
+
releaseProximityWakeLock()
|
|
219
259
|
}
|
|
220
260
|
|
|
221
261
|
fun provideRegistrationCredentials(jwt: String) {
|
|
@@ -293,6 +333,36 @@ class SinchCallManager(private val context: Context) {
|
|
|
293
333
|
fun setSpeakerEnabled(enabled: Boolean) {
|
|
294
334
|
val audioController = client?.audioController ?: return
|
|
295
335
|
if (enabled) audioController.enableSpeaker() else audioController.disableSpeaker()
|
|
336
|
+
isSpeakerEnabled = enabled
|
|
337
|
+
updateProximityMonitoring()
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private fun updateProximityMonitoring() {
|
|
341
|
+
val shouldEnable = establishedCallIds.isNotEmpty() && !isSpeakerEnabled
|
|
342
|
+
if (shouldEnable) acquireProximityWakeLock() else releaseProximityWakeLock()
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
private fun acquireProximityWakeLock() {
|
|
346
|
+
val lock = proximityWakeLock ?: run {
|
|
347
|
+
val powerManager =
|
|
348
|
+
context.applicationContext.getSystemService(Context.POWER_SERVICE) as? PowerManager
|
|
349
|
+
?: return
|
|
350
|
+
if (!powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
|
|
351
|
+
return
|
|
352
|
+
}
|
|
353
|
+
@Suppress("DEPRECATION")
|
|
354
|
+
powerManager.newWakeLock(
|
|
355
|
+
PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,
|
|
356
|
+
"SinchCalling:ProximityWakeLock",
|
|
357
|
+
).also { proximityWakeLock = it }
|
|
358
|
+
}
|
|
359
|
+
if (!lock.isHeld) {
|
|
360
|
+
lock.acquire(10 * 60 * 1000L)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
private fun releaseProximityWakeLock() {
|
|
365
|
+
proximityWakeLock?.let { if (it.isHeld) it.release() }
|
|
296
366
|
}
|
|
297
367
|
|
|
298
368
|
private fun track(call: Call) {
|
|
@@ -81,6 +81,10 @@ class SinchCallingModule(reactContext: ReactApplicationContext) :
|
|
|
81
81
|
override fun onCallUIDeclined(callId: String) {
|
|
82
82
|
emitOnCallUIDeclined(Arguments.createMap().apply { putString("callId", callId) })
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
override fun onIncomingCallUICancelled(callId: String) {
|
|
86
|
+
emitOnIncomingCallUICancelled(Arguments.createMap().apply { putString("callId", callId) })
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
|
|
@@ -120,6 +124,10 @@ class SinchCallingModule(reactContext: ReactApplicationContext) :
|
|
|
120
124
|
callManager.configureCustomIncomingCallPush(idField, displayField)
|
|
121
125
|
}
|
|
122
126
|
|
|
127
|
+
override fun configureCustomCancelCallPush(typeField: String, cancelValue: String) {
|
|
128
|
+
callManager.configureCustomCancelCallPush(typeField, cancelValue)
|
|
129
|
+
}
|
|
130
|
+
|
|
123
131
|
override fun reportIncomingCallUI(callId: String, displayName: String) {
|
|
124
132
|
callManager.reportIncomingCallUI(callId, displayName)
|
|
125
133
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AVFoundation
|
|
2
2
|
import Foundation
|
|
3
3
|
import SinchRTC
|
|
4
|
+
import UIKit
|
|
4
5
|
|
|
5
6
|
@objc public protocol SinchCallManagerDelegate: AnyObject {
|
|
6
7
|
func sinchCallManagerDidStartClient()
|
|
@@ -38,6 +39,14 @@ public final class SinchCallManager: NSObject {
|
|
|
38
39
|
private var pendingRegistration: SINClientRegistration?
|
|
39
40
|
private var calls: [String: SINCall] = [:]
|
|
40
41
|
|
|
42
|
+
// Proximity-screen-off during an established earpiece call, same as the
|
|
43
|
+
// system Phone app: on while at least one call is established and the
|
|
44
|
+
// speaker isn't in use, off otherwise. Tracked here (rather than exposed
|
|
45
|
+
// as a public API) since both established-call state and speaker state
|
|
46
|
+
// already live in this class.
|
|
47
|
+
private var establishedCallIds = Set<String>()
|
|
48
|
+
private var isSpeakerEnabled = false
|
|
49
|
+
|
|
41
50
|
@objc public func configure(appKey: String, environmentHost: String, userId: String) {
|
|
42
51
|
do {
|
|
43
52
|
let sinchClient = try Sinch.client(
|
|
@@ -62,6 +71,9 @@ public final class SinchCallManager: NSObject {
|
|
|
62
71
|
client?.terminateGracefully()
|
|
63
72
|
client = nil
|
|
64
73
|
calls.removeAll()
|
|
74
|
+
establishedCallIds.removeAll()
|
|
75
|
+
isSpeakerEnabled = false
|
|
76
|
+
updateProximityMonitoring()
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
@objc public func provideRegistrationCredentials(_ jwt: String) {
|
|
@@ -129,6 +141,15 @@ public final class SinchCallManager: NSObject {
|
|
|
129
141
|
} else {
|
|
130
142
|
client?.audioController().disableSpeaker()
|
|
131
143
|
}
|
|
144
|
+
isSpeakerEnabled = enabled
|
|
145
|
+
updateProximityMonitoring()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private func updateProximityMonitoring() {
|
|
149
|
+
let shouldEnable = !establishedCallIds.isEmpty && !isSpeakerEnabled
|
|
150
|
+
DispatchQueue.main.async {
|
|
151
|
+
UIDevice.current.isProximityMonitoringEnabled = shouldEnable
|
|
152
|
+
}
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
@objc public func enableManagedPushNotifications() {
|
|
@@ -185,11 +206,15 @@ extension SinchCallManager: SINCallDelegate {
|
|
|
185
206
|
}
|
|
186
207
|
|
|
187
208
|
public func callDidEstablish(_ call: SINCall) {
|
|
209
|
+
establishedCallIds.insert(call.callId)
|
|
210
|
+
updateProximityMonitoring()
|
|
188
211
|
delegate?.sinchCallManagerCallDidEstablish(call.callId)
|
|
189
212
|
}
|
|
190
213
|
|
|
191
214
|
public func callDidEnd(_ call: SINCall) {
|
|
192
215
|
calls.removeValue(forKey: call.callId)
|
|
216
|
+
establishedCallIds.remove(call.callId)
|
|
217
|
+
updateProximityMonitoring()
|
|
193
218
|
delegate?.sinchCallManagerCallDidEnd(call.callId, endCause: endCauseString(call.details.endCause))
|
|
194
219
|
}
|
|
195
220
|
}
|
|
@@ -8,6 +8,10 @@ import SinchRTC
|
|
|
8
8
|
// Sinch-relayed push (e.g. an app-to-app incoming call), which is instead
|
|
9
9
|
// forwarded straight to the Sinch client and surfaces as `onIncomingCall`.
|
|
10
10
|
func sinchPushManagerDidDetectCustomIncomingCall(_ callId: String, displayName: String)
|
|
11
|
+
// A configured cancel push was detected for a call already reported via
|
|
12
|
+
// `sinchPushManagerDidDetectCustomIncomingCall` — see
|
|
13
|
+
// `configureCustomCancelCallPush`.
|
|
14
|
+
func sinchPushManagerDidDetectCustomCancelCall(_ callId: String)
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
// A single `PKPushRegistry` can only have one delegate per push type, so this
|
|
@@ -24,6 +28,8 @@ public final class SinchPushManager: NSObject {
|
|
|
24
28
|
private var registry: PKPushRegistry?
|
|
25
29
|
private var customIdField: String?
|
|
26
30
|
private var customDisplayField: String?
|
|
31
|
+
private var customCancelTypeField: String?
|
|
32
|
+
private var customCancelValue: String?
|
|
27
33
|
|
|
28
34
|
@objc public init(callManager: SinchCallManager) {
|
|
29
35
|
self.callManager = callManager
|
|
@@ -43,6 +49,17 @@ public final class SinchPushManager: NSObject {
|
|
|
43
49
|
customIdField = idField
|
|
44
50
|
customDisplayField = displayField
|
|
45
51
|
}
|
|
52
|
+
|
|
53
|
+
// Opts into recognizing a cancel/end push shaped like the configured
|
|
54
|
+
// incoming-call push but carrying `typeField == cancelValue` — e.g. the
|
|
55
|
+
// backend reuses the same `idField` but sets `type: "call_cancelled"`
|
|
56
|
+
// instead of `"incoming_call"`. Checked before the incoming-call match in
|
|
57
|
+
// `didReceiveIncomingPushWith`, so a push satisfying both is treated as a
|
|
58
|
+
// cancel.
|
|
59
|
+
@objc public func configureCustomCancelCallPush(typeField: String, cancelValue: String) {
|
|
60
|
+
customCancelTypeField = typeField
|
|
61
|
+
customCancelValue = cancelValue
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
|
|
48
65
|
extension SinchPushManager: PKPushRegistryDelegate {
|
|
@@ -71,8 +88,16 @@ extension SinchPushManager: PKPushRegistryDelegate {
|
|
|
71
88
|
|
|
72
89
|
let dict = payload.dictionaryPayload
|
|
73
90
|
if let idField = customIdField, let callId = dict[idField] as? String {
|
|
74
|
-
let
|
|
75
|
-
|
|
91
|
+
if let typeField = customCancelTypeField,
|
|
92
|
+
let cancelValue = customCancelValue,
|
|
93
|
+
let typeValue = dict[typeField] as? String,
|
|
94
|
+
typeValue == cancelValue
|
|
95
|
+
{
|
|
96
|
+
delegate?.sinchPushManagerDidDetectCustomCancelCall(callId)
|
|
97
|
+
} else {
|
|
98
|
+
let displayName = customDisplayField.flatMap { dict[$0] as? String } ?? ""
|
|
99
|
+
delegate?.sinchPushManagerDidDetectCustomIncomingCall(callId, displayName: displayName)
|
|
100
|
+
}
|
|
76
101
|
} else {
|
|
77
102
|
callManager?.relayPushNotification(dict)
|
|
78
103
|
}
|
package/ios/SinchCalling.mm
CHANGED
|
@@ -80,6 +80,11 @@
|
|
|
80
80
|
[_pushManager configureCustomIncomingCallPushWithIdField:idField displayField:displayField];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
- (void)configureCustomCancelCallPush:(NSString *)typeField cancelValue:(NSString *)cancelValue
|
|
84
|
+
{
|
|
85
|
+
[_pushManager configureCustomCancelCallPushWithTypeField:typeField cancelValue:cancelValue];
|
|
86
|
+
}
|
|
87
|
+
|
|
83
88
|
- (void)reportIncomingCallUI:(NSString *)callId displayName:(NSString *)displayName
|
|
84
89
|
{
|
|
85
90
|
[_callKitManager reportExternalIncomingCall:callId displayName:displayName];
|
|
@@ -228,6 +233,12 @@
|
|
|
228
233
|
[self emitOnIncomingCallUIShown:@{ @"callId" : callId, @"displayName" : displayName }];
|
|
229
234
|
}
|
|
230
235
|
|
|
236
|
+
- (void)sinchPushManagerDidDetectCustomCancelCall:(NSString *)callId
|
|
237
|
+
{
|
|
238
|
+
[_callKitManager reportCallEnded:callId];
|
|
239
|
+
[self emitOnIncomingCallUICancelled:@{ @"callId" : callId }];
|
|
240
|
+
}
|
|
241
|
+
|
|
231
242
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
232
243
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
233
244
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSinchCalling.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSinchCalling.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAwKpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -122,6 +122,19 @@ class SinchCalling {
|
|
|
122
122
|
NativeSinchCalling.configureCustomIncomingCallPush(idField, displayField);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Opts into recognizing your own backend's cancel/end push payloads, on
|
|
127
|
+
* both platforms — e.g. `configureCustomCancelCallPush('type', 'call_cancelled')`
|
|
128
|
+
* for a payload shaped `{ type: 'call_cancelled', callId, ... }`. Checked
|
|
129
|
+
* before the `configureCustomIncomingCallPush` id-field match, so a push
|
|
130
|
+
* carrying both the id field and this cancel marker ends the already-shown
|
|
131
|
+
* call UI instead of being reported as a new incoming call. Has no effect
|
|
132
|
+
* until `configureCustomIncomingCallPush` has also been called.
|
|
133
|
+
*/
|
|
134
|
+
configureCustomCancelCallPush(typeField, cancelValue) {
|
|
135
|
+
NativeSinchCalling.configureCustomCancelCallPush(typeField, cancelValue);
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
/**
|
|
126
139
|
* Reports a system call UI (CallKit / Telecom) for a call your own app
|
|
127
140
|
* logic decided to show — from a custom push, a Socket.IO event, or
|
|
@@ -180,6 +193,16 @@ class SinchCalling {
|
|
|
180
193
|
onCallUIDeclined(listener) {
|
|
181
194
|
return NativeSinchCalling.onCallUIDeclined(listener);
|
|
182
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A configured cancel push (see `configureCustomCancelCallPush`) arrived
|
|
199
|
+
* for a call previously shown via a configured custom incoming-call push.
|
|
200
|
+
* The system call UI has already been torn down natively by the time this
|
|
201
|
+
* fires — use it to clean up any app-side state keyed by `callId`.
|
|
202
|
+
*/
|
|
203
|
+
onIncomingCallUICancelled(listener) {
|
|
204
|
+
return NativeSinchCalling.onIncomingCallUICancelled(listener);
|
|
205
|
+
}
|
|
183
206
|
}
|
|
184
207
|
export default new SinchCalling();
|
|
185
208
|
//# sourceMappingURL=SinchCalling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeSinchCalling","SinchCalling","credentialsProviderSubscription","configure","config","appKey","environmentHost","userId","start","stop","setRegistrationCredentialsProvider","provider","remove","onRegistrationCredentialsRequired","jwt","provideRegistrationCredentials","error","failRegistration","Error","message","String","onClientStarted","listener","onClientStartFailed","callUser","callPhoneNumber","phoneNumber","callerId","callConference","conferenceId","answerCall","callId","hangupCall","setMuted","muted","setSpeakerEnabled","enabled","sendDTMF","key","onIncomingCall","onCallProgressing","onCallEstablished","onCallEnded","registerFcmPush","senderId","token","enablePushNotifications","useProductionAps","relayRemotePushNotification","payload","configureCustomIncomingCallPush","idField","displayField","reportIncomingCallUI","displayName","onPushTokenRegistered","onPushTokenRegistrationFailed","resolveCallUIToConference","dismissCallUI","updateIncomingCallDisplayName","onVoipPushTokenUpdated","onIncomingCallUIShown","onCallUIAnswered","onCallUIDeclined"],"sourceRoot":"../../src","sources":["SinchCalling.ts"],"mappings":";;AACA,OAAOA,kBAAkB,
|
|
1
|
+
{"version":3,"names":["NativeSinchCalling","SinchCalling","credentialsProviderSubscription","configure","config","appKey","environmentHost","userId","start","stop","setRegistrationCredentialsProvider","provider","remove","onRegistrationCredentialsRequired","jwt","provideRegistrationCredentials","error","failRegistration","Error","message","String","onClientStarted","listener","onClientStartFailed","callUser","callPhoneNumber","phoneNumber","callerId","callConference","conferenceId","answerCall","callId","hangupCall","setMuted","muted","setSpeakerEnabled","enabled","sendDTMF","key","onIncomingCall","onCallProgressing","onCallEstablished","onCallEnded","registerFcmPush","senderId","token","enablePushNotifications","useProductionAps","relayRemotePushNotification","payload","configureCustomIncomingCallPush","idField","displayField","configureCustomCancelCallPush","typeField","cancelValue","reportIncomingCallUI","displayName","onPushTokenRegistered","onPushTokenRegistrationFailed","resolveCallUIToConference","dismissCallUI","updateIncomingCallDisplayName","onVoipPushTokenUpdated","onIncomingCallUIShown","onCallUIAnswered","onCallUIDeclined","onIncomingCallUICancelled"],"sourceRoot":"../../src","sources":["SinchCalling.ts"],"mappings":";;AACA,OAAOA,kBAAkB,MAUlB,yBAAsB;AAM7B,MAAMC,YAAY,CAAC;EACTC,+BAA+B,GAA6B,IAAI;EAExEC,SAASA,CAACC,MAAyB,EAAQ;IACzCJ,kBAAkB,CAACG,SAAS,CAC1BC,MAAM,CAACC,MAAM,EACbD,MAAM,CAACE,eAAe,EACtBF,MAAM,CAACG,MACT,CAAC;EACH;EAEAC,KAAKA,CAAA,EAAS;IACZR,kBA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AEA;AACF;AACA;AACA;AACA;EACE0C,qBAAqBA,CACnB1C,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAACgE,qBAAqB,CAAC1C,QAAQ,CAAC;EAC3D;;EAEA;EACA2C,gBAAgBA,CACd3C,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAACiE,gBAAgB,CAAC3C,QAAQ,CAAC;EACtD;;EAEA;EACA4C,gBAAgBA,CACd5C,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAACkE,gBAAgB,CAAC5C,QAAQ,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE6C,yBAAyBA,CACvB7C,QAAuD,EACpC;IACnB,OAAOtB,kBAAkB,CAACmE,yBAAyB,CAAC7C,QAAQ,CAAC;EAC/D;AACF;AAEA,eAAe,IAAIrB,YAAY,CAAC,CAAC","ignoreList":[]}
|
|
@@ -28,6 +28,9 @@ export interface IncomingCallUIEvent {
|
|
|
28
28
|
callId: string;
|
|
29
29
|
displayName: string;
|
|
30
30
|
}
|
|
31
|
+
export interface IncomingCallUICancelledEvent {
|
|
32
|
+
callId: string;
|
|
33
|
+
}
|
|
31
34
|
export interface Spec extends TurboModule {
|
|
32
35
|
configure(appKey: string, environmentHost: string, userId: string): void;
|
|
33
36
|
start(): void;
|
|
@@ -46,6 +49,7 @@ export interface Spec extends TurboModule {
|
|
|
46
49
|
enablePushNotifications(useProductionAps: boolean): void;
|
|
47
50
|
relayRemotePushNotification(payload: Object): void;
|
|
48
51
|
configureCustomIncomingCallPush(idField: string, displayField: string): void;
|
|
52
|
+
configureCustomCancelCallPush(typeField: string, cancelValue: string): void;
|
|
49
53
|
reportIncomingCallUI(callId: string, displayName: string): void;
|
|
50
54
|
resolveCallUIToConference(callId: string, conferenceId: string, callerId: string): string;
|
|
51
55
|
dismissCallUI(callId: string): void;
|
|
@@ -61,6 +65,7 @@ export interface Spec extends TurboModule {
|
|
|
61
65
|
onPushTokenRegistrationFailed: CodegenTypes.EventEmitter<ClientStartFailedEvent>;
|
|
62
66
|
onVoipPushTokenUpdated: CodegenTypes.EventEmitter<VoipPushTokenEvent>;
|
|
63
67
|
onIncomingCallUIShown: CodegenTypes.EventEmitter<IncomingCallUIEvent>;
|
|
68
|
+
onIncomingCallUICancelled: CodegenTypes.EventEmitter<IncomingCallUICancelledEvent>;
|
|
64
69
|
onCallUIAnswered: CodegenTypes.EventEmitter<CallUIAnsweredEvent>;
|
|
65
70
|
onCallUIDeclined: CodegenTypes.EventEmitter<CallUIDeclinedEvent>;
|
|
66
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSinchCalling.d.ts","sourceRoot":"","sources":["../../../src/NativeSinchCalling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,SAAS,CAA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IAC7D,iBAAiB,EAAE,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,iBAAiB,EAAE,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,WAAW,EAAE,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAEvD,qBAAqB,EAAE,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACvD,6BAA6B,EAAE,YAAY,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAKjF,sBAAsB,EAAE,YAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAMtE,qBAAqB,EAAE,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAOtE,yBAAyB,EAAE,YAAY,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;IAMnF,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IACjE,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;CAClE;;AAED,wBAAsE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventSubscription } from 'react-native';
|
|
2
|
-
import { type CallEndedEvent, type CallEvent, type ClientStartFailedEvent, type IncomingCallEvent, type CallUIAnsweredEvent, type CallUIDeclinedEvent, type IncomingCallUIEvent, type VoipPushTokenEvent } from './NativeSinchCalling';
|
|
2
|
+
import { type CallEndedEvent, type CallEvent, type ClientStartFailedEvent, type IncomingCallEvent, type CallUIAnsweredEvent, type CallUIDeclinedEvent, type IncomingCallUIEvent, type IncomingCallUICancelledEvent, type VoipPushTokenEvent } from './NativeSinchCalling';
|
|
3
3
|
import type { RegistrationCredentialsProvider, SinchClientConfig } from './types';
|
|
4
4
|
declare class SinchCalling {
|
|
5
5
|
private credentialsProviderSubscription;
|
|
@@ -61,6 +61,16 @@ declare class SinchCalling {
|
|
|
61
61
|
* always relay straight to Sinch (see `relayRemotePushNotification`).
|
|
62
62
|
*/
|
|
63
63
|
configureCustomIncomingCallPush(idField: string, displayField: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Opts into recognizing your own backend's cancel/end push payloads, on
|
|
66
|
+
* both platforms — e.g. `configureCustomCancelCallPush('type', 'call_cancelled')`
|
|
67
|
+
* for a payload shaped `{ type: 'call_cancelled', callId, ... }`. Checked
|
|
68
|
+
* before the `configureCustomIncomingCallPush` id-field match, so a push
|
|
69
|
+
* carrying both the id field and this cancel marker ends the already-shown
|
|
70
|
+
* call UI instead of being reported as a new incoming call. Has no effect
|
|
71
|
+
* until `configureCustomIncomingCallPush` has also been called.
|
|
72
|
+
*/
|
|
73
|
+
configureCustomCancelCallPush(typeField: string, cancelValue: string): void;
|
|
64
74
|
/**
|
|
65
75
|
* Reports a system call UI (CallKit / Telecom) for a call your own app
|
|
66
76
|
* logic decided to show — from a custom push, a Socket.IO event, or
|
|
@@ -92,6 +102,13 @@ declare class SinchCalling {
|
|
|
92
102
|
onCallUIAnswered(listener: (event: CallUIAnsweredEvent) => void): EventSubscription;
|
|
93
103
|
/** The system call UI shown via `reportIncomingCallUI` was declined. */
|
|
94
104
|
onCallUIDeclined(listener: (event: CallUIDeclinedEvent) => void): EventSubscription;
|
|
105
|
+
/**
|
|
106
|
+
* A configured cancel push (see `configureCustomCancelCallPush`) arrived
|
|
107
|
+
* for a call previously shown via a configured custom incoming-call push.
|
|
108
|
+
* The system call UI has already been torn down natively by the time this
|
|
109
|
+
* fires — use it to clean up any app-side state keyed by `callId`.
|
|
110
|
+
*/
|
|
111
|
+
onIncomingCallUICancelled(listener: (event: IncomingCallUICancelledEvent) => void): EventSubscription;
|
|
95
112
|
}
|
|
96
113
|
declare const _default: SinchCalling;
|
|
97
114
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SinchCalling.d.ts","sourceRoot":"","sources":["../../../src/SinchCalling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM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E;;;;;OAKG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAI/D,qBAAqB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,iBAAiB;IAI9D,6BAA6B,CAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,GAChD,iBAAiB;IAIpB;;;;OAIG;IACH,yBAAyB,CACvB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM;IAQT,6EAA6E;IAC7E,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAInC,sGAAsG;IACtG,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAIxE,iFAAiF;IACjF,sBAAsB,CACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAC5C,iBAAiB;IAIpB;;;;OAIG;IACH,qBAAqB,CACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,iBAAiB;IAIpB,wEAAwE;IACxE,gBAAgB,CACd,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,iBAAiB;IAIpB,wEAAwE;IACxE,gBAAgB,CACd,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,iBAAiB;IAIpB;;;;;OAKG;IACH,yBAAyB,CACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GACtD,iBAAiB;CAGrB;;AAED,wBAAkC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as SinchCalling } from './SinchCalling';
|
|
2
2
|
export type { RegistrationCredentialsProvider, SinchClientConfig, } from './types';
|
|
3
|
-
export type { CallEndedEvent, CallEvent, ClientStartFailedEvent, IncomingCallEvent, } from './NativeSinchCalling';
|
|
3
|
+
export type { CallEndedEvent, CallEvent, ClientStartFailedEvent, IncomingCallEvent, IncomingCallUICancelledEvent, } from './NativeSinchCalling';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EACV,+BAA+B,EAC/B,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,cAAc,EACd,SAAS,EACT,sBAAsB,EACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EACV,+BAA+B,EAC/B,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,cAAc,EACd,SAAS,EACT,sBAAsB,EACtB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -37,6 +37,10 @@ export interface IncomingCallUIEvent {
|
|
|
37
37
|
displayName: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export interface IncomingCallUICancelledEvent {
|
|
41
|
+
callId: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
export interface Spec extends TurboModule {
|
|
41
45
|
configure(appKey: string, environmentHost: string, userId: string): void;
|
|
42
46
|
start(): void;
|
|
@@ -88,6 +92,16 @@ export interface Spec extends TurboModule {
|
|
|
88
92
|
// relay to Sinch (the library's default, backend-agnostic behavior).
|
|
89
93
|
configureCustomIncomingCallPush(idField: string, displayField: string): void;
|
|
90
94
|
|
|
95
|
+
// Opts into recognizing your own backend's cancel/end push payloads —
|
|
96
|
+
// e.g. `configureCustomCancelCallPush("type", "call_cancelled")` for a
|
|
97
|
+
// payload shaped `{ type: "call_cancelled", callId, ... }`. Checked before
|
|
98
|
+
// the `configureCustomIncomingCallPush` id-field match, so a push carrying
|
|
99
|
+
// both the id field and this cancel marker ends the already-shown call UI
|
|
100
|
+
// instead of being reported as a new incoming call. Has no effect until
|
|
101
|
+
// `configureCustomIncomingCallPush` has also been called (there'd be no
|
|
102
|
+
// `callId` field to key off of otherwise).
|
|
103
|
+
configureCustomCancelCallPush(typeField: string, cancelValue: string): void;
|
|
104
|
+
|
|
91
105
|
// Reports a system call UI (CallKit / Telecom) for a call your own app
|
|
92
106
|
// logic decided to show — from a custom push, a Socket.IO event, or
|
|
93
107
|
// anything else. Not tied to any particular transport: call this directly
|
|
@@ -137,6 +151,13 @@ export interface Spec extends TurboModule {
|
|
|
137
151
|
// e.g. kicking off a caller-ID lookup the moment a call starts ringing.
|
|
138
152
|
onIncomingCallUIShown: CodegenTypes.EventEmitter<IncomingCallUIEvent>;
|
|
139
153
|
|
|
154
|
+
// A configured cancel push (see `configureCustomCancelCallPush`) arrived
|
|
155
|
+
// for a call previously shown via a configured custom incoming-call push.
|
|
156
|
+
// The system call UI has already been torn down natively by the time this
|
|
157
|
+
// fires — use it to clean up any app-side state keyed by `callId` (e.g. a
|
|
158
|
+
// pending caller-ID lookup).
|
|
159
|
+
onIncomingCallUICancelled: CodegenTypes.EventEmitter<IncomingCallUICancelledEvent>;
|
|
160
|
+
|
|
140
161
|
// The system call UI shown via `reportIncomingCallUI` (or a configured
|
|
141
162
|
// custom push) was answered/declined. Handle these however your backend
|
|
142
163
|
// expects — e.g. call your own accept/decline endpoint, then
|
package/src/SinchCalling.ts
CHANGED
|
@@ -7,6 +7,7 @@ import NativeSinchCalling, {
|
|
|
7
7
|
type CallUIAnsweredEvent,
|
|
8
8
|
type CallUIDeclinedEvent,
|
|
9
9
|
type IncomingCallUIEvent,
|
|
10
|
+
type IncomingCallUICancelledEvent,
|
|
10
11
|
type VoipPushTokenEvent,
|
|
11
12
|
} from './NativeSinchCalling';
|
|
12
13
|
import type {
|
|
@@ -162,6 +163,19 @@ class SinchCalling {
|
|
|
162
163
|
NativeSinchCalling.configureCustomIncomingCallPush(idField, displayField);
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Opts into recognizing your own backend's cancel/end push payloads, on
|
|
168
|
+
* both platforms — e.g. `configureCustomCancelCallPush('type', 'call_cancelled')`
|
|
169
|
+
* for a payload shaped `{ type: 'call_cancelled', callId, ... }`. Checked
|
|
170
|
+
* before the `configureCustomIncomingCallPush` id-field match, so a push
|
|
171
|
+
* carrying both the id field and this cancel marker ends the already-shown
|
|
172
|
+
* call UI instead of being reported as a new incoming call. Has no effect
|
|
173
|
+
* until `configureCustomIncomingCallPush` has also been called.
|
|
174
|
+
*/
|
|
175
|
+
configureCustomCancelCallPush(typeField: string, cancelValue: string): void {
|
|
176
|
+
NativeSinchCalling.configureCustomCancelCallPush(typeField, cancelValue);
|
|
177
|
+
}
|
|
178
|
+
|
|
165
179
|
/**
|
|
166
180
|
* Reports a system call UI (CallKit / Telecom) for a call your own app
|
|
167
181
|
* logic decided to show — from a custom push, a Socket.IO event, or
|
|
@@ -240,6 +254,18 @@ class SinchCalling {
|
|
|
240
254
|
): EventSubscription {
|
|
241
255
|
return NativeSinchCalling.onCallUIDeclined(listener);
|
|
242
256
|
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* A configured cancel push (see `configureCustomCancelCallPush`) arrived
|
|
260
|
+
* for a call previously shown via a configured custom incoming-call push.
|
|
261
|
+
* The system call UI has already been torn down natively by the time this
|
|
262
|
+
* fires — use it to clean up any app-side state keyed by `callId`.
|
|
263
|
+
*/
|
|
264
|
+
onIncomingCallUICancelled(
|
|
265
|
+
listener: (event: IncomingCallUICancelledEvent) => void
|
|
266
|
+
): EventSubscription {
|
|
267
|
+
return NativeSinchCalling.onIncomingCallUICancelled(listener);
|
|
268
|
+
}
|
|
243
269
|
}
|
|
244
270
|
|
|
245
271
|
export default new SinchCalling();
|