@robono/messaging-react-native 0.17.0 → 0.18.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.
Files changed (63) hide show
  1. package/BRIDGE-MESSENGER.md +66 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +21 -1
  4. package/SBOM.spdx.json +567 -279
  5. package/dist/account.js +5 -3
  6. package/dist/appearance-context.d.ts +11 -0
  7. package/dist/appearance-context.js +5 -0
  8. package/dist/attachment-menu.js +9 -6
  9. package/dist/brand.js +5 -4
  10. package/dist/calling.js +3 -2
  11. package/dist/chat-options.d.ts +12 -0
  12. package/dist/chat-options.js +25 -0
  13. package/dist/contact-directory.js +3 -3
  14. package/dist/conversation-details.d.ts +2 -0
  15. package/dist/conversation-details.js +7 -5
  16. package/dist/expo-bridge.d.ts +22 -0
  17. package/dist/expo-bridge.js +29 -0
  18. package/dist/expo-history.js +1 -1
  19. package/dist/expo-media.js +2 -2
  20. package/dist/expo-messenger.js +14 -4
  21. package/dist/expo-outbox.js +1 -1
  22. package/dist/expo-screen.js +15 -11
  23. package/dist/expo-storage-digest.d.ts +1 -0
  24. package/dist/expo-storage-digest.js +5 -0
  25. package/dist/expo.d.ts +1 -0
  26. package/dist/expo.js +1 -0
  27. package/dist/extras.d.ts +3 -1
  28. package/dist/extras.js +5 -3
  29. package/dist/forward.js +4 -3
  30. package/dist/group-editor.js +6 -3
  31. package/dist/header-calls.js +4 -3
  32. package/dist/inbox-search.js +4 -3
  33. package/dist/inbox.js +12 -9
  34. package/dist/index.d.ts +16 -2
  35. package/dist/index.js +156 -69
  36. package/dist/media-ui.js +15 -7
  37. package/dist/message-menu.d.ts +2 -1
  38. package/dist/message-menu.js +9 -4
  39. package/dist/native-outbox.d.ts +2 -1
  40. package/dist/native-outbox.js +20 -3
  41. package/dist/polls.js +10 -6
  42. package/dist/popup.d.ts +5 -2
  43. package/dist/popup.js +13 -7
  44. package/dist/public-rooms.js +4 -2
  45. package/dist/quick-send.js +2 -2
  46. package/dist/room-moderation.js +9 -4
  47. package/dist/safety.d.ts +5 -2
  48. package/dist/safety.js +16 -10
  49. package/dist/saved.js +3 -2
  50. package/dist/scheduled.js +11 -6
  51. package/dist/search.js +4 -2
  52. package/dist/sign-in.js +9 -7
  53. package/dist/social.d.ts +5 -0
  54. package/dist/social.js +4 -3
  55. package/dist/storage-digest-cache.d.ts +2 -0
  56. package/dist/storage-digest-cache.js +19 -0
  57. package/dist/translation-settings.js +5 -3
  58. package/dist/typography.d.ts +8 -3
  59. package/dist/typography.js +22 -9
  60. package/dist/use-quote-gesture.js +7 -3
  61. package/examples/existing-bridge-chat.tsx +44 -0
  62. package/package.json +11 -5
  63. package/setup.plugin.cjs +1 -0
