react-native-sinch-calling 0.3.0 → 0.6.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 CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 0.6.0
6
+
7
+ ### Added
8
+
9
+ - `SinchCalling.eagerlyRegisterForVoipPush()` (iOS, native — not exposed to JS). Call it as the first line of `application(_:didFinishLaunchingWithOptions:)` to register `PKPushRegistry` and configure the custom incoming/cancel-call push fields immediately, independent of React Native. Without this, VoIP push registration only happened once the JS bridge called `enablePushNotifications()` deep into app bootstrap (after the RN bundle loaded, state rehydrated, etc.) — too late for the app to reliably report a call when iOS relaunches it from killed purely to deliver that push.
10
+
11
+ ### Changed
12
+
13
+ - `SinchPushManager` (iOS) now reports directly to `SinchCallKitManager` for a detected custom incoming/cancel push, instead of only notifying its delegate (which the JS-driven `SinchCalling` TurboModule instance implements). This means CallKit gets its report even if the delegate/JS bridge doesn't exist yet — the delegate now exists purely to notify JS (e.g. for a caller-ID lookup), not to perform the report itself.
14
+ - `SinchCallManager`, `SinchPushManager`, and `SinchCallKitManager` (iOS) are now shared singletons across the process rather than per-`SinchCalling`-instance, so the eager native call above and the later JS-driven TurboModule instance operate on the same `PKPushRegistry`/`CXProvider` instead of each creating their own (a single `PKPushRegistry` only supports one delegate per push type).
15
+
16
+ ## 0.5.0
17
+
18
+ ### Added
19
+
20
+ - `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.
21
+ - `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`.
22
+
23
+ ### Fixed
24
+
25
+ - 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.
26
+
5
27
  ## 0.3.0
6
28
 
7
29
  ### Added
package/README.md CHANGED
@@ -50,6 +50,7 @@ npm install react-native-sinch-calling
50
50
  </array>
51
51
  ```
52
52
  - Enable the **Push Notifications** capability in Xcode (adds `aps-environment` to your entitlements) — required for `enablePushNotifications()`.
