@robono/messaging-react-native 0.22.0 → 0.24.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/BRIDGE-MESSENGER.md +72 -10
- package/CHANGELOG.md +26 -0
- package/README.md +83 -4
- package/RobonoMessagingRuntime.podspec +14 -0
- package/SBOM.spdx.json +967 -295
- package/android/build.gradle +7 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/robono/messaging/RobonoBackupCrypto.java +27 -0
- package/android/src/main/java/com/robono/messaging/RobonoMessagingPackage.java +11 -0
- package/app.plugin.cjs +8 -2
- package/dist/account.d.ts +4 -1
- package/dist/account.js +33 -11
- package/dist/attachment-preview.d.ts +11 -10
- package/dist/attachment-preview.js +15 -12
- package/dist/backup.d.ts +24 -0
- package/dist/backup.js +157 -0
- package/dist/brand.js +4 -4
- package/dist/bubble-design.js +5 -3
- package/dist/chat-options.d.ts +5 -1
- package/dist/chat-options.js +2 -2
- package/dist/contact-directory.d.ts +5 -1
- package/dist/contact-directory.js +11 -3
- package/dist/conversation-details.js +1 -1
- package/dist/delivery-bar.d.ts +2 -1
- package/dist/delivery-bar.js +2 -2
- package/dist/directory-navigation.d.ts +25 -0
- package/dist/directory-navigation.js +69 -0
- package/dist/expo-backup-crypto.d.ts +3 -0
- package/dist/expo-backup-crypto.js +17 -0
- package/dist/expo-backup-passkeys.d.ts +7 -0
- package/dist/expo-backup-passkeys.js +22 -0
- package/dist/expo-backup-settings.d.ts +4 -0
- package/dist/expo-backup-settings.js +41 -0
- package/dist/expo-bridge.d.ts +6 -0
- package/dist/expo-bridge.js +13 -2
- package/dist/expo-inbox-preferences.d.ts +3 -0
- package/dist/expo-inbox-preferences.js +9 -0
- package/dist/expo-media.js +3 -3
- package/dist/expo-messenger.js +10 -5
- package/dist/expo-notification-cleanup.js +3 -3
- package/dist/expo-notifications.js +7 -3
- package/dist/expo-reviews.d.ts +3 -0
- package/dist/expo-reviews.js +40 -0
- package/dist/expo-screen.d.ts +3 -0
- package/dist/expo-screen.js +87 -45
- package/dist/expo-thumbnails.d.ts +4 -0
- package/dist/expo-thumbnails.js +25 -3
- package/dist/expo.d.ts +4 -0
- package/dist/expo.js +4 -0
- package/dist/forward.js +2 -2
- package/dist/header-colors.d.ts +5 -0
- package/dist/header-colors.js +7 -0
- package/dist/inbox.d.ts +5 -2
- package/dist/inbox.js +25 -53
- package/dist/index.d.ts +8 -5
- package/dist/index.js +78 -36
- package/dist/loading-messages.d.ts +5 -0
- package/dist/loading-messages.js +10 -0
- package/dist/media-access.d.ts +8 -0
- package/dist/media-access.js +6 -1
- package/dist/media-readiness.d.ts +2 -0
- package/dist/media-readiness.js +1 -0
- package/dist/playback-reporting.d.ts +8 -0
- package/dist/playback-reporting.js +32 -0
- package/dist/popup.d.ts +6 -3
- package/dist/popup.js +6 -6
- package/dist/reviews.d.ts +15 -0
- package/dist/reviews.js +204 -0
- package/dist/scheduled.js +5 -5
- package/ios/RobonoBackupCrypto.m +30 -0
- package/package.json +21 -8
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { createMessagingPlaybackTracker } from '@robono/messaging';
|
|
3
|
+
/** Connect the shared players to the owning screen, never draft/translation players. */
|
|
4
|
+
export function usePlaybackReporting(options) {
|
|
5
|
+
const current = useRef(options);
|
|
6
|
+
current.current = options;
|
|
7
|
+
const reporting = useMemo(() => {
|
|
8
|
+
const trackers = new Map();
|
|
9
|
+
return { sample(uri, sample) {
|
|
10
|
+
if (!sample) {
|
|
11
|
+
trackers.get(uri)?.close();
|
|
12
|
+
trackers.delete(uri);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!current.current.emit)
|
|
16
|
+
return;
|
|
17
|
+
let tracker = trackers.get(uri);
|
|
18
|
+
if (!tracker) {
|
|
19
|
+
const message = current.current.resolve(uri);
|
|
20
|
+
if (!message || !['voice', 'video'].includes(message.kind))
|
|
21
|
+
return;
|
|
22
|
+
const actorId = current.current.actorId;
|
|
23
|
+
tracker = createMessagingPlaybackTracker({ sessionId: current.current.createId(), messageId: message.id, conversationId: message.conversationId, actorId, kind: message.kind, emit: event => { if (current.current.actorId === actorId)
|
|
24
|
+
current.current.emit?.(event); } });
|
|
25
|
+
trackers.set(uri, tracker);
|
|
26
|
+
}
|
|
27
|
+
tracker.sample(sample);
|
|
28
|
+
}, close() { trackers.forEach(t => t.close()); trackers.clear(); } };
|
|
29
|
+
}, [options.actorId]);
|
|
30
|
+
useEffect(() => () => reporting.close(), [reporting]);
|
|
31
|
+
return reporting.sample;
|
|
32
|
+
}
|
package/dist/popup.d.ts
CHANGED
|
@@ -19,8 +19,10 @@ export declare const messagingPopupColors: {
|
|
|
19
19
|
incoming: string;
|
|
20
20
|
};
|
|
21
21
|
/** One title/close row for forms, menus and expanded content. */
|
|
22
|
-
export declare function MessagingPopupHeader({ title, foreground, onClose, closeLabel, disabled, back }: {
|
|
22
|
+
export declare function MessagingPopupHeader({ title, description, secondary, foreground, onClose, closeLabel, disabled, back }: {
|
|
23
23
|
title: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
secondary?: string;
|
|
24
26
|
foreground: string;
|
|
25
27
|
onClose: () => void;
|
|
26
28
|
closeLabel?: string;
|
|
@@ -56,8 +58,8 @@ export declare function MessagingMenuSurface({ visible, onClose, onDismiss, chil
|
|
|
56
58
|
onDismiss?: () => void;
|
|
57
59
|
children: (rect: MenuRect) => React.ReactNode;
|
|
58
60
|
}): React.JSX.Element;
|
|
59
|
-
/** Content panels
|
|
60
|
-
export declare function MessagingPopup({ screen, children, onClose, background, form, visible, onDismiss, expanded, bottomPadding, title, foreground, closeLabel, closeDisabled, contentWidth, headerBack, withinChat, compact, mediaSurface }: {
|
|
61
|
+
/** Content panels start directly below the Messenger header; confirmations stay compact. */
|
|
62
|
+
export declare function MessagingPopup({ screen, children, onClose, background, form, visible, onDismiss, expanded, bottomPadding, title, description, foreground, closeLabel, closeDisabled, contentWidth, headerBack, withinChat, compact, mediaSurface }: {
|
|
61
63
|
screen?: MessagingStyleScreen;
|
|
62
64
|
mediaSurface?: boolean;
|
|
63
65
|
compact?: boolean;
|
|
@@ -71,6 +73,7 @@ export declare function MessagingPopup({ screen, children, onClose, background,
|
|
|
71
73
|
expanded?: boolean;
|
|
72
74
|
bottomPadding?: number;
|
|
73
75
|
title?: string;
|
|
76
|
+
description?: string;
|
|
74
77
|
foreground?: string;
|
|
75
78
|
closeLabel?: string;
|
|
76
79
|
closeDisabled?: boolean;
|
package/dist/popup.js
CHANGED
|
@@ -12,9 +12,9 @@ export const messagingPopupBackdrop = '#000000d9';
|
|
|
12
12
|
export { useMessagingPopupColors } from './appearance-context.js';
|
|
13
13
|
export const messagingPopupColors = { background: '#000000', foreground: '#ffffff', secondary: '#aaaaaa', incoming: '#202020' };
|
|
14
14
|
/** One title/close row for forms, menus and expanded content. */
|
|
15
|
-
export function MessagingPopupHeader({ title, foreground, onClose, closeLabel, disabled = false, back = false }) {
|
|
15
|
+
export function MessagingPopupHeader({ title, description, secondary, foreground, onClose, closeLabel, disabled = false, back = false }) {
|
|
16
16
|
const { text: uiText } = useRobonoLocale();
|
|
17
|
-
return _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 44
|
|
17
|
+
return _jsxs(View, { testID: "messaging-popup-header", style: { flexShrink: 0, borderBottomWidth: 1, borderBottomColor: foreground + '18' }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 44 }, children: [_jsx(Text, { accessibilityRole: "header", style: { flex: 1, color: foreground, fontSize: 17, lineHeight: 23, fontWeight: '600' }, children: title }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: closeLabel ?? uiText('Close {name}', { name: title }), disabled: disabled, accessibilityState: { disabled }, onPress: onClose, style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center', opacity: disabled ? 0.45 : 1 }, children: _jsx(MessageIcon, { name: back ? 'back' : 'close', color: foreground, size: 24 }) })] }), description && _jsx(Text, { testID: "messaging-popup-description", style: { color: secondary ?? foreground, fontSize: 13, lineHeight: 18, paddingBottom: 8 }, children: description })] });
|
|
18
18
|
}
|
|
19
19
|
// Measure the host and its persistent header, including embedded native layouts.
|
|
20
20
|
const PopupBounds = createContext(null);
|
|
@@ -98,8 +98,8 @@ export function MessagingMenuSurface({ visible, onClose, onDismiss, children })
|
|
|
98
98
|
return _jsx(Modal, { visible: visible, transparent: true, animationType: "none", onRequestClose: onClose, onDismiss: onDismiss, children: visible ? children({ left: 0, top: 0, width: viewport.width, height: viewport.height }) : null });
|
|
99
99
|
return _jsx(MessagingPopupLayer, { children: visible && rect ? _jsx(View, { ref: panel, testID: "messaging-menu-surface", style: { position: 'absolute', inset: 0, zIndex: 1000, overflow: 'hidden' }, children: children(rect) }) : null });
|
|
100
100
|
}
|
|
101
|
-
/** Content panels
|
|
102
|
-
export function MessagingPopup({ screen = 'panels', children, onClose, background, form = false, visible = true, onDismiss, expanded = true, bottomPadding, title, foreground, closeLabel, closeDisabled = false, contentWidth, headerBack = false, withinChat = false, compact = false, mediaSurface = false }) {
|
|
101
|
+
/** Content panels start directly below the Messenger header; confirmations stay compact. */
|
|
102
|
+
export function MessagingPopup({ screen = 'panels', children, onClose, background, form = false, visible = true, onDismiss, expanded = true, bottomPadding, title, description, foreground, closeLabel, closeDisabled = false, contentWidth, headerBack = false, withinChat = false, compact = false, mediaSurface = false }) {
|
|
103
103
|
const appearance = useMessagingAppearance(), panelStyle = appearance?.panels, themeColors = useMessagingPopupColors(undefined, screen);
|
|
104
104
|
const colors = mediaSurface ? messagingPopupColors : themeColors;
|
|
105
105
|
const panelRadius = panelStyle?.corners === 'square' ? 0 : panelStyle?.corners === 'soft' ? 8 : undefined, panelPadding = panelStyle?.spacing === 'compact' ? 8 : panelStyle?.spacing === 'relaxed' ? 20 : undefined;
|
|
@@ -111,7 +111,7 @@ export function MessagingPopup({ screen = 'panels', children, onClose, backgroun
|
|
|
111
111
|
let active = true;
|
|
112
112
|
// Fabric's Android measureInWindow subtracts the activity's system inset,
|
|
113
113
|
// while the edge-to-edge modal starts at the screen origin. Page coordinates
|
|
114
|
-
// retain that inset and keep the popup
|
|
114
|
+
// retain that inset and keep the popup inside the safe Messenger area.
|
|
115
115
|
const measure = (view, done) => {
|
|
116
116
|
if (Platform.OS === 'android')
|
|
117
117
|
view.measure((_x, _y, width, height, x, y) => done(x, y, width, height));
|
|
@@ -145,7 +145,7 @@ export function MessagingPopup({ screen = 'panels', children, onClose, backgroun
|
|
|
145
145
|
} }; document.addEventListener('keydown', escape, true); return () => document.removeEventListener('keydown', escape, true); }, [visible]);
|
|
146
146
|
const bounded = Platform.OS !== 'web' && !!bounds;
|
|
147
147
|
const Frame = Platform.OS === 'ios' && !bounded ? SafeAreaView : View;
|
|
148
|
-
const content = _jsx(Frame, { style: [{ flex: 1, backgroundColor: messagingPopupBackdrop }, bounded ? { position: 'absolute', ...(rect ?? { left: 0, top: 0, width: 0, height: 0 }) } : Platform.OS === 'android' ? { paddingTop: safeInsets?.top ?? StatusBar.currentHeight ?? 0, paddingBottom: safeInsets?.bottom ?? 0 } : undefined], children: _jsxs(KeyboardAvoidingView, { testID: "messaging-popup-backdrop", behavior: Platform.OS === 'ios' ? 'padding' : undefined, style: { flex: 1, justifyContent: 'center', alignItems: 'center',
|
|
148
|
+
const content = _jsx(Frame, { style: [{ flex: 1, backgroundColor: messagingPopupBackdrop }, bounded ? { position: 'absolute', ...(rect ?? { left: 0, top: 0, width: 0, height: 0 }) } : Platform.OS === 'android' ? { paddingTop: safeInsets?.top ?? StatusBar.currentHeight ?? 0, paddingBottom: safeInsets?.bottom ?? 0 } : undefined], children: _jsxs(KeyboardAvoidingView, { testID: "messaging-popup-backdrop", behavior: Platform.OS === 'ios' ? 'padding' : undefined, style: { flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: compact ? 24 : 8, paddingTop: compact ? 24 : 0, paddingBottom: compact ? 24 : 8 }, children: [_jsx(Pressable, { accessible: false, onPress: onClose, style: { position: 'absolute', inset: 0 } }), _jsxs(View, { testID: "messaging-popup-panel", accessibilityViewIsModal: true, onAccessibilityEscape: onClose, style: { width: '100%', ...(compact ? { maxWidth: 360, maxHeight: '100%', flexShrink: 1 } : { flex: 1, minHeight: 0 }), backgroundColor: compact && !panelStyle?.background && !appearance?.defaultStyle?.colors?.background && !(screen !== 'main' && appearance?.screenStyles?.[screen]?.colors?.background) ? '#111111' : colors.background, borderRadius: panelRadius ?? (compact ? 20 : 18), paddingHorizontal: panelPadding ?? (compact ? 20 : 8), paddingTop: compact ? 8 : 0, paddingBottom: bottomPadding ?? (compact ? 20 : 4), overflow: 'hidden' }, children: [title && _jsx(MessagingPopupHeader, { title: title, description: description, secondary: colors.secondary, foreground: colors.foreground, onClose: onClose, closeLabel: closeLabel, disabled: closeDisabled, back: headerBack }), contentWidth ? _jsx(View, { style: { ...(compact ? { flexShrink: 1 } : { flex: 1, minHeight: 0 }), width: '100%', maxWidth: contentWidth, alignSelf: 'center', paddingTop: 8 }, children: children }) : children] })] }) });
|
|
149
149
|
const styledContent = appearance ? _jsx(MessagingTypography, { appearance: appearance, screen: screen, children: content }) : content;
|
|
150
150
|
if (Platform.OS === 'web' && ChatSurface)
|
|
151
151
|
return _jsx(ChatSurface, { visible: visible, title: title, onDismiss: onDismiss, onClose: onClose, children: styledContent });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MessageReviewClient } from "@robono/messaging";
|
|
3
|
+
export interface MessagingReviewInboxProps {
|
|
4
|
+
client: MessageReviewClient;
|
|
5
|
+
name?: (id: string) => string;
|
|
6
|
+
conversationName: (conversationId: string, childId: string) => string;
|
|
7
|
+
renderMedia?: (input: {
|
|
8
|
+
url: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Shared parent inbox. Completed decisions have no approve/reject controls.
|
|
14
|
+
* Media URLs live only while the selected review remains open. */
|
|
15
|
+
export declare function MessagingReviewInbox({ client, name, conversationName, renderMedia }: MessagingReviewInboxProps): React.JSX.Element;
|
package/dist/reviews.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { AppState, Image, Pressable, ScrollView, Text, View, } from "react-native";
|
|
4
|
+
const reviewStateLabel = (state) => ({
|
|
5
|
+
pending: "Waiting for review",
|
|
6
|
+
approved: "Approved — waiting for delivery",
|
|
7
|
+
delivered: "Delivered",
|
|
8
|
+
rejected: "Not approved",
|
|
9
|
+
expired: "Expired",
|
|
10
|
+
cancelled: "Cancelled",
|
|
11
|
+
})[state];
|
|
12
|
+
/** Shared parent inbox. Completed decisions have no approve/reject controls.
|
|
13
|
+
* Media URLs live only while the selected review remains open. */
|
|
14
|
+
export function MessagingReviewInbox({ client, name = (id) => id, conversationName, renderMedia }) {
|
|
15
|
+
const [items, setItems] = useState([]), [selected, setSelected] = useState(null), [completed, setCompleted] = useState(false), [media, setMedia] = useState(null), [error, setError] = useState(""), [busy, setBusy] = useState(false), [nextCursor, setNextCursor] = useState(null);
|
|
16
|
+
const generation = useRef(0);
|
|
17
|
+
const load = async (history = completed, append = false) => {
|
|
18
|
+
const g = ++generation.current;
|
|
19
|
+
setBusy(true);
|
|
20
|
+
setError("");
|
|
21
|
+
setMedia(null);
|
|
22
|
+
setSelected(null);
|
|
23
|
+
try {
|
|
24
|
+
const page = await client.list(history, append ? nextCursor ?? undefined : undefined);
|
|
25
|
+
if (g === generation.current) {
|
|
26
|
+
setItems((old) => append ? [...old, ...page.items] : page.items);
|
|
27
|
+
setNextCursor(page.nextCursor ??
|
|
28
|
+
(page.items.length === 50 ? page.items.at(-1).id : null));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
if (g === generation.current) {
|
|
33
|
+
setError("Reviews could not be loaded. Refresh and try again.");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
if (g === generation.current)
|
|
38
|
+
setBusy(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
void load();
|
|
43
|
+
return () => {
|
|
44
|
+
generation.current++;
|
|
45
|
+
};
|
|
46
|
+
}, [client]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!selected)
|
|
49
|
+
return;
|
|
50
|
+
const id = selected.id, g = generation.current;
|
|
51
|
+
const refresh = setInterval(() => {
|
|
52
|
+
void client.get(id).then((latest) => {
|
|
53
|
+
if (g !== generation.current)
|
|
54
|
+
return;
|
|
55
|
+
if (latest.revision !== selected.revision ||
|
|
56
|
+
latest.state !== selected.state) {
|
|
57
|
+
setSelected(latest);
|
|
58
|
+
setMedia(null);
|
|
59
|
+
}
|
|
60
|
+
}).catch(() => {
|
|
61
|
+
if (g === generation.current) {
|
|
62
|
+
setSelected(null);
|
|
63
|
+
setMedia(null);
|
|
64
|
+
setError("This review is no longer available to you.");
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}, 15000);
|
|
68
|
+
const background = AppState.addEventListener("change", (state) => {
|
|
69
|
+
if (state !== "active")
|
|
70
|
+
setMedia(null);
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
clearInterval(refresh);
|
|
74
|
+
background.remove();
|
|
75
|
+
};
|
|
76
|
+
}, [client, selected]);
|
|
77
|
+
const open = async (item) => {
|
|
78
|
+
const g = ++generation.current;
|
|
79
|
+
setSelected(null);
|
|
80
|
+
setMedia(null);
|
|
81
|
+
setBusy(true);
|
|
82
|
+
setError("");
|
|
83
|
+
try {
|
|
84
|
+
const latest = await client.get(item.id);
|
|
85
|
+
if (g !== generation.current)
|
|
86
|
+
return;
|
|
87
|
+
setSelected(latest);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
if (g === generation.current) {
|
|
91
|
+
setError("This review is no longer available to you.");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
if (g === generation.current)
|
|
96
|
+
setBusy(false);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const preview = async () => {
|
|
100
|
+
if (!selected)
|
|
101
|
+
return;
|
|
102
|
+
const g = generation.current;
|
|
103
|
+
setBusy(true);
|
|
104
|
+
setError("");
|
|
105
|
+
try {
|
|
106
|
+
const result = await client.media(selected.id);
|
|
107
|
+
if (g !== generation.current)
|
|
108
|
+
return;
|
|
109
|
+
if (result.revision !== selected.revision ||
|
|
110
|
+
result.digest !== selected.digest)
|
|
111
|
+
throw Error("Changed");
|
|
112
|
+
setMedia(result);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
if (g === generation.current) {
|
|
116
|
+
setError("This attachment could not be opened. Refresh the review before deciding.");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
if (g === generation.current)
|
|
121
|
+
setBusy(false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const decide = async (decision) => {
|
|
125
|
+
if (!selected)
|
|
126
|
+
return;
|
|
127
|
+
setBusy(true);
|
|
128
|
+
setError("");
|
|
129
|
+
const g = generation.current;
|
|
130
|
+
try {
|
|
131
|
+
let result = decision === "release"
|
|
132
|
+
? selected
|
|
133
|
+
: await client.decide(selected, decision);
|
|
134
|
+
if (g !== generation.current)
|
|
135
|
+
return;
|
|
136
|
+
setSelected(result);
|
|
137
|
+
setMedia(null);
|
|
138
|
+
if (decision !== "reject") {
|
|
139
|
+
result = await client.release(result.id);
|
|
140
|
+
if (g !== generation.current)
|
|
141
|
+
return;
|
|
142
|
+
setSelected(result);
|
|
143
|
+
}
|
|
144
|
+
setItems((old) => old.map((x) => x.id === result.id ? result : x));
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
if (g === generation.current) {
|
|
148
|
+
setError(decision === "reject"
|
|
149
|
+
? "The decision could not be confirmed. Refresh before trying again."
|
|
150
|
+
: "The message was not confirmed delivered. Refresh to see its current state before trying again.");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
if (g === generation.current)
|
|
155
|
+
setBusy(false);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const button = (label, onPress) => (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, disabled: busy, onPress: onPress, style: {
|
|
159
|
+
padding: 12,
|
|
160
|
+
minHeight: 44,
|
|
161
|
+
borderWidth: 1,
|
|
162
|
+
borderColor: "#65746b",
|
|
163
|
+
borderRadius: 8,
|
|
164
|
+
margin: 4,
|
|
165
|
+
opacity: busy ? .5 : 1,
|
|
166
|
+
}, children: _jsx(Text, { style: { color: "#17251c" }, children: label }) }));
|
|
167
|
+
return (_jsxs(ScrollView, { testID: "message-review-inbox", style: { backgroundColor: "#ffffff" }, contentContainerStyle: { padding: 16, gap: 12 }, children: [_jsx(Text, { accessibilityRole: "header", style: { fontSize: 22, fontWeight: "700", color: "#17251c" }, children: "Message reviews" }), _jsx(Text, { style: { color: "#44534a" }, children: "Messages stay private until an authorized reviewer approves delivery." }), _jsxs(View, { style: { flexDirection: "row", flexWrap: "wrap" }, children: [button("Pending", () => {
|
|
168
|
+
setCompleted(false);
|
|
169
|
+
void load(false);
|
|
170
|
+
}), button("Completed", () => {
|
|
171
|
+
setCompleted(true);
|
|
172
|
+
void load(true);
|
|
173
|
+
}), button("Refresh", () => void load())] }), !!error && (_jsx(Text, { accessibilityRole: "alert", style: { color: "#a52222" }, children: error })), selected
|
|
174
|
+
? (_jsxs(View, { testID: "selected-message-review", style: { gap: 12 }, children: [button("Back to reviews", () => {
|
|
175
|
+
generation.current++;
|
|
176
|
+
setSelected(null);
|
|
177
|
+
setMedia(null);
|
|
178
|
+
setError("");
|
|
179
|
+
}), _jsxs(Text, { style: { color: "#17251c", fontWeight: "700" }, children: ["Message from ", name(selected.childId)] }), _jsxs(Text, { style: { color: "#44534a" }, children: ["To ", conversationName(selected.conversationId, selected.childId)] }), _jsx(Text, { selectable: true, style: { color: "#17251c" }, children: selected.content.text }), selected.content.media && (_jsxs(_Fragment, { children: [_jsx(Text, { style: { color: "#44534a" }, children: selected.content.media.fileName }), ["pending", "approved"].includes(selected.state) &&
|
|
180
|
+
button("Open attachment", () => void preview())] })), media && (media.kind === "image"
|
|
181
|
+
? (_jsx(Image, { accessibilityLabel: "Held photo", source: { uri: media.url }, style: { height: 240, width: "100%", resizeMode: "contain" } }))
|
|
182
|
+
: renderMedia?.({
|
|
183
|
+
...media,
|
|
184
|
+
label: selected.content.media?.fileName ?? "Held attachment",
|
|
185
|
+
}) ?? (_jsx(Text, { children: "Open this review in a supported media viewer before approving." }))), _jsx(Text, { testID: "review-state", style: { color: "#44534a" }, children: selected.state === "pending"
|
|
186
|
+
? "Waiting for your decision"
|
|
187
|
+
: selected.state === "approved"
|
|
188
|
+
? "Approved — waiting for delivery"
|
|
189
|
+
: selected.state === "delivered"
|
|
190
|
+
? "Delivered"
|
|
191
|
+
: selected.state === "rejected"
|
|
192
|
+
? "Not approved"
|
|
193
|
+
: "Expired" }), selected.state === "pending" && (_jsxs(View, { style: { flexDirection: "row", flexWrap: "wrap" }, children: [button("Approve and deliver", () => void decide("approve")), button("Reject", () => void decide("reject"))] })), selected.state === "approved" &&
|
|
194
|
+
button("Retry delivery", () => void decide("release"))] }))
|
|
195
|
+
: (_jsxs(_Fragment, { children: [items.map((item) => (_jsxs(Pressable, { testID: "review-item-" + item.id, accessibilityRole: "button", accessibilityLabel: "Review message from " + name(item.childId), disabled: busy, onPress: () => void open(item), style: {
|
|
196
|
+
padding: 16,
|
|
197
|
+
borderWidth: 1,
|
|
198
|
+
borderColor: "#b9c4bd",
|
|
199
|
+
borderRadius: 8,
|
|
200
|
+
gap: 5,
|
|
201
|
+
}, children: [_jsxs(Text, { style: { color: "#17251c", fontWeight: "600" }, children: [name(item.childId), " \u2192", " ", conversationName(item.conversationId, item.childId)] }), _jsx(Text, { numberOfLines: 2, style: { color: "#44534a" }, children: item.content.text ?? item.content.media?.fileName ??
|
|
202
|
+
"Message" }), _jsx(Text, { style: { color: "#44534a" }, children: reviewStateLabel(item.state) })] }, item.id))), !busy && !items.length && (_jsxs(Text, { style: { color: "#44534a" }, children: ["No ", completed ? "completed" : "pending", " reviews."] })), nextCursor &&
|
|
203
|
+
button("Load more", () => void load(completed, true))] }))] }));
|
|
204
|
+
}
|
package/dist/scheduled.js
CHANGED
|
@@ -38,10 +38,10 @@ export function ScheduleTimePicker({ initial, retryAt, onSave, onClose, accent,
|
|
|
38
38
|
onSave(value.toISOString());
|
|
39
39
|
};
|
|
40
40
|
if (retryAt)
|
|
41
|
-
return _jsx(MessagingPopup, { screen: "schedule", title: uiText("Confirm scheduled message"), onClose: () => { if (!busy)
|
|
42
|
-
onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: _jsxs(View, { style: { padding: 12, gap: 16 }, children: [_jsx(Text, { style: { color: colors.
|
|
43
|
-
return _jsxs(MessagingPopup, { screen: "schedule", title: title, onClose: () => { if (!busy)
|
|
44
|
-
onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: [_jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 12, gap: 12 }, children: [
|
|
41
|
+
return _jsx(MessagingPopup, { screen: "schedule", title: uiText("Confirm scheduled message"), description: uiText("The last attempt could not be confirmed. Retry to check it without creating another message."), onClose: () => { if (!busy)
|
|
42
|
+
onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: _jsxs(View, { style: { padding: 12, gap: 16 }, children: [_jsx(Text, { style: { color: colors.secondary, fontSize: 16 }, children: new Date(retryAt).toLocaleString(uiLocale) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduling"), disabled: busy, onPress: () => onSave(retryAt), style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: messagingContrastInk(accent), fontWeight: '600' }, children: busy ? uiText("Checking…") : uiText("Retry scheduling") }) })] }) });
|
|
43
|
+
return _jsxs(MessagingPopup, { screen: "schedule", title: title, description: uiText("Choose when this message should be sent."), onClose: () => { if (!busy)
|
|
44
|
+
onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: [_jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 12, gap: 12 }, children: [_jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }, children: [_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Previous month"), disabled: busy || first <= today, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() - 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u2039" }) }), _jsx(Text, { style: { color: colors.foreground, fontSize: 18, fontWeight: '600' }, children: month.toLocaleDateString(uiLocale, { month: 'long', year: 'numeric' }) }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Next month"), disabled: busy || new Date(month.getFullYear(), month.getMonth() + 1, 1) > end, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() + 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u203A" }) })] }), _jsxs(View, { style: { flexDirection: 'row', flexWrap: 'wrap' }, children: [Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(uiLocale, { weekday: 'narrow' }).format(new Date(2026, 0, 4 + i))).map((day, i) => _jsx(Text, { style: { width: '14.285%', textAlign: 'center', color: colors.secondary, paddingBottom: 8 }, children: day }, 'week' + i)), Array.from({ length: first.getDay() }, (_, i) => _jsx(View, { style: { width: '14.285%' } }, 'blank' + i)), Array.from({ length: days }, (_, i) => { const d = new Date(month.getFullYear(), month.getMonth(), i + 1), selected = d.toDateString() === date.toDateString(), disabled = busy || d < today || d > end; return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: d.toLocaleDateString(uiLocale, { weekday: 'long', month: 'long', day: 'numeric' }), accessibilityState: { selected, disabled }, disabled: disabled, onPress: () => choose(d), style: { width: '14.285%', height: 44, alignItems: 'center', justifyContent: 'center', borderRadius: 22, backgroundColor: selected ? accent + '30' : 'transparent', opacity: disabled ? .3 : 1 }, children: _jsx(Text, { style: { fontSize: 17, color: selected ? accent : colors.foreground, fontWeight: selected ? '700' : '400' }, children: i + 1 }) }, i); })] }), _jsxs(View, { style: { flexDirection: 'row', gap: 12, alignItems: 'center' }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 16 }, children: twelveHour ? uiText("Time") : uiText("Time (24-hour)") }), [[hour, setHour, 'Hour'], [minute, setMinute, 'Minute']].map(([value, set, label]) => _jsx(TextInput, { accessibilityLabel: uiText(label), value: value, onChangeText: (text) => { set(text.replace(/\D/g, '').slice(0, 2)); setError(''); }, editable: !busy, keyboardType: "number-pad", maxLength: 2, selectTextOnFocus: true, style: { backgroundColor: colors.incoming, borderWidth: 1, borderColor: colors.secondary, borderRadius: 10, width: 56, padding: 10, color: colors.foreground, fontSize: 20, textAlign: 'center' } }, label)), twelveHour && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: period + ', switch to ' + (period === 'AM' ? 'PM' : 'AM'), onPress: () => setPeriod(period === 'AM' ? 'PM' : 'AM'), disabled: busy, style: { minHeight: 44, justifyContent: 'center', padding: 4 }, children: _jsx(Text, { style: { color: accent, fontSize: 17, fontWeight: '600' }, children: period }) })] }), _jsx(Text, { style: { color: colors.secondary, fontSize: 14 }, children: uiText('{zone}. The app can be closed when it is time to send.', { zone }) }), !!(error || localError) && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error || localError })] }), _jsx(View, { style: { paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, gap: 8 }, children: _jsx(Pressable, { accessibilityRole: "button", disabled: busy, onPress: submit, style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: messagingContrastInk(accent), fontWeight: '600' }, children: busy ? uiText("Saving…") : uiText("Schedule message") }) }) })] });
|
|
45
45
|
}
|
|
46
46
|
export function ScheduledMessages({ client, accent, onClose }) {
|
|
47
47
|
const colors = useMessagingPopupColors(undefined, 'scheduled');
|
|
@@ -81,5 +81,5 @@ export function ScheduledMessages({ client, accent, onClose }) {
|
|
|
81
81
|
} };
|
|
82
82
|
if (editing)
|
|
83
83
|
return _jsx(ScheduleTimePicker, { initial: editing.sendAt, title: uiText("Reschedule message"), accent: accent, busy: busy, error: error, onSave: time => void change(editing, time), onClose: () => setEditing(null) });
|
|
84
|
-
return _jsx(MessagingPopup, { screen: "scheduled", title: uiText("Scheduled messages"), background: colors.background, onClose: onClose, contentWidth: 640, children: _jsxs(ScrollView, { contentContainerStyle: { padding: 12, gap: 12 }, children: [
|
|
84
|
+
return _jsx(MessagingPopup, { screen: "scheduled", title: uiText("Scheduled messages"), description: uiText("Only you can see these until they are sent."), background: colors.background, onClose: onClose, contentWidth: 640, children: _jsxs(ScrollView, { contentContainerStyle: { padding: 12, gap: 12 }, children: [loading && _jsx(Text, { style: { color: colors.foreground }, children: uiText("Loading…") }), !loading && !items.length && !error && _jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("No scheduled messages. Hold Send after writing a message to choose a time.") }), !!error && _jsx(Pressable, { onPress: () => void load(), accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduled messages"), children: _jsxs(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: [error, ' ', uiText("Tap to refresh.")] }) }), items.map(item => _jsxs(View, { style: { borderRadius: 12, backgroundColor: colors.incoming, padding: 12, gap: 8 }, children: [_jsxs(Text, { style: { color: colors.foreground, fontWeight: '600', fontSize: 16 }, children: [new Date(item.sendAt).toLocaleString(uiLocale, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }), " \u00B7 ", item.state === 'pending' ? uiText("Scheduled") : item.state === 'failed' ? uiText("Not sent") : item.state === 'sent' ? uiText("Sent") : uiText("Cancelled")] }), item.content && _jsx(Text, { numberOfLines: 4, style: { color: colors.foreground, fontSize: 16 }, children: item.content.text || item.content.media?.fileName || item.content.poll?.question || item.content.kind }), item.state === 'failed' && _jsxs(Text, { style: { color: colors.secondary }, children: [uiText("Not sent."), ' ', item.errorCode === 'schedule_expired' ? uiText("The sending window passed.") : item.errorCode?.includes('screening') ? uiText("The app’s safety check did not allow delivery.") : item.errorCode?.includes('billing') || item.errorCode?.includes('spending') ? uiText("The app’s spending limit or billing stopped delivery.") : uiText("Access, message rules or service availability changed.")] }), item.state === 'pending' && _jsxs(View, { style: { flexDirection: 'row', gap: 12 }, children: [_jsx(Pressable, { disabled: busy, onPress: () => setEditing(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Reschedule") }) }), _jsx(Pressable, { disabled: busy, onPress: () => void change(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Cancel message") }) })] })] }, item.id))] }) });
|
|
85
85
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <CommonCrypto/CommonKeyDerivation.h>
|
|
3
|
+
#import <CommonCrypto/CommonCryptoError.h>
|
|
4
|
+
@interface RobonoBackupCrypto : NSObject <RCTBridgeModule>
|
|
5
|
+
@end
|
|
6
|
+
@implementation RobonoBackupCrypto
|
|
7
|
+
RCT_EXPORT_MODULE();
|
|
8
|
+
+ (BOOL)requiresMainQueueSetup { return NO; }
|
|
9
|
+
RCT_REMAP_METHOD(passwordKey, password:(NSString *)password salt:(NSString *)saltHex iterations:(nonnull NSNumber *)iterations resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
10
|
+
// Fixed public work factor/size: never accept unbounded work from cloud metadata.
|
|
11
|
+
if (iterations.doubleValue != 600000 || password.length > 1024 || saltHex.length != 64) { reject(@"invalid", @"Invalid derivation parameters", nil); return; }
|
|
12
|
+
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
13
|
+
NSMutableData *salt = [NSMutableData dataWithLength:32];
|
|
14
|
+
unsigned char *s = salt.mutableBytes;
|
|
15
|
+
for (NSUInteger i=0;i<32;i++) {
|
|
16
|
+
NSString *pair=[saltHex substringWithRange:NSMakeRange(i*2,2)];
|
|
17
|
+
if ([pair rangeOfCharacterFromSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789abcdef"] invertedSet]].location != NSNotFound) { reject(@"invalid", @"Invalid salt", nil); return; }
|
|
18
|
+
unsigned int byte=0; [[NSScanner scannerWithString:pair] scanHexInt:&byte]; s[i]=(unsigned char)byte;
|
|
19
|
+
}
|
|
20
|
+
NSMutableData *bytes=[[password dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
|
|
21
|
+
if (bytes.length>1024) { memset_s(bytes.mutableBytes,bytes.length,0,bytes.length);reject(@"invalid", @"Invalid password length", nil);return; }
|
|
22
|
+
unsigned char key[32];
|
|
23
|
+
int status=CCKeyDerivationPBKDF(kCCPBKDF2,bytes.bytes,bytes.length,salt.bytes,salt.length,kCCPRFHmacAlgSHA256,600000,key,sizeof(key));
|
|
24
|
+
memset_s(bytes.mutableBytes,bytes.length,0,bytes.length);
|
|
25
|
+
if (status != kCCSuccess) { memset_s(key,sizeof(key),0,sizeof(key));reject(@"derive", @"Password derivation failed", nil);return; }
|
|
26
|
+
NSMutableString *hex=[NSMutableString stringWithCapacity:64];for(int i=0;i<32;i++)[hex appendFormat:@"%02x",key[i]];
|
|
27
|
+
memset_s(key,sizeof(key),0,sizeof(key));resolve(hex);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robono/messaging-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"./dist/expo-notification-cleanup.js"
|
|
@@ -52,14 +52,18 @@
|
|
|
52
52
|
"licenses",
|
|
53
53
|
"setup.plugin.cjs",
|
|
54
54
|
"BRIDGE-MESSENGER.md",
|
|
55
|
-
"examples"
|
|
55
|
+
"examples",
|
|
56
|
+
"ios",
|
|
57
|
+
"RobonoMessagingRuntime.podspec",
|
|
58
|
+
"android/build.gradle",
|
|
59
|
+
"android/src"
|
|
56
60
|
],
|
|
57
61
|
"scripts": {
|
|
58
62
|
"build": "tsc -p tsconfig.json",
|
|
59
63
|
"prepack": "npm run build && node ../../scripts/generate-sdk-file-sbom.mjs"
|
|
60
64
|
},
|
|
61
65
|
"peerDependencies": {
|
|
62
|
-
"@robono/messaging": "^0.
|
|
66
|
+
"@robono/messaging": "^0.18.0",
|
|
63
67
|
"react": ">=18.2 <20",
|
|
64
68
|
"react-native": ">=0.76 <1",
|
|
65
69
|
"expo-audio": ">=55 <57",
|
|
@@ -71,7 +75,7 @@
|
|
|
71
75
|
"expo-crypto": ">=55 <57",
|
|
72
76
|
"react-native-safe-area-context": ">=5 <6",
|
|
73
77
|
"react-native-svg": ">=15 <16",
|
|
74
|
-
"@robono/calling-react-native": "^0.
|
|
78
|
+
"@robono/calling-react-native": "^0.11.0",
|
|
75
79
|
"expo-clipboard": ">=8 <57",
|
|
76
80
|
"expo-image-manipulator": ">=14 <57",
|
|
77
81
|
"expo-video-thumbnails": ">=14 <57",
|
|
@@ -79,14 +83,16 @@
|
|
|
79
83
|
"expo-blur": ">=55 <57",
|
|
80
84
|
"expo-notifications": ">=55 <57",
|
|
81
85
|
"expo-secure-store": ">=55 <57",
|
|
82
|
-
"@robono/location-react-native": "^0.4.
|
|
86
|
+
"@robono/location-react-native": "^0.4.2",
|
|
83
87
|
"expo-location": ">=55 <57",
|
|
84
88
|
"expo-constants": ">=55 <57",
|
|
85
89
|
"@robono/location": "^0.4.1",
|
|
86
90
|
"expo-haptics": ">=55 <57",
|
|
87
|
-
"@robono/calling": "^0.
|
|
91
|
+
"@robono/calling": "^0.7.0",
|
|
88
92
|
"expo-media-library": ">=55 <57",
|
|
89
|
-
"expo-task-manager": ">=55.0.0 <57.0.0"
|
|
93
|
+
"expo-task-manager": ">=55.0.0 <57.0.0",
|
|
94
|
+
"expo-application": ">=55 <57",
|
|
95
|
+
"react-native-passkey": "^3.6.2"
|
|
90
96
|
},
|
|
91
97
|
"license": "SEE LICENSE IN LICENSE",
|
|
92
98
|
"peerDependenciesMeta": {
|
|
@@ -143,6 +149,12 @@
|
|
|
143
149
|
},
|
|
144
150
|
"expo-task-manager": {
|
|
145
151
|
"optional": true
|
|
152
|
+
},
|
|
153
|
+
"expo-application": {
|
|
154
|
+
"optional": true
|
|
155
|
+
},
|
|
156
|
+
"react-native-passkey": {
|
|
157
|
+
"optional": true
|
|
146
158
|
}
|
|
147
159
|
},
|
|
148
160
|
"author": {
|
|
@@ -164,5 +176,6 @@
|
|
|
164
176
|
"url": "git+https://github.com/IMLX16/robono-sdks.git",
|
|
165
177
|
"directory": "packages/messaging-react-native"
|
|
166
178
|
},
|
|
167
|
-
"homepage": "https://robono.com/docs#messaging"
|
|
179
|
+
"homepage": "https://robono.com/docs#messaging",
|
|
180
|
+
"dependencies": {}
|
|
168
181
|
}
|