@@ -0,0 +1,44 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import {createExpoBridgeMessenger, ExpoMessagingScreen, type ExpoMessagingScreenProps} from '@robono/messaging-react-native/expo';
3
+
4
+ type Props = {
5
+ /** Your authenticated server route, using createBridgeMessengerBackendAdapter. */
6
+ endpoint: string;
7
+ userId: string;
8
+ getAccessToken: () => Promise<string>;
9
+ /** The existing accepted Bridge connection. Do not create a local friend copy. */
10
+ friend: {connectionId: string; name: string; avatarUrl?: string};
11
+ subscribeToBridgeHints: (receive: (payload: unknown) => void) => () => void;
12
+ onDownloadAttachment?: ExpoMessagingScreenProps['onDownloadAttachment'];
13
+ linkHandling?: ExpoMessagingScreenProps['linkHandling'];
14
+ mediaViewer?: ExpoMessagingScreenProps['mediaViewer'];
15
+ components?: ExpoMessagingScreenProps['components'];
16
+ header?: ExpoMessagingScreenProps['header'];
17
+ conversationMode?: 'messenger' | 'walkie-talkie';
18
+ };
19
+
20
+ export function ExistingBridgeChat(props: Props) {
21
+ const {endpoint, userId, getAccessToken, friend, subscribeToBridgeHints} = props;
22
+ const identity = JSON.stringify([endpoint, userId, friend.connectionId]);
23
+ const [active, setActive] = useState<{identity: string; connection: ReturnType<typeof createExpoBridgeMessenger>} | null>(null);
24
+ const bridge = active?.identity === identity ? active.connection : null;
25
+ useEffect(() => {
26
+ const connection = createExpoBridgeMessenger({url: endpoint, userId, connectionId: friend.connectionId, getAccessToken});
27
+ setActive({identity, connection});
28
+ void connection.open().catch(() => {}); // Standard Messenger displays connection errors.
29
+ return () => connection.dispose();
30
+ }, [endpoint, userId, friend.connectionId, getAccessToken]);
31
+ useEffect(() => bridge ? subscribeToBridgeHints(payload => {
32
+ // A hint contains no trusted content. The SDK reads the authorized source.
33
+ void bridge.handlePush(payload).catch(() => {});
34
+ }) : undefined, [bridge, subscribeToBridgeHints]);
35
+ if (!bridge) return null;
36
+ return <ExpoMessagingScreen
37
+ client={bridge.client} storage={bridge.storage} audioSession={bridge.audioSession}
38
+ userId={userId} contact={friend}
39
+ conversationMode={props.conversationMode ?? 'messenger'}
40
+ onDownloadAttachment={props.onDownloadAttachment}
41
+ components={props.components} header={props.header}
42
+ linkHandling={props.linkHandling} mediaViewer={props.mediaViewer}
43
+ />;
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robono/messaging-react-native",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Optional, composable direct and group messaging screens for Robono.",
@@ -48,14 +48,16 @@
48
48
  "CHANGELOG.md",
49
49
  "SBOM.spdx.json",
50
50
  "licenses",
51
- "setup.plugin.cjs"
51
+ "setup.plugin.cjs",
52
+ "BRIDGE-MESSENGER.md",
53
+ "examples"
52
54
  ],
53
55
  "scripts": {
54
56
  "build": "tsc -p tsconfig.json",
55
57
  "prepack": "npm run build && node ../../scripts/generate-sdk-file-sbom.mjs"
56
58
  },
57
59
  "peerDependencies": {
58
- "@robono/messaging": "^0.12.0",
60
+ "@robono/messaging": "^0.13.0",
59
61
  "react": ">=18.2 <20",
60
62
  "react-native": ">=0.76 <1",
61
63
  "expo-audio": ">=55 <57",
@@ -78,9 +80,10 @@
78
80
  "@robono/location-react-native": "^0.4.1",
79
81
  "expo-location": ">=55 <57",
80
82
  "expo-constants": ">=55 <57",
81
- "@robono/location": "^0.4.0",
83
+ "@robono/location": "^0.4.1",
82
84
  "expo-haptics": ">=55 <57",
83
- "@robono/calling": "^0.6.2"
85
+ "@robono/calling": "^0.6.2",
86
+ "expo-media-library": ">=55 <57"
84
87
  },
85
88
  "license": "SEE LICENSE IN LICENSE",
86
89
  "peerDependenciesMeta": {
@@ -131,6 +134,9 @@
131
134
  },
132
135
  "expo-haptics": {
133
136
  "optional": true
137
+ },
138
+ "expo-media-library": {
139
+ "optional": true
134
140
  }
135
141
  },
136
142
  "author": {
package/setup.plugin.cjs CHANGED
@@ -10,6 +10,7 @@ module.exports=createRunOncePlugin(config=>{
10
10
  ['expo-location',{locationWhenInUsePermission:'Allow location access when you choose to share weather or your location.'}],
11
11
  ['expo-audio',{microphonePermission:'Allow microphone access for voice messages and calls.',enableBackgroundRecording:false}],
12
12
  ['expo-image-picker',{cameraPermission:'Allow camera access to take photos and videos for messages.'}],
13
+ ['expo-media-library',{photosPermission:'Allow access to save photos and videos you choose.',savePhotosPermission:'Allow saving photos and videos you choose to your library.',granularPermissions:['photo','video']}],
13
14
  'expo-notifications','@robono/messaging-react-native',
14
15
  ['@robono/calling-react-native',{video:true,screenSharing:true}],
15
16
  ];