53
+ - **Strongly recommended**: call `+[SinchCalling eagerlyRegisterForVoipPush]` as the first line of `application(_:didFinishLaunchingWithOptions:)` in your `AppDelegate` (native, not exposed to JS — see [Registering for VoIP push before React Native boots](#registering-for-voip-push-before-react-native-boots)). Registering only from JS via `enablePushNotifications()` means a killed app has no `PKPushRegistry` set up yet at the moment iOS relaunches it to deliver a VoIP push, so it may fail to ring.
53
54
 
54
55
  ### Android
55
56
 
@@ -121,6 +122,32 @@ const callId = SinchCalling.callConference('conf_abc123', '+14155550100');
121
122
  SinchCalling.sendDTMF(callId, '5');
122
123
  ```
123
124
 
125
+ ### Registering for VoIP push before React Native boots
126
+
127
+ `SinchCalling.enablePushNotifications()` (JS) only runs once the RN bundle has loaded, your app's state has rehydrated, and your code decides to call it — often well after your session/login logic runs. That's fine while the app is already running, but it's too late for the one case VoIP push exists for: iOS relaunching your app from **killed** purely to deliver a push. If `PKPushRegistry` isn't already registered by the time that happens, the call can't be reported and the launch is wasted.
128
+
129
+ On iOS, register natively instead, as the first line of `application(_:didFinishLaunchingWithOptions:)` — before React Native starts:
130
+
131
+ ```swift
132
+ import SinchCalling
133
+
134
+ func application(
135
+ _ application: UIApplication,
136
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
137
+ ) -> Bool {
138
+ SinchCalling.eagerlyRegisterForVoipPush()
139
+
140
+ // ... start React Native as usual
141
+ return true
142
+ }
143
+ ```
144
+
145
+ This is a native-only entry point (not exposed to JS) that registers `PKPushRegistry` and configures the same custom incoming/cancel-call push fields as `configureCustomIncomingCallPush`/`configureCustomCancelCallPush` (hardcoded to `"callId"`/`"callerNumber"` and `"type"`/`"call_cancelled"` — update it in `SinchCalling.mm` if your backend's payload uses different field names). It's safe to also still call the JS APIs later — they operate on the same shared native objects, so nothing gets double-registered.
146
+
147
+ Picks `useProductionAps` automatically from the build configuration (`#if DEBUG`) rather than a JS-supplied flag, since it runs before any JS exists.
148
+
149
+ Android is different in kind, not necessarily gap-free: FCM data messages delivered while the app is killed run through RN Firebase's headless JS task mechanism (`setBackgroundMessageHandler`), which starts a fresh JS engine/bridge specifically to handle that one message — independent of whether your app has "launched" in the normal sense. But that also means it's a fresh native module instance too: if `configureCustomIncomingCallPush`/`configureCustomCancelCallPush` are only called from your app's normal boot sequence (e.g. after checking a login token), that boot sequence may never run in this headless context, leaving those fields unconfigured for that invocation. If you see the same "doesn't ring when killed" symptom on Android, call `configureCustomIncomingCallPush`/`configureCustomCancelCallPush` directly inside your `setBackgroundMessageHandler` callback (before forwarding to `relayRemotePushNotification`), not only from your app's regular init path.
150
+
124
151
  ### Custom incoming-call flows
125
152
 
126
153
  Some backends don't let Sinch route calls directly to a registered client — e.g. an inbound PSTN call gets parked and bridged into a Sinch conference only after your backend decides to connect it (fraud checks, business hours routing, a "ring multiple agents" pattern, etc). For that, your backend sends your app its own push/socket signal, and you tell this library about it explicitly:
@@ -160,6 +187,21 @@ SinchCalling.onCallUIAnswered(async ({ callId }) => {
160
187
  SinchCalling.onCallUIDeclined(({ callId }) => {
161
188
  declineOnYourBackend(callId);
162
189
  });
190
+
191
+ // If your backend can also cancel/end a call that's already ringing on this
192
+ // device (caller hung up, answered on another device, forwarded elsewhere,
193
+ // etc.), it needs a way to tell a "cancel" push apart from a "new call" push
194
+ // — reusing the same `idField` for both (a natural design, since both need
195
+ // to say which call they're about) would otherwise make every cancel push
196
+ // look like a new incoming call. Configure the field/value your backend
197
+ // uses to mark a cancel, e.g. `{ type: "call_cancelled", callId, reason }`:
198
+ SinchCalling.configureCustomCancelCallPush('type', 'call_cancelled');
199
+
200
+ // Fires once a cancel push has ended the system call UI natively — clean up
201
+ // any app-side state keyed by `callId` (a pending caller-ID lookup, etc.).
202
+ SinchCalling.onIncomingCallUICancelled(({ callId }) => {
203
+ cleanUpPendingCallState(callId);
204
+ });
163
205
  ```
164
206
 
165
207
  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 +252,13 @@ SinchCalling.onClientStartFailed(({ code }) => {
210
252
  | `enablePushNotifications(useProductionAps)` | iOS | No-op on Android |
211
253
  | `relayRemotePushNotification(payload)` | Android | No-op on iOS |
212
254
  | `configureCustomIncomingCallPush(idField, displayField)` | both | Opt-in — see [Custom incoming-call flows](#custom-incoming-call-flows) |
255
+ | `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
256
  | `reportIncomingCallUI(callId, displayName)` | both | Shows a call UI for any reason you decide to |
214
257
  | `resolveCallUIToConference(callId, conferenceId, callerId)` → `callId` | both | Turns a shown call UI into a real call |
215
258
  | `dismissCallUI(callId)` | both | Cleans up a call UI that couldn't be resolved |
216
259
  | `updateIncomingCallDisplayName(callId, displayName)` | both | Overrides the shown caller name |
217
260
 
218
- Events: `onClientStarted`, `onClientStartFailed`, `onRegistrationCredentialsRequired` (internal — handled by `setRegistrationCredentialsProvider`), `onIncomingCall`, `onCallProgressing`, `onCallEstablished`, `onCallEnded`, `onPushTokenRegistered`, `onPushTokenRegistrationFailed`, `onVoipPushTokenUpdated` (iOS — forward to your backend), `onIncomingCallUIShown`, `onCallUIAnswered`, `onCallUIDeclined`.
261
+ 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
262
 
220
263
  ## Known limitations
221
264
 
@@ -40,6 +40,10 @@ interface SinchCallManagerListener {
40
40
  fun onIncomingCallUIShown(callId: String, displayName: String)
41
41
  fun onCallUIAnswered(callId: String)
42
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)
43
47
  }
44
48
 
45
49
  private fun endCauseString(endCause: CallEndCause): String = when (endCause) {
@@ -66,6 +70,8 @@ class SinchCallManager(private val context: Context) {
66
70
  private val calls = mutableMapOf<String, Call>()
67
71
  private var customPushIdField: String? = null
68
72
  private var customPushDisplayField: String? = null
73
+ private var customCancelTypeField: String? = null
74
+ private var customCancelValue: String? = null
69
75
 
70
76
  // Proximity-screen-off during an established earpiece call, same as the
71
77
  // system Phone app: on while at least one call is established and the
@@ -135,10 +141,29 @@ class SinchCallManager(private val context: Context) {
135
141
  customPushDisplayField = displayField
136
142
  }
137
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
+
138
155
  fun relayRemotePushNotification(payload: Map<String, String>) {
139
156
  val idField = customPushIdField
140
157
  val callId = idField?.let { payload[it] }
141
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
+
142
167
  val displayName = customPushDisplayField?.let { payload[it] } ?: ""
143
168
  reportIncomingCallUI(callId, displayName)
144
169
  return
@@ -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
  }
@@ -7,7 +7,15 @@ import SinchRTC
7
7
  // A configured custom incoming-call push was detected — distinct from a
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
+ // The system call UI has already been reported by the time this fires
11
+ // (see `callKitManager` below) — this is purely for observers (e.g. the
12
+ // JS bridge) that want to react, such as kicking off a caller-ID lookup.
10
13
  func sinchPushManagerDidDetectCustomIncomingCall(_ callId: String, displayName: String)
14
+ // A configured cancel push was detected for a call already reported via
15
+ // `sinchPushManagerDidDetectCustomIncomingCall` — see
16
+ // `configureCustomCancelCallPush`. The call UI has already been ended by
17
+ // the time this fires.
18
+ func sinchPushManagerDidDetectCustomCancelCall(_ callId: String)
11
19
  }
12
20
 
13
21
  // A single `PKPushRegistry` can only have one delegate per push type, so this
@@ -16,17 +24,26 @@ import SinchRTC
16
24
  // `configureCustomIncomingCallPush`, payloads containing both configured
17
25
  // fields are instead reported as an external incoming call and skip the
18
26
  // Sinch relay for that push.
27
+ //
28
+ // Reports directly to `callKitManager` (rather than only notifying
29
+ // `delegate`) so a killed app can ring from a cold launch triggered by the
30
+ // push itself, before React Native has booted and any delegate/JS bridge
31
+ // exists to receive it — see `SinchCalling.eagerlyRegisterForVoipPush`.
19
32
  @objc(SinchPushManager)
20
33
  public final class SinchPushManager: NSObject {
21
34
  @objc public weak var delegate: SinchPushManagerDelegate?
22
35
 
23
36
  private weak var callManager: SinchCallManager?
37
+ private weak var callKitManager: SinchCallKitManager?
24
38
  private var registry: PKPushRegistry?
25
39
  private var customIdField: String?
26
40
  private var customDisplayField: String?
41
+ private var customCancelTypeField: String?
42
+ private var customCancelValue: String?
27
43
 
28
- @objc public init(callManager: SinchCallManager) {
44
+ @objc public init(callManager: SinchCallManager, callKitManager: SinchCallKitManager) {
29
45
  self.callManager = callManager
46
+ self.callKitManager = callKitManager
30
47
  super.init()
31
48
  }
32
49
 
@@ -43,6 +60,17 @@ public final class SinchPushManager: NSObject {
43
60
  customIdField = idField
44
61
  customDisplayField = displayField
45
62
  }
63
+
64
+ // Opts into recognizing a cancel/end push shaped like the configured
65
+ // incoming-call push but carrying `typeField == cancelValue` — e.g. the
66
+ // backend reuses the same `idField` but sets `type: "call_cancelled"`
67
+ // instead of `"incoming_call"`. Checked before the incoming-call match in
68
+ // `didReceiveIncomingPushWith`, so a push satisfying both is treated as a
69
+ // cancel.
70
+ @objc public func configureCustomCancelCallPush(typeField: String, cancelValue: String) {
71
+ customCancelTypeField = typeField
72
+ customCancelValue = cancelValue
73
+ }
46
74
  }
47
75
 
48
76
  extension SinchPushManager: PKPushRegistryDelegate {
@@ -71,8 +99,18 @@ extension SinchPushManager: PKPushRegistryDelegate {
71
99
 
72
100
  let dict = payload.dictionaryPayload
73
101
  if let idField = customIdField, let callId = dict[idField] as? String {
74
- let displayName = customDisplayField.flatMap { dict[$0] as? String } ?? ""
75
- delegate?.sinchPushManagerDidDetectCustomIncomingCall(callId, displayName: displayName)
102
+ if let typeField = customCancelTypeField,
103
+ let cancelValue = customCancelValue,
104
+ let typeValue = dict[typeField] as? String,
105
+ typeValue == cancelValue
106
+ {
107
+ callKitManager?.reportCallEnded(callId)
108
+ delegate?.sinchPushManagerDidDetectCustomCancelCall(callId)
109
+ } else {
110
+ let displayName = customDisplayField.flatMap { dict[$0] as? String } ?? ""
111
+ callKitManager?.reportExternalIncomingCall(callId, displayName: displayName)
112
+ delegate?.sinchPushManagerDidDetectCustomIncomingCall(callId, displayName: displayName)
113
+ }
76
114
  } else {
77
115
  callManager?.relayPushNotification(dict)
78
116
  }
@@ -2,4 +2,14 @@
2
2
 
3
3
  @interface SinchCalling : NativeSinchCallingSpecBase <NativeSinchCallingSpec>
4
4
 
5
+ // Registers for VoIP push (PKPushRegistry) and configures the custom
6
+ // incoming/cancel-call push field names immediately, independent of React
7
+ // Native and any consumer-app login state. Call this as early as possible —
8
+ // ideally the first line of `application(_:didFinishLaunchingWithOptions:)`
9
+ // — so a killed app can still ring and report to CallKit from a cold launch
10
+ // triggered by the push itself, before the JS bridge exists. Safe to call
11
+ // even if the RN-driven `SinchCalling` TurboModule instance is created
12
+ // later in the same process — both share the same underlying managers.
13
+ + (void)eagerlyRegisterForVoipPush;
14
+
5
15
  @end
@@ -11,20 +11,55 @@
11
11
  @interface SinchCalling () <SinchCallManagerDelegate, SinchCallKitManagerDelegate, SinchPushManagerDelegate>
12
12
  @end
13
13
 
14
+ // Shared across every `SinchCalling` instance in the process, and reachable
15
+ // before any instance exists at all via `+eagerlyRegisterForVoipPush` — see
16
+ // that method and `SinchPushManager`'s header comment for why: VoIP push
17
+ // registration and CallKit reporting must work even when the app is woken
18
+ // from killed purely by the incoming push, before React Native (and this
19
+ // TurboModule instance) has been created.
20
+ static SinchCallManager *sSharedCallManager = nil;
21
+ static SinchPushManager *sSharedPushManager = nil;
22
+ static SinchCallKitManager *sSharedCallKitManager = nil;
23
+
24
+ static void SinchCallingEnsureSharedManagers(void)
25
+ {
26
+ if (sSharedCallManager != nil) {
27
+ return;
28
+ }
29
+ sSharedCallManager = [SinchCallManager new];
30
+ sSharedCallKitManager = [SinchCallKitManager new];
31
+ sSharedPushManager = [[SinchPushManager alloc] initWithCallManager:sSharedCallManager
32
+ callKitManager:sSharedCallKitManager];
33
+ }
34
+
14
35
  @implementation SinchCalling {
15
36
  SinchCallManager *_callManager;
16
37
  SinchPushManager *_pushManager;
17
38
  SinchCallKitManager *_callKitManager;
18
39
  }
19
40
 
41
+ + (void)eagerlyRegisterForVoipPush
42
+ {
43
+ SinchCallingEnsureSharedManagers();
44
+ #if DEBUG
45
+ BOOL useProductionAps = NO;
46
+ #else
47
+ BOOL useProductionAps = YES;
48
+ #endif
49
+ [sSharedPushManager enableWithUseProductionAps:useProductionAps];
50
+ [sSharedPushManager configureCustomIncomingCallPushWithIdField:@"callId" displayField:@"callerNumber"];
51
+ [sSharedPushManager configureCustomCancelCallPushWithTypeField:@"type" cancelValue:@"call_cancelled"];
52
+ }
53
+
20
54
  - (instancetype)init
21
55
  {
22
56
  if (self = [super init]) {
23
- _callManager = [SinchCallManager new];
57
+ SinchCallingEnsureSharedManagers();
58
+ _callManager = sSharedCallManager;
59
+ _pushManager = sSharedPushManager;
60
+ _callKitManager = sSharedCallKitManager;
24
61
  _callManager.delegate = self;
25
- _pushManager = [[SinchPushManager alloc] initWithCallManager:_callManager];
26
62
  _pushManager.delegate = self;
27
- _callKitManager = [SinchCallKitManager new];
28
63
  _callKitManager.delegate = self;
29
64
  }
30
65
  return self;
@@ -80,6 +115,11 @@
80
115
  [_pushManager configureCustomIncomingCallPushWithIdField:idField displayField:displayField];
81
116
  }
82
117
 
118
+ - (void)configureCustomCancelCallPush:(NSString *)typeField cancelValue:(NSString *)cancelValue
119
+ {
120
+ [_pushManager configureCustomCancelCallPushWithTypeField:typeField cancelValue:cancelValue];
121
+ }
122
+
83
123
  - (void)reportIncomingCallUI:(NSString *)callId displayName:(NSString *)displayName
84
124
  {
85
125
  [_callKitManager reportExternalIncomingCall:callId displayName:displayName];
@@ -224,10 +264,16 @@
224
264
 
225
265
  - (void)sinchPushManagerDidDetectCustomIncomingCall:(NSString *)callId displayName:(NSString *)displayName
226
266
  {
227
- [_callKitManager reportExternalIncomingCall:callId displayName:displayName];
267
+ // `SinchPushManager` already reported this to CallKit directly (works
268
+ // even before this instance/delegate exists) — just relay to JS.
228
269
  [self emitOnIncomingCallUIShown:@{ @"callId" : callId, @"displayName" : displayName }];
229
270
  }
230
271
 
272
+ - (void)sinchPushManagerDidDetectCustomCancelCall:(NSString *)callId
273
+ {
274
+ [self emitOnIncomingCallUICancelled:@{ @"callId" : callId }];
275
+ }
276
+
231
277
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
232
278
  (const facebook::react::ObjCTurboModule::InitParams &)params
233
279
  {
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSinchCalling.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAmJpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
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"],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,EAAEuB,WAAW,CAAC;EACvE;;EAEA;EACAM,sBAAsBA,CACpBtC,QAA6C,EAC1B;IACnB,OAAOtB,kBAAkB,CAAC4D,sBAAsB,CAACtC,QAAQ,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACEuC,qBAAqBA,CACnBvC,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAAC6D,qBAAqB,CAACvC,QAAQ,CAAC;EAC3D;;EAEA;EACAwC,gBAAgBA,CACdxC,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAAC8D,gBAAgB,CAACxC,QAAQ,CAAC;EACtD;;EAEA;EACAyC,gBAAgBA,CACdzC,QAA8C,EAC3B;IACnB,OAAOtB,kBAAkB,CAAC+D,gBAAgB,CAACzC,QAAQ,CAAC;EACtD;AACF;AAEA,eAAe,IAAIrB,YAAY,CAAC,CAAC","ignoreList":[]}
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,YA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B,MAAc,EAAE0B,WAAmB,EAAQ;IACvEzD,kBAAkB,CAAC8D,6BAA6B,CAAC/B,MAAM,EAAE0B,WAAW,CAAC;EACvE;;EAEA;EACAM,sBAAsBA,CACpBzC,QAA6C,EAC1B;IACnB,OAAOtB,kBAAkB,CAAC+D,sBAAsB,CAACzC,QAAQ,CAAC;EAC5D;;EAEA;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,W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AY,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,cAAc,CAAC;AACtD,OAA2B,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,+BAA+B,EAC/B,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,cAAM,YA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,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,GAClB,MAAM,sBAAsB,CAAC"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-sinch-calling",
3
- "version": "0.3.0",
3
+ "version": "0.6.0",
4
4
  "description": "React Native TurboModule wrapper for Sinch Voice Calling SDK (Android & iOS)",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -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
@@ -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();
package/src/index.tsx CHANGED
@@ -8,4 +8,5 @@ export type {
8
8
  CallEvent,
9
9
  ClientStartFailedEvent,
10
10
  IncomingCallEvent,
11
+ IncomingCallUICancelledEvent,
11
12
  } from './NativeSinchCalling';