@robono/calling-react-native 0.11.4 → 0.12.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/INCOMING-CALLS.md +21 -0
- package/SBOM.spdx.json +38 -38
- package/dist/CallRecord.d.ts +8 -2
- package/dist/CallRecord.js +8 -8
- package/dist/components.js +3 -3
- package/dist/controller.d.mts +1 -1
- package/dist/controller.mjs +10 -4
- package/dist/groups.d.ts +1 -1
- package/dist/messenger.d.ts +14 -0
- package/dist/messenger.js +24 -1
- package/dist/system-calling.d.ts +12 -0
- package/dist/system-calling.js +45 -2
- package/dist/types.d.ts +7 -0
- package/dist/versions.d.ts +2 -2
- package/dist/versions.js +2 -2
- package/ios/RobonoSystemCalling.m +21 -4
- package/package.json +2 -2
package/INCOMING-CALLS.md
CHANGED
|
@@ -120,3 +120,24 @@ Apps built with older SDKs need one native update to gain this capability. Subse
|
|
|
120
120
|
Custom calling hosts pass the authenticated `appearance` to `system.updateAppearance(appearance)` whenever it changes. `createMessengerCalling` provides `onAppearance` and `refreshAppearance()` so a host can refresh without reconnecting or ending a call. Shared Messenger wires these automatically. Hosts with their own CallKit provider remain responsible for that provider.
|
|
121
121
|
|
|
122
122
|
The optional `callKitIcon` plugin path and existing `.robono/callkit-icon.json` files remain supported as build-time fallbacks for older integrations. Website branding takes precedence once synchronized.
|
|
123
|
+
|
|
124
|
+
### Direct calling-service hosts
|
|
125
|
+
|
|
126
|
+
Hosts using authenticated `wake/register` sessions can use the same native
|
|
127
|
+
coordinator with `accountScopeFormat: 'user-id'`. Supply the authenticated user's
|
|
128
|
+
UUID; the default notification-account format remains unchanged. On iOS,
|
|
129
|
+
`connectCallingWakeRegistration({accountId, system, controller, request, onError})`
|
|
130
|
+
registers the native VoIP token for voice and video, renews the lease, and retries
|
|
131
|
+
transient registration failures on later controller updates. Dispose the registration
|
|
132
|
+
when its controller/session is replaced and dispose the system coordinator on sign-out.
|
|
133
|
+
Configure the coordinator as soon as authenticated identity is available, including
|
|
134
|
+
cold starts, and let its `start` callback await the authenticated controller connection.
|
|
135
|
+
Pass `system.audio(() => controller)` to the native media adapter and attach each
|
|
136
|
+
controller to `system.attach(controller)`.
|
|
137
|
+
|
|
138
|
+
The direct service's invitation includes the authorized conversation ID, call
|
|
139
|
+
kind, recipient, call ID and expiry. The native adapter accepts that envelope as
|
|
140
|
+
well as the standard Messenger envelope, validates the recipient and expiry before
|
|
141
|
+
presentation, and still requires fresh calling authorization before answering.
|
|
142
|
+
Use the incoming-calls Expo plugin (or its documented native setup) and rebuild the
|
|
143
|
+
app. Ordinary APNs alert registration is not a substitute for system incoming calls.
|
package/SBOM.spdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"spdxVersion": "SPDX-2.3",
|
|
3
3
|
"dataLicense": "CC0-1.0",
|
|
4
4
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
5
|
-
"name": "@robono/calling-react-native@0.
|
|
6
|
-
"documentNamespace": "https://robono.com/sbom/calling-react-native/0.
|
|
5
|
+
"name": "@robono/calling-react-native@0.12.0",
|
|
6
|
+
"documentNamespace": "https://robono.com/sbom/calling-react-native/0.12.0/1674d37a69ba183d65170a89538374d08e7550ed",
|
|
7
7
|
"creationInfo": {
|
|
8
|
-
"created": "2026-
|
|
8
|
+
"created": "2026-12-04T03:19:53.130Z",
|
|
9
9
|
"creators": [
|
|
10
10
|
"Organization: Robono (support@robono.com)"
|
|
11
11
|
]
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
{
|
|
15
15
|
"name": "@robono/calling-react-native",
|
|
16
16
|
"SPDXID": "SPDXRef-Package",
|
|
17
|
-
"versionInfo": "0.
|
|
17
|
+
"versionInfo": "0.12.0",
|
|
18
18
|
"downloadLocation": "NOASSERTION",
|
|
19
19
|
"filesAnalyzed": true,
|
|
20
20
|
"packageVerificationCode": {
|
|
21
|
-
"packageVerificationCodeValue": "
|
|
21
|
+
"packageVerificationCodeValue": "1674d37a69ba183d65170a89538374d08e7550ed"
|
|
22
22
|
},
|
|
23
23
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
24
24
|
"licenseDeclared": "LicenseRef-RobonoSDK",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"LicenseRef-RobonoSDK"
|
|
27
27
|
],
|
|
28
28
|
"copyrightText": "Copyright (c) 2026 Add to Loop LLC.",
|
|
29
|
-
"comment": "Host-supplied peers (not bundled): {\"@robono/calling\":\"^0.
|
|
29
|
+
"comment": "Host-supplied peers (not bundled): {\"@robono/calling\":\"^0.8.0\",\"react\":\">=18.2 <20\",\"react-native\":\">=0.76 <1\",\"react-native-svg\":\">=15 <16\",\"react-native-safe-area-context\":\">=5 <6\",\"react-native-webrtc\":\">=124 <125\",\"react-native-incall-manager\":\">=4.2 <5\",\"expo-audio\":\">=1.1.1 <2 || >=55 <57\",\"expo-crypto\":\">=15.0.9 <16 || >=55 <57\",\"expo-notifications\":\">=0.32.17 <0.33 || >=55 <57\",\"expo-asset\":\">=12 <13 || >=55 <57\"}"
|
|
30
30
|
}
|
|
31
31
|
],
|
|
32
32
|
"files": [
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"checksums": [
|
|
56
56
|
{
|
|
57
57
|
"algorithm": "SHA256",
|
|
58
|
-
"checksumValue": "
|
|
58
|
+
"checksumValue": "cb731f445ae318255ace467f67799c74546a99a594de7e0cfd591bae84e98b18"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"algorithm": "SHA1",
|
|
62
|
-
"checksumValue": "
|
|
62
|
+
"checksumValue": "2653fc50f08e1d96c453ac8017eaa728577441ae"
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
65
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5337,11 +5337,11 @@
|
|
|
5337
5337
|
"checksums": [
|
|
5338
5338
|
{
|
|
5339
5339
|
"algorithm": "SHA256",
|
|
5340
|
-
"checksumValue": "
|
|
5340
|
+
"checksumValue": "d10a0bca194cf552e0d5ac5180e4cc71a7d70063ec307397b20bd2fc7927b04b"
|
|
5341
5341
|
},
|
|
5342
5342
|
{
|
|
5343
5343
|
"algorithm": "SHA1",
|
|
5344
|
-
"checksumValue": "
|
|
5344
|
+
"checksumValue": "87ea2f12d92f818c397792c2e27f4b272a95376b"
|
|
5345
5345
|
}
|
|
5346
5346
|
],
|
|
5347
5347
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5356,11 +5356,11 @@
|
|
|
5356
5356
|
"checksums": [
|
|
5357
5357
|
{
|
|
5358
5358
|
"algorithm": "SHA256",
|
|
5359
|
-
"checksumValue": "
|
|
5359
|
+
"checksumValue": "f3a863ff9aea43dd2de9408a3de687aa96e0e832d451ebab6f71bbc26fbec372"
|
|
5360
5360
|
},
|
|
5361
5361
|
{
|
|
5362
5362
|
"algorithm": "SHA1",
|
|
5363
|
-
"checksumValue": "
|
|
5363
|
+
"checksumValue": "887149097f366d8195702ee92124f1aef9ce1721"
|
|
5364
5364
|
}
|
|
5365
5365
|
],
|
|
5366
5366
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5394,11 +5394,11 @@
|
|
|
5394
5394
|
"checksums": [
|
|
5395
5395
|
{
|
|
5396
5396
|
"algorithm": "SHA256",
|
|
5397
|
-
"checksumValue": "
|
|
5397
|
+
"checksumValue": "f9fb8a50381a3d811f4022ffcb989c793d7a4511c8130553e7615fe676d46a5a"
|
|
5398
5398
|
},
|
|
5399
5399
|
{
|
|
5400
5400
|
"algorithm": "SHA1",
|
|
5401
|
-
"checksumValue": "
|
|
5401
|
+
"checksumValue": "6558130be38724acc2d37482b45a7a6876bf73d2"
|
|
5402
5402
|
}
|
|
5403
5403
|
],
|
|
5404
5404
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5413,11 +5413,11 @@
|
|
|
5413
5413
|
"checksums": [
|
|
5414
5414
|
{
|
|
5415
5415
|
"algorithm": "SHA256",
|
|
5416
|
-
"checksumValue": "
|
|
5416
|
+
"checksumValue": "5c003ef653172b18abcff6254b841440ab29f91fd37b0e2c1f0ad621b19d6346"
|
|
5417
5417
|
},
|
|
5418
5418
|
{
|
|
5419
5419
|
"algorithm": "SHA1",
|
|
5420
|
-
"checksumValue": "
|
|
5420
|
+
"checksumValue": "c0a8f20b6eddd671c9114cfc66555c276ddfc57c"
|
|
5421
5421
|
}
|
|
5422
5422
|
],
|
|
5423
5423
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5432,11 +5432,11 @@
|
|
|
5432
5432
|
"checksums": [
|
|
5433
5433
|
{
|
|
5434
5434
|
"algorithm": "SHA256",
|
|
5435
|
-
"checksumValue": "
|
|
5435
|
+
"checksumValue": "5d223ee4344374f54c60f3a2cabd924884bdbf970731318e9cfd7ea85a621d30"
|
|
5436
5436
|
},
|
|
5437
5437
|
{
|
|
5438
5438
|
"algorithm": "SHA1",
|
|
5439
|
-
"checksumValue": "
|
|
5439
|
+
"checksumValue": "39ab448b964720d683e293f50da3f2e0f12ebf5b"
|
|
5440
5440
|
}
|
|
5441
5441
|
],
|
|
5442
5442
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5717,11 +5717,11 @@
|
|
|
5717
5717
|
"checksums": [
|
|
5718
5718
|
{
|
|
5719
5719
|
"algorithm": "SHA256",
|
|
5720
|
-
"checksumValue": "
|
|
5720
|
+
"checksumValue": "b1546495e55f236cbf484584d33ec0a6ff93968579b08479f20c829e9d2a4bbd"
|
|
5721
5721
|
},
|
|
5722
5722
|
{
|
|
5723
5723
|
"algorithm": "SHA1",
|
|
5724
|
-
"checksumValue": "
|
|
5724
|
+
"checksumValue": "1ab0a55fb68abf2ab5ec8e59011fb5196400630f"
|
|
5725
5725
|
}
|
|
5726
5726
|
],
|
|
5727
5727
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5831,11 +5831,11 @@
|
|
|
5831
5831
|
"checksums": [
|
|
5832
5832
|
{
|
|
5833
5833
|
"algorithm": "SHA256",
|
|
5834
|
-
"checksumValue": "
|
|
5834
|
+
"checksumValue": "5fed9a3b4ecd30417000dcb3959906a1fe342779546bd93b587b7c6c90dadae5"
|
|
5835
5835
|
},
|
|
5836
5836
|
{
|
|
5837
5837
|
"algorithm": "SHA1",
|
|
5838
|
-
"checksumValue": "
|
|
5838
|
+
"checksumValue": "ea318d32f4461b24456bccb8e6839ff8b2ff18e5"
|
|
5839
5839
|
}
|
|
5840
5840
|
],
|
|
5841
5841
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -5850,11 +5850,11 @@
|
|
|
5850
5850
|
"checksums": [
|
|
5851
5851
|
{
|
|
5852
5852
|
"algorithm": "SHA256",
|
|
5853
|
-
"checksumValue": "
|
|
5853
|
+
"checksumValue": "81560ad35c6379836ccd399e955d9ae096dc8852ee4119d18f81b3adfa6273c0"
|
|
5854
5854
|
},
|
|
5855
5855
|
{
|
|
5856
5856
|
"algorithm": "SHA1",
|
|
5857
|
-
"checksumValue": "
|
|
5857
|
+
"checksumValue": "8f1389edd30a18ab69d590fcbd1b5f6b6eb9a3f4"
|
|
5858
5858
|
}
|
|
5859
5859
|
],
|
|
5860
5860
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6135,11 +6135,11 @@
|
|
|
6135
6135
|
"checksums": [
|
|
6136
6136
|
{
|
|
6137
6137
|
"algorithm": "SHA256",
|
|
6138
|
-
"checksumValue": "
|
|
6138
|
+
"checksumValue": "6fcf9afa35be50ead216d068f647dbcf2c7039e595276e34fae652cfc45576a4"
|
|
6139
6139
|
},
|
|
6140
6140
|
{
|
|
6141
6141
|
"algorithm": "SHA1",
|
|
6142
|
-
"checksumValue": "
|
|
6142
|
+
"checksumValue": "5d8b4254a1c49f555ba9a4b075219ed33aa38a64"
|
|
6143
6143
|
}
|
|
6144
6144
|
],
|
|
6145
6145
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6154,11 +6154,11 @@
|
|
|
6154
6154
|
"checksums": [
|
|
6155
6155
|
{
|
|
6156
6156
|
"algorithm": "SHA256",
|
|
6157
|
-
"checksumValue": "
|
|
6157
|
+
"checksumValue": "ebf150bbed83befe0a57635a5cd2062904d96512b030a7a4a10f65a8f7a53c55"
|
|
6158
6158
|
},
|
|
6159
6159
|
{
|
|
6160
6160
|
"algorithm": "SHA1",
|
|
6161
|
-
"checksumValue": "
|
|
6161
|
+
"checksumValue": "18ce43e99956515842ecaf44c63c95f630c35816"
|
|
6162
6162
|
}
|
|
6163
6163
|
],
|
|
6164
6164
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6173,11 +6173,11 @@
|
|
|
6173
6173
|
"checksums": [
|
|
6174
6174
|
{
|
|
6175
6175
|
"algorithm": "SHA256",
|
|
6176
|
-
"checksumValue": "
|
|
6176
|
+
"checksumValue": "76fbb4ee6e48770aea7276f92edb57fbc7fd5da155d83919ded054a802c35988"
|
|
6177
6177
|
},
|
|
6178
6178
|
{
|
|
6179
6179
|
"algorithm": "SHA1",
|
|
6180
|
-
"checksumValue": "
|
|
6180
|
+
"checksumValue": "678b69a0062b52f94f523cf88b74650ea5329d36"
|
|
6181
6181
|
}
|
|
6182
6182
|
],
|
|
6183
6183
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6211,11 +6211,11 @@
|
|
|
6211
6211
|
"checksums": [
|
|
6212
6212
|
{
|
|
6213
6213
|
"algorithm": "SHA256",
|
|
6214
|
-
"checksumValue": "
|
|
6214
|
+
"checksumValue": "e09bb71a338c32a75d7eb8b625bbe8d393fb4300a4bbf7bb962d8a9a3eea58ff"
|
|
6215
6215
|
},
|
|
6216
6216
|
{
|
|
6217
6217
|
"algorithm": "SHA1",
|
|
6218
|
-
"checksumValue": "
|
|
6218
|
+
"checksumValue": "96e2ecf70aa89d4a7fb2c94e37867e0a125d972f"
|
|
6219
6219
|
}
|
|
6220
6220
|
],
|
|
6221
6221
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6230,11 +6230,11 @@
|
|
|
6230
6230
|
"checksums": [
|
|
6231
6231
|
{
|
|
6232
6232
|
"algorithm": "SHA256",
|
|
6233
|
-
"checksumValue": "
|
|
6233
|
+
"checksumValue": "2321b9a45ba8e5f326056a9193974158a4b0abed795cc3ab9eb56676f868e72e"
|
|
6234
6234
|
},
|
|
6235
6235
|
{
|
|
6236
6236
|
"algorithm": "SHA1",
|
|
6237
|
-
"checksumValue": "
|
|
6237
|
+
"checksumValue": "fe4836e5dd4dc1a12a7eaa213fd72430c75fdf47"
|
|
6238
6238
|
}
|
|
6239
6239
|
],
|
|
6240
6240
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6515,11 +6515,11 @@
|
|
|
6515
6515
|
"checksums": [
|
|
6516
6516
|
{
|
|
6517
6517
|
"algorithm": "SHA256",
|
|
6518
|
-
"checksumValue": "
|
|
6518
|
+
"checksumValue": "c756ce194b1f3e83440e38e73c40f30e44a91d8e6104b917a903947b9c29018a"
|
|
6519
6519
|
},
|
|
6520
6520
|
{
|
|
6521
6521
|
"algorithm": "SHA1",
|
|
6522
|
-
"checksumValue": "
|
|
6522
|
+
"checksumValue": "f1f56202e0b2a9e6f0b36326bc8932a0b513c7ad"
|
|
6523
6523
|
}
|
|
6524
6524
|
],
|
|
6525
6525
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
|
@@ -6610,11 +6610,11 @@
|
|
|
6610
6610
|
"checksums": [
|
|
6611
6611
|
{
|
|
6612
6612
|
"algorithm": "SHA256",
|
|
6613
|
-
"checksumValue": "
|
|
6613
|
+
"checksumValue": "a52c1f4d0e03a2ccf2a3bed32e01f8aee6169ea8f5058d47954e7e8149e358ef"
|
|
6614
6614
|
},
|
|
6615
6615
|
{
|
|
6616
6616
|
"algorithm": "SHA1",
|
|
6617
|
-
"checksumValue": "
|
|
6617
|
+
"checksumValue": "c6bc54d08b5226964f05351922b96b4da5832476"
|
|
6618
6618
|
}
|
|
6619
6619
|
],
|
|
6620
6620
|
"licenseConcluded": "LicenseRef-RobonoSDK",
|
package/dist/CallRecord.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
1
|
+
import React, { type ReactNode, type ComponentType } from 'react';
|
|
2
|
+
import { type TextProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
3
|
import type { CallHistoryEntry } from '@robono/calling';
|
|
3
4
|
/** A call record, aligned with its caller. Separate from the text-bubble component. */
|
|
4
5
|
export interface CallRecordProps {
|
|
@@ -14,7 +15,12 @@ export interface CallRecordProps {
|
|
|
14
15
|
detail: string;
|
|
15
16
|
missed: boolean;
|
|
16
17
|
};
|
|
18
|
+
TextComponent?: ComponentType<TextProps>;
|
|
19
|
+
surfaceStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
decoration?: ReactNode;
|
|
17
21
|
children?: ReactNode;
|
|
22
|
+
attachment?: ReactNode;
|
|
23
|
+
attachmentWidth?: number;
|
|
18
24
|
showTime?: boolean;
|
|
19
25
|
}
|
|
20
|
-
export declare function CallRecord({ entry, incomingColor, outgoingColor, textColor, secondaryColor, onCallBack, label, children, showTime }: CallRecordProps): React.JSX.Element;
|
|
26
|
+
export declare function CallRecord({ entry, incomingColor, outgoingColor, textColor, secondaryColor, onCallBack, label, children, attachment, attachmentWidth, showTime, TextComponent, surfaceStyle, decoration }: CallRecordProps): React.JSX.Element;
|
package/dist/CallRecord.js
CHANGED
|
@@ -2,20 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
4
4
|
import { RobonoIcon } from './visual/RobonoIcon.js';
|
|
5
|
-
export function CallRecord({ entry, incomingColor, outgoingColor, textColor = '#ffffff', secondaryColor, onCallBack, label, children, showTime = false }) {
|
|
5
|
+
export function CallRecord({ entry, incomingColor, outgoingColor, textColor = '#ffffff', secondaryColor, onCallBack, label, children, attachment, attachmentWidth, showTime = false, TextComponent = Text, surfaceStyle, decoration }) {
|
|
6
6
|
const description = label(entry);
|
|
7
7
|
const incoming = entry.role === 'callee';
|
|
8
8
|
const connected = entry.connectedAt != null;
|
|
9
9
|
const meta = [description.detail, showTime ? new Date(entry.createdAt).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }) : ''].filter(Boolean).join(' · ');
|
|
10
10
|
const actions = React.Children.toArray(children);
|
|
11
|
-
const content = _jsxs(_Fragment, { children: [_jsxs(View, { style: s.symbol, accessible: false, children: [_jsx(RobonoIcon, { name:
|
|
12
|
-
return _jsxs(View, { style: [s.record, { backgroundColor: incoming ? incomingColor : outgoingColor, alignSelf: incoming ? 'flex-start' : 'flex-end' }], children: [onCallBack ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${description.label}${meta ? '. ' + meta : ''}`, accessibilityHint: incoming ? 'Call back' : 'Call again', onPress: onCallBack, style: ({ pressed }) => [s.main, pressed && { opacity: .65 }], children: content }) : _jsx(View, { style: s.main, children: content }), actions.length > 0 && _jsx(View, { style: s.actions, children: actions })] });
|
|
11
|
+
const content = _jsxs(_Fragment, { children: [_jsxs(View, { style: s.symbol, accessible: false, children: [_jsx(RobonoIcon, { name: entry.kind === 'video' ? 'video' : 'phone', size: 24, color: description.missed ? '#ff797e' : textColor }), !description.missed && _jsx(View, { style: [s.direction, { backgroundColor: 'transparent' }], children: _jsx(RobonoIcon, { name: incoming ? 'incoming' : 'outgoing', size: 10, color: connected ? '#72ce99' : '#ff797e' }) })] }), _jsxs(View, { style: s.text, children: [_jsx(TextComponent, { testID: "call-title", style: [s.title, { color: textColor }], children: description.label }), !!meta && _jsx(TextComponent, { style: [s.detail, { color: secondaryColor || textColor }], children: meta })] })] });
|
|
12
|
+
return _jsxs(View, { style: [s.record, { backgroundColor: incoming ? incomingColor : outgoingColor, alignSelf: incoming ? 'flex-start' : 'flex-end', ...(attachment ? { flexDirection: 'column', alignItems: 'stretch' } : {}), ...(attachment && attachmentWidth ? { width: attachmentWidth + 2, paddingHorizontal: 0, paddingVertical: 0, overflow: 'hidden' } : {}) }, surfaceStyle], children: [decoration, onCallBack ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${description.label}${meta ? '. ' + meta : ''}`, accessibilityHint: incoming ? 'Call back' : 'Call again', onPress: onCallBack, style: ({ pressed }) => [s.main, attachment && attachmentWidth ? { paddingHorizontal: 6, paddingVertical: 2 } : null, pressed && { opacity: .65 }], children: content }) : _jsx(View, { style: [s.main, attachment && attachmentWidth ? { paddingHorizontal: 6, paddingVertical: 2 } : null], children: content }), attachment, actions.length > 0 && _jsx(View, { style: s.actions, children: actions })] });
|
|
13
13
|
}
|
|
14
14
|
const s = StyleSheet.create({
|
|
15
|
-
record: { maxWidth: '100%', borderRadius: 14, borderWidth: 1, borderColor: '#ffffff16', flexDirection: 'row', alignItems: 'center', paddingHorizontal:
|
|
16
|
-
main: { minHeight:
|
|
17
|
-
symbol: { width:
|
|
18
|
-
direction: { position: 'absolute', right: -
|
|
19
|
-
text: { flexShrink: 1, gap:
|
|
15
|
+
record: { maxWidth: '100%', borderRadius: 14, borderWidth: 1, borderColor: '#ffffff16', flexDirection: 'row', alignItems: 'center', paddingHorizontal: 6, paddingVertical: 2 },
|
|
16
|
+
main: { minHeight: 26, flexDirection: 'row', alignItems: 'center', gap: 4, flexShrink: 1 },
|
|
17
|
+
symbol: { width: 26, height: 26, flexShrink: 0, alignItems: 'center', justifyContent: 'center' },
|
|
18
|
+
direction: { position: 'absolute', right: -3, bottom: -2, borderRadius: 0, padding: 0 },
|
|
19
|
+
text: { flexShrink: 1, gap: 1 }, title: { fontSize: 14, fontWeight: '600' }, detail: { fontSize: 11, fontVariant: ['tabular-nums'] },
|
|
20
20
|
actions: { borderLeftWidth: 1, borderLeftColor: '#ffffff22', marginLeft: 10, paddingLeft: 4, flexDirection: 'row', alignItems: 'center' },
|
|
21
21
|
});
|
package/dist/components.js
CHANGED
|
@@ -115,7 +115,7 @@ export function CallingActionButton({ action, style, iconStyle, labelStyle }) {
|
|
|
115
115
|
const a = actions[action];
|
|
116
116
|
if (!a.visible)
|
|
117
117
|
return null;
|
|
118
|
-
return _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: a.label, accessibilityState: { disabled: a.disabled, selected: a.selected, busy: a.busy }, disabled: a.disabled, onPress: a.onPress, hitSlop: 8, style: [a.icon ? styles.button : [styles.close, { backgroundColor: c.control }], a.disabled && styles.disabled, style], children: [a.icon && _jsx(View, { style: [styles.circle, { borderRadius: design.controlRadius, backgroundColor: a.color || (a.selected ? c.foreground : c.control) }, iconStyle], children: _jsx(ControlIcon, { name: a.icon, muted: action === 'mute' && state.muted || action === 'camera' && state.cameraEnabled === false, color: a.color ? callingInk(a.color) : a.selected ? c.background : c.foreground }) }), _jsx(Text, { style: [styles.label, typography(17), { color: c.foreground }, labelStyle], children: a.label })] });
|
|
118
|
+
return _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: a.label, accessibilityState: { disabled: a.disabled, selected: a.selected, busy: a.busy }, disabled: a.disabled, onPress: a.onPress, hitSlop: 8, style: [a.icon ? styles.button : [styles.close, { backgroundColor: c.control }], a.disabled && styles.disabled, style], children: [a.icon && _jsx(View, { style: [styles.circle, { borderRadius: design.controlRadius, backgroundColor: a.color || (a.selected && action !== 'camera' ? c.foreground : c.control) }, iconStyle], children: _jsx(ControlIcon, { name: a.icon, muted: action === 'mute' && state.muted || action === 'camera' && state.cameraEnabled === false, color: a.color ? callingInk(a.color) : a.selected && action !== 'camera' ? c.background : c.foreground }) }), _jsx(Text, { style: [styles.label, typography(17), { color: c.foreground }, labelStyle], children: a.label })] });
|
|
119
119
|
}
|
|
120
120
|
export function CallingAudioControls({ style } = {}) {
|
|
121
121
|
const { actions, components } = useCallingUI();
|
|
@@ -136,8 +136,8 @@ function CallingConferenceControls({ style }) {
|
|
|
136
136
|
const { actions, components, typography } = useCallingUI();
|
|
137
137
|
const Button = components.ActionButton || CallingActionButton;
|
|
138
138
|
const [width, setWidth] = useState(0);
|
|
139
|
-
const visible = ['mute', 'speaker', '
|
|
140
|
-
return _jsxs(View, { style: [{ paddingVertical: 4, gap: 4 }, style], children: [_jsx(View, { testID: "calling-main-controls", onLayout: e => setWidth(e.nativeEvent.layout.width), style: { flexDirection: 'row', flexWrap: 'wrap', alignItems: '
|
|
139
|
+
const visible = ['mute', 'speaker', 'end', 'flip', 'camera'].filter(action => actions[action].visible);
|
|
140
|
+
return _jsxs(View, { style: [{ paddingVertical: 4, gap: 4 }, style], children: [_jsx(View, { testID: "calling-main-controls", onLayout: e => setWidth(e.nativeEvent.layout.width), style: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8, width: '100%', maxWidth: 560, alignSelf: 'center' }, children: visible.map(action => _jsx(Button, { action: action, style: { flexGrow: 1, flexBasis: 48, minWidth: 44, maxWidth: 88, gap: 4 }, iconStyle: { width: action === 'end' ? 60 : 44, height: action === 'end' ? 60 : 44 }, labelStyle: typography(12) }, action)) }), actions.share.visible && _jsx(View, { style: { alignItems: 'center' }, children: _jsx(Button, { action: "share", iconStyle: { width: 44, height: 44 }, labelStyle: typography(12) }) }), _jsx(CallingBackgroundControl, {}), _jsx(CallingConnectionDetails, {})] });
|
|
141
141
|
}
|
|
142
142
|
export function CallingControls({ style } = {}) {
|
|
143
143
|
const { actions, components, state } = useCallingUI();
|
package/dist/controller.d.mts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* @param {import('./types.js').CallingOptions & {createClient: (options: any) => import('@robono/calling').RobonoCallingClient}} options
|
|
3
3
|
* @returns {import('./types.js').CallingController}
|
|
4
4
|
*/
|
|
5
|
-
export function createController({ createClient, request, media, audio, resolveContact, onError, onUnansweredCall, forceRelay }: import("./types.js").CallingOptions & {
|
|
5
|
+
export function createController({ createClient, request, media, audio, resolveContact, onError, onUnansweredCall, onVoicemail, forceRelay }: import("./types.js").CallingOptions & {
|
|
6
6
|
createClient: (options: any) => import("@robono/calling").RobonoCallingClient;
|
|
7
7
|
}): import("./types.js").CallingController;
|
package/dist/controller.mjs
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* @param {import('./types.js').CallingOptions & {createClient: (options: any) => import('@robono/calling').RobonoCallingClient}} options
|
|
4
4
|
* @returns {import('./types.js').CallingController}
|
|
5
5
|
*/
|
|
6
|
-
export function createController({ createClient, request, media, audio, resolveContact = () => null, onError = () => { }, onUnansweredCall = () => { }, forceRelay = false }) {
|
|
6
|
+
export function createController({ createClient, request, media, audio, resolveContact = () => null, onError = () => { }, onUnansweredCall = () => { }, onVoicemail, forceRelay = false }) {
|
|
7
7
|
const listeners = new Set();
|
|
8
8
|
let disposed = false, foreground = true, action = null, startingContact = null;
|
|
9
9
|
let opening = null, openingTimer, connectedId = null, audioKey = '', epoch = 0;
|
|
10
10
|
let resuming = null;
|
|
11
11
|
const offeredMessages = new Set();
|
|
12
12
|
const outgoingCalls = new Set();
|
|
13
|
+
let startingConnectionId = null, previousCallId = null;
|
|
13
14
|
let snapshot = { call: null, voiceAvailable: false, muted: false, error: null };
|
|
14
15
|
let state = { phase: 'idle', call: null, contact: null, speaker: false, muted: false, error: null, canMute: false, canSpeaker: false, connectedAt: null };
|
|
15
16
|
const publish = patch => { state = { ...state, ...patch }; for (const listener of listeners)
|
|
@@ -65,13 +66,16 @@ export function createController({ createClient, request, media, audio, resolveC
|
|
|
65
66
|
canSpeaker: ['outgoing', 'connecting', 'connected'].includes(phase) });
|
|
66
67
|
sound(phase, endTone, cue);
|
|
67
68
|
audio.countdown?.(active && !terminalError ? { ...call, localHeld: !!next.localHeld || !!call.localHeld } : null);
|
|
68
|
-
if (call?.state === 'ended' && outgoingCalls.has(call.id) && call.
|
|
69
|
+
if (call?.state === 'ended' && (outgoingCalls.has(call.id) || action === 'call' && call.connectionId === startingConnectionId && call.id !== previousCallId && call.controlled) && call.role === 'caller' && ['no_answer', 'voicemail'].includes(call.reason) && call.answeredAt == null && call.connectedAt == null && !offeredMessages.has(call.id)) {
|
|
69
70
|
offeredMessages.add(call.id);
|
|
70
71
|
if (offeredMessages.size > 100)
|
|
71
72
|
offeredMessages.delete(offeredMessages.values().next().value);
|
|
72
73
|
queueMicrotask(() => { if (!disposed) {
|
|
73
74
|
try {
|
|
74
|
-
|
|
75
|
+
if (onVoicemail)
|
|
76
|
+
onVoicemail({ id: call.id, connectionId: call.connectionId, kind: call.kind || 'voice', reason: call.reason });
|
|
77
|
+
else if (call.reason === 'no_answer')
|
|
78
|
+
onUnansweredCall({ id: call.id, connectionId: call.connectionId });
|
|
75
79
|
}
|
|
76
80
|
catch (error) {
|
|
77
81
|
onError(error);
|
|
@@ -117,11 +121,13 @@ export function createController({ createClient, request, media, audio, resolveC
|
|
|
117
121
|
if (state.phase !== 'idle')
|
|
118
122
|
throw Error('busy');
|
|
119
123
|
startingContact = contact || resolveContact(connectionId);
|
|
124
|
+
startingConnectionId = connectionId;
|
|
125
|
+
previousCallId = snapshot.call?.id ?? null;
|
|
120
126
|
return run('call', async () => {
|
|
121
127
|
publish({ phase: 'outgoing', kind, cameraEnabled: true, contact: startingContact, speaker: false, canSpeaker: true, error: null });
|
|
122
128
|
sound('outgoing');
|
|
123
129
|
await client.call(connectionId, { kind });
|
|
124
|
-
});
|
|
130
|
+
}).finally(() => { startingConnectionId = null; previousCallId = null; });
|
|
125
131
|
},
|
|
126
132
|
async answer() {
|
|
127
133
|
if (state.phase !== 'incoming')
|
package/dist/groups.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { RobonoGroupCallingClient } from '@robono/calling/groups';
|
|
3
3
|
import { type CallingScreenProps } from './screens.js';
|
|
4
4
|
import type { CallingOptions, CallingState, Contact } from './types.js';
|
|
5
|
-
export interface GroupCallingOptions extends Omit<CallingOptions, 'resolveContact' | 'onUnansweredCall'> {
|
|
5
|
+
export interface GroupCallingOptions extends Omit<CallingOptions, 'resolveContact' | 'onUnansweredCall' | 'onVoicemail'> {
|
|
6
6
|
resolveGroup?: (connectionId: string) => Contact | null;
|
|
7
7
|
resolveMember?: (appId: string, userId: string) => Contact | null;
|
|
8
8
|
}
|
package/dist/messenger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VoicemailClient } from '@robono/calling/voicemail';
|
|
1
2
|
import { type MessengerCallingTransport } from '@robono/calling/messenger';
|
|
2
3
|
import { type GroupCallingController } from './groups.js';
|
|
3
4
|
import { type CallingAppearance } from './appearance.js';
|
|
@@ -8,6 +9,13 @@ export interface MessengerCallingState {
|
|
|
8
9
|
group: GroupCallingController | null;
|
|
9
10
|
appearance?: CallingAppearance;
|
|
10
11
|
features: MessengerCallingTransport['features'];
|
|
12
|
+
voicemailInbox?: boolean;
|
|
13
|
+
voicemailOffer?: {
|
|
14
|
+
id: string;
|
|
15
|
+
connectionId: string;
|
|
16
|
+
kind: 'voice' | 'video';
|
|
17
|
+
};
|
|
18
|
+
voicemailRevision?: number;
|
|
11
19
|
unanswered?: {
|
|
12
20
|
id: string;
|
|
13
21
|
conversationId: string;
|
|
@@ -22,6 +30,7 @@ export interface MessengerCallAdapters extends Pick<CallingOptions, 'media' | 'a
|
|
|
22
30
|
prime?(): void;
|
|
23
31
|
}
|
|
24
32
|
export interface MessengerCallingOptions {
|
|
33
|
+
voicemailHistoryStorage?: ConstructorParameters<typeof VoicemailClient>[0]['historyStorage'];
|
|
25
34
|
request: (operation: string, input: Record<string, unknown>) => Promise<any>;
|
|
26
35
|
adapters: (appearance: CallingAppearance) => MessengerCallAdapters;
|
|
27
36
|
onAppearance?: (appearance: CallingAppearance) => void;
|
|
@@ -29,9 +38,14 @@ export interface MessengerCallingOptions {
|
|
|
29
38
|
resolveMember?: (appId: string, userId: string) => Contact | null;
|
|
30
39
|
deviceCheck?: (active: () => boolean) => CallDeviceCheck;
|
|
31
40
|
onUnansweredCall?: CallingOptions['onUnansweredCall'];
|
|
41
|
+
onVoicemail?: CallingOptions['onVoicemail'];
|
|
32
42
|
}
|
|
33
43
|
/** Account-scoped calls. Owns renewal, listeners and cleanup across navigation. */
|
|
34
44
|
export declare function createMessengerCalling(options: MessengerCallingOptions): {
|
|
45
|
+
voicemail: VoicemailClient;
|
|
46
|
+
openVoicemailInbox(): void;
|
|
47
|
+
closeVoicemailInbox(): void;
|
|
48
|
+
dismissVoicemail(): void;
|
|
35
49
|
deviceCheck: {
|
|
36
50
|
getSnapshot: () => import("./device-check.js").CallDeviceCheckState;
|
|
37
51
|
subscribe(fn: () => void): () => void;
|
package/dist/messenger.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VoicemailClient } from '@robono/calling/voicemail';
|
|
1
2
|
import { createMessengerCallingTransport } from '@robono/calling/messenger';
|
|
2
3
|
import { createCallingController } from './index.js';
|
|
3
4
|
import { createGroupCallingController } from './groups.js';
|
|
@@ -15,6 +16,8 @@ export function createMessengerCalling(options) {
|
|
|
15
16
|
const dismissed = new Set();
|
|
16
17
|
const listeners = new Set();
|
|
17
18
|
const emit = (patch) => { state = { ...state, ...patch }; listeners.forEach(fn => fn()); };
|
|
19
|
+
const voicemail = new VoicemailClient({ historyStorage: options.voicemailHistoryStorage, request: async (operation, input) => { await start(); if (!transport)
|
|
20
|
+
throw Error('Calling is unavailable.'); return transport.request(operation, input); } });
|
|
18
21
|
const active = () => [state.direct, state.group].some(c => c && !['idle', 'error'].includes(c.getSnapshot().phase));
|
|
19
22
|
const deviceCheck = options.deviceCheck?.(active);
|
|
20
23
|
const recover = (status) => {
|
|
@@ -103,7 +106,22 @@ export function createMessengerCalling(options) {
|
|
|
103
106
|
}
|
|
104
107
|
const make = () => { const adapter = options.adapters(appearance); adapters.push(adapter); return adapter; };
|
|
105
108
|
const directAdapter = make();
|
|
106
|
-
const direct = createCallingController({ ...directAdapter, request: session.request, appearanceRevision: session.revision, resolveContact: options.resolveContact,
|
|
109
|
+
const direct = createCallingController({ ...directAdapter, request: session.request, appearanceRevision: session.revision, resolveContact: options.resolveContact, onVoicemail: call => {
|
|
110
|
+
void voicemail.options(call.id).then(() => { if (!closed) {
|
|
111
|
+
emit({ voicemailOffer: call });
|
|
112
|
+
options.onVoicemail?.(call);
|
|
113
|
+
} }).catch(() => {
|
|
114
|
+
if (closed)
|
|
115
|
+
return;
|
|
116
|
+
// The recipient's mailbox decides eligibility, even when the caller has no inbox.
|
|
117
|
+
if (options.onVoicemail) {
|
|
118
|
+
options.onVoicemail(call);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (call.reason === 'no_answer')
|
|
122
|
+
options.onUnansweredCall?.(call);
|
|
123
|
+
});
|
|
124
|
+
}, onUnansweredCall: call => { emit({ unanswered: { id: call.id, conversationId: call.connectionId } }); options.onUnansweredCall?.(call); } });
|
|
107
125
|
emit({ direct, appearance, features: session.features });
|
|
108
126
|
detach.push(watchCheck(direct));
|
|
109
127
|
const directDetach = directAdapter.attach?.(direct);
|
|
@@ -135,6 +153,11 @@ export function createMessengerCalling(options) {
|
|
|
135
153
|
return pending;
|
|
136
154
|
};
|
|
137
155
|
return {
|
|
156
|
+
voicemail,
|
|
157
|
+
openVoicemailInbox() { if (state.features.voicemail && state.features.voicemailPresentation !== 'custom')
|
|
158
|
+
emit({ voicemailInbox: true }); },
|
|
159
|
+
closeVoicemailInbox() { emit({ voicemailInbox: false }); },
|
|
160
|
+
dismissVoicemail() { emit({ voicemailOffer: undefined, voicemailRevision: (state.voicemailRevision ?? 0) + 1 }); },
|
|
138
161
|
deviceCheck, start, refreshAppearance, getSnapshot: () => state, subscribe(fn) { listeners.add(fn); return () => { listeners.delete(fn); }; },
|
|
139
162
|
isActive: active,
|
|
140
163
|
reportError(message) { if (!closed)
|
package/dist/system-calling.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface SystemCallNotifications {
|
|
|
17
17
|
export declare function createNativeSystemCalling(options: {
|
|
18
18
|
start: () => Promise<void>;
|
|
19
19
|
onError: (error: Error) => void;
|
|
20
|
+
accountScopeFormat?: 'notification' | 'user-id';
|
|
20
21
|
}): {
|
|
21
22
|
notifications: SystemCallNotifications;
|
|
22
23
|
updateAppearance(value: CallingAppearance): void;
|
|
@@ -26,4 +27,15 @@ export declare function createNativeSystemCalling(options: {
|
|
|
26
27
|
cacheContacts(names: Record<string, string>): void;
|
|
27
28
|
dispose(): Promise<void>;
|
|
28
29
|
};
|
|
30
|
+
/** Register the direct calling service's authenticated device with the same
|
|
31
|
+
* native incoming-call coordinator used by the standard Messenger integration. */
|
|
32
|
+
export declare function connectCallingWakeRegistration(options: {
|
|
33
|
+
accountId: string;
|
|
34
|
+
system: ReturnType<typeof createNativeSystemCalling>;
|
|
35
|
+
controller: CallingController;
|
|
36
|
+
request: (operation: string, body?: unknown) => Promise<unknown>;
|
|
37
|
+
onError: (error: unknown) => void;
|
|
38
|
+
}): {
|
|
39
|
+
dispose(): void;
|
|
40
|
+
};
|
|
29
41
|
export {};
|
package/dist/system-calling.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
1
|
+
import { AppState, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
2
|
/** The OS presents an invitation; only a fresh authenticated server response can
|
|
3
3
|
* authorize its media. One coordinator per signed-in Messenger, shared by calls. */
|
|
4
4
|
export function createNativeSystemCalling(options) {
|
|
@@ -134,7 +134,8 @@ export function createNativeSystemCalling(options) {
|
|
|
134
134
|
throw Error('Calling has ended.');
|
|
135
135
|
if (!native)
|
|
136
136
|
throw Error('Rebuild the app to enable incoming calls on the lock screen.');
|
|
137
|
-
|
|
137
|
+
const validScope = options.accountScopeFormat === 'user-id' ? /^[a-f\d]{8}-(?:[a-f\d]{4}-){3}[a-f\d]{12}$/i.test(scope) : /^[a-f\d]{64}$/.test(scope);
|
|
138
|
+
if (!validScope)
|
|
138
139
|
throw Error('Invalid calling account.');
|
|
139
140
|
if (account && account !== scope) {
|
|
140
141
|
appearance = undefined;
|
|
@@ -183,3 +184,45 @@ export function createNativeSystemCalling(options) {
|
|
|
183
184
|
return; closed = true; sub?.remove(); await notifications.disconnect(); controllers.clear(); },
|
|
184
185
|
};
|
|
185
186
|
}
|
|
187
|
+
/** Register the direct calling service's authenticated device with the same
|
|
188
|
+
* native incoming-call coordinator used by the standard Messenger integration. */
|
|
189
|
+
export function connectCallingWakeRegistration(options) {
|
|
190
|
+
let disposed = false, registering = false, renewAt = 0, retryAt = 0, lastToken = '';
|
|
191
|
+
const register = async () => {
|
|
192
|
+
if (disposed || registering || Date.now() < retryAt)
|
|
193
|
+
return;
|
|
194
|
+
registering = true;
|
|
195
|
+
try {
|
|
196
|
+
const registration = await options.system.notifications.registration();
|
|
197
|
+
if (disposed || !registration.systemCalling || !registration.voipToken)
|
|
198
|
+
return;
|
|
199
|
+
if (registration.voipToken === lastToken && Date.now() < renewAt)
|
|
200
|
+
return;
|
|
201
|
+
await options.request('wake/register', { platform: 'ios', delivery: 'voip', token: registration.voipToken, mediaKinds: ['voice', 'video'] });
|
|
202
|
+
if (!disposed) {
|
|
203
|
+
lastToken = registration.voipToken;
|
|
204
|
+
renewAt = Date.now() + 86400000;
|
|
205
|
+
retryAt = 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
retryAt = Date.now() + 30000;
|
|
210
|
+
if (!disposed)
|
|
211
|
+
options.onError(error);
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
registering = false;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const unsubscribe = options.controller.subscribe(() => { void register(); });
|
|
218
|
+
const foreground = AppState.addEventListener('change', value => {
|
|
219
|
+
if (disposed)
|
|
220
|
+
return;
|
|
221
|
+
// Clear the direct service's foreground lease before iOS suspends JS.
|
|
222
|
+
void options.request('state', { presentation: value === 'active' ? 'in-app-v1' : null }).catch(options.onError);
|
|
223
|
+
if (value === 'active')
|
|
224
|
+
void register();
|
|
225
|
+
});
|
|
226
|
+
void options.system.notifications.configure(options.accountId, () => { void register(); }).then(register).catch(options.onError);
|
|
227
|
+
return { dispose() { disposed = true; foreground.remove(); unsubscribe(); } };
|
|
228
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -77,6 +77,13 @@ export interface CallingOptions {
|
|
|
77
77
|
forceRelay?: boolean;
|
|
78
78
|
resolveContact?: (connectionId: string) => Contact | null;
|
|
79
79
|
onError?: (error: Error) => void;
|
|
80
|
+
/** Calling-only voicemail offer. Recheck options before recording; supersedes the legacy chat offer. */
|
|
81
|
+
onVoicemail?: (call: {
|
|
82
|
+
id: string;
|
|
83
|
+
connectionId: string;
|
|
84
|
+
kind: 'voice' | 'video';
|
|
85
|
+
reason: 'no_answer' | 'voicemail';
|
|
86
|
+
}) => void;
|
|
80
87
|
/** Optional navigation to the existing chat to offer a separately recorded message. */
|
|
81
88
|
onUnansweredCall?: (call: {
|
|
82
89
|
id: string;
|
package/dist/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const mobileVersion = "0.
|
|
2
|
-
export declare const engineVersion = "0.
|
|
1
|
+
export declare const mobileVersion = "0.12.0";
|
|
2
|
+
export declare const engineVersion = "0.8.0";
|
package/dist/versions.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Generated from the package manifests by build.mjs.
|
|
2
|
-
export const mobileVersion = "0.
|
|
3
|
-
export const engineVersion = "0.
|
|
2
|
+
export const mobileVersion = "0.12.0";
|
|
3
|
+
export const engineVersion = "0.8.0";
|
|
@@ -8,6 +8,24 @@
|
|
|
8
8
|
#import <UIKit/UIKit.h>
|
|
9
9
|
#import <objc/message.h>
|
|
10
10
|
|
|
11
|
+
// Accept the direct calling service and the standard Messenger notification
|
|
12
|
+
// envelope. Both retain the authenticated recipient and require fresh authority
|
|
13
|
+
// before answering; a push itself never grants microphone/camera access.
|
|
14
|
+
static NSDictionary *RobonoIncomingCallData(NSDictionary *payload) {
|
|
15
|
+
NSDictionary *data=[payload[@"body"] isKindOfClass:NSDictionary.class]?payload[@"body"]:payload;
|
|
16
|
+
if(![data isKindOfClass:NSDictionary.class])return @{};
|
|
17
|
+
NSString *type=data[@"type"];
|
|
18
|
+
if(![type isEqual:@"robono_call"]&&![type isEqual:@"robono_call_cancelled"])return data;
|
|
19
|
+
if(![data[@"expiresAt"] isKindOfClass:NSNumber.class])return @{};
|
|
20
|
+
NSISO8601DateFormatter *formatter=[NSISO8601DateFormatter new];
|
|
21
|
+
formatter.formatOptions=NSISO8601DateFormatWithInternetDateTime|NSISO8601DateFormatWithFractionalSeconds;
|
|
22
|
+
return @{@"event":[type isEqual:@"robono_call"]?@"calling.incoming":@"calling.dismissed",
|
|
23
|
+
@"call_id":data[@"callId"]?:@"",@"connection_id":data[@"connectionId"]?:@"",
|
|
24
|
+
@"accountScope":data[@"recipientUserId"]?:@"",@"kind":data[@"kind"]?:@"voice",
|
|
25
|
+
@"ring_expires_at":[formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[data[@"expiresAt"] doubleValue]/1000]],
|
|
26
|
+
@"reason":data[@"reason"]?:@"ended"};
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
static NSString *const Changed = @"RobonoSystemCallingChanged";
|
|
12
30
|
static NSString *const AccountKey = @"robono.sdk.calls.account.v1";
|
|
13
31
|
static NSString *const NamesKey = @"robono.sdk.calls.names.v1";
|
|
@@ -90,7 +108,7 @@ static void RTCAudio(NSString *selector,AVAudioSession *audio){id s=RTCSession()
|
|
|
90
108
|
}
|
|
91
109
|
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type {self.token=nil;[self event:@"token" data:nil];}
|
|
92
110
|
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
|
|
93
|
-
NSDictionary *data=payload.dictionaryPayload
|
|
111
|
+
NSDictionary *data=RobonoIncomingCallData(payload.dictionaryPayload);
|
|
94
112
|
[self incoming:data mustReport:YES completion:completion];
|
|
95
113
|
}
|
|
96
114
|
- (void)incoming:(NSDictionary *)data mustReport:(BOOL)mustReport completion:(void (^)(void))completion {
|
|
@@ -123,8 +141,7 @@ static void RTCAudio(NSString *selector,AVAudioSession *audio){id s=RTCSession()
|
|
|
123
141
|
if(!self.calls.count&&!self.audioActive)RTCBool(@"setUseManualAudio:",NO);
|
|
124
142
|
}
|
|
125
143
|
+ (void)receiveRemoteNotification:(NSDictionary *)payload {
|
|
126
|
-
NSDictionary *data=
|
|
127
|
-
if(![data isKindOfClass:NSDictionary.class])return;
|
|
144
|
+
NSDictionary *data=RobonoIncomingCallData(payload);
|
|
128
145
|
dispatch_async(dispatch_get_main_queue(),^{RobonoSystemCalling *c=self.shared;NSString *event=data[@"event"];if([data[@"accountScope"] isEqual:c.account]&&([event isEqual:@"calling.dismissed"]||[event isEqual:@"calling.group_dismissed"])){
|
|
129
146
|
NSString *callId=[data[@"call_id"] isKindOfClass:NSString.class]?[data[@"call_id"] lowercaseString]:nil;if(![[NSUUID alloc] initWithUUIDString:callId])return;if(![data[@"reason"] isEqual:@"answered"]||![c.calls[callId][@"authorized"] boolValue])[c end:callId reason:CXCallEndedReasonRemoteEnded];[c event:@"dismissed" data:data];
|
|
130
147
|
}});
|
|
@@ -169,7 +186,7 @@ RCT_EXPORT_MODULE(RobonoSystemCalling);
|
|
|
169
186
|
- (void)stopObserving{[NSNotificationCenter.defaultCenter removeObserver:self];}
|
|
170
187
|
- (void)changed:(NSNotification *)note{[self sendEventWithName:@"RobonoSystemCallingEvent" body:@{}];}
|
|
171
188
|
RCT_EXPORT_METHOD(configure:(NSString *)account resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject){
|
|
172
|
-
if(account&&(![account isKindOfClass:NSString.class]||account.length!=64)){reject(@"invalid_account",@"A verified notification account is required.",nil);return;}
|
|
189
|
+
if(account&&(![account isKindOfClass:NSString.class]||(account.length!=64&&[[NSUUID alloc] initWithUUIDString:account]==nil))){reject(@"invalid_account",@"A verified notification account is required.",nil);return;}
|
|
173
190
|
[RobonoSystemCalling.shared configure:account];resolve([RobonoSystemCalling.shared state]);
|
|
174
191
|
}
|
|
175
192
|
RCT_EXPORT_METHOD(state:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject){resolve([RobonoSystemCalling.shared state]);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robono/calling-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Optional branded calling screens, sounds and native audio adapters for Robono calling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/react": "~19.2.2"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@robono/calling": "^0.
|
|
84
|
+
"@robono/calling": "^0.8.0",
|
|
85
85
|
"react": ">=18.2 <20",
|
|
86
86
|
"react-native": ">=0.76 <1",
|
|
87
87
|
"react-native-svg": ">=15 <16",
|