@robono/messaging-react-native 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +157 -4
- package/RobonoMessagingRuntime.podspec +16 -0
- package/SBOM.spdx.json +2709 -813
- package/android/build.gradle +10 -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/RobonoBackupGoogle.java +76 -0
- package/android/src/main/java/com/robono/messaging/RobonoHistoryStore.java +173 -0
- package/android/src/main/java/com/robono/messaging/RobonoMessagingPackage.java +11 -0
- package/app.plugin.cjs +22 -3
- package/cloudkit/backup-schema.ckdb +13 -0
- package/dist/account-pages.d.ts +51 -0
- package/dist/account-pages.js +65 -0
- package/dist/account.d.ts +6 -2
- package/dist/account.js +37 -11
- package/dist/attachment-preview.d.ts +11 -10
- package/dist/attachment-preview.js +15 -12
- package/dist/backup-background.d.ts +25 -0
- package/dist/backup-background.js +71 -0
- package/dist/backup-base64.d.ts +3 -0
- package/dist/backup-base64.js +41 -0
- package/dist/backup-google-authorization.d.ts +23 -0
- package/dist/backup-google-authorization.js +95 -0
- package/dist/backup.d.ts +24 -0
- package/dist/backup.js +202 -0
- package/dist/brand.js +4 -4
- package/dist/bubble-design.d.ts +1 -1
- package/dist/bubble-design.js +5 -3
- package/dist/cloudkit-backup.d.ts +14 -0
- package/dist/cloudkit-backup.js +193 -0
- package/dist/contact-directory.d.ts +3 -1
- package/dist/contact-directory.js +3 -3
- package/dist/conversation-details.js +2 -2
- package/dist/customization.d.ts +1 -0
- package/dist/delivery-bar.d.ts +3 -2
- package/dist/delivery-bar.js +7 -4
- package/dist/delivery-notice.d.ts +9 -0
- package/dist/delivery-notice.js +15 -0
- package/dist/directory-navigation.d.ts +25 -0
- package/dist/directory-navigation.js +69 -0
- package/dist/expo-backup-background.d.ts +17 -0
- package/dist/expo-backup-background.js +57 -0
- package/dist/expo-backup-cloudkit.d.ts +6 -0
- package/dist/expo-backup-cloudkit.js +11 -0
- package/dist/expo-backup-crypto.d.ts +3 -0
- package/dist/expo-backup-crypto.js +17 -0
- package/dist/expo-backup-google.d.ts +7 -0
- package/dist/expo-backup-google.js +16 -0
- package/dist/expo-backup-network.d.ts +8 -0
- package/dist/expo-backup-network.js +18 -0
- package/dist/expo-backup-passkeys.d.ts +14 -0
- package/dist/expo-backup-passkeys.js +46 -0
- package/dist/expo-backup-settings.d.ts +4 -0
- package/dist/expo-backup-settings.js +59 -0
- package/dist/expo-backup.d.ts +14 -0
- package/dist/expo-backup.js +22 -0
- package/dist/expo-bridge.d.ts +2 -0
- package/dist/expo-bridge.js +3 -1
- package/dist/expo-cache.js +20 -1
- package/dist/expo-device-history.d.ts +24 -0
- package/dist/expo-device-history.js +88 -0
- package/dist/expo-durable-history.d.ts +26 -0
- package/dist/expo-durable-history.js +56 -0
- package/dist/expo-history-backup.d.ts +3 -0
- package/dist/expo-history-backup.js +79 -0
- package/dist/expo-history-maintenance.d.ts +4 -0
- package/dist/expo-history-maintenance.js +23 -0
- package/dist/expo-history-previews.d.ts +5 -0
- package/dist/expo-history-previews.js +57 -0
- package/dist/expo-history.d.ts +1 -1
- package/dist/expo-history.js +2 -2
- package/dist/expo-inbox-preferences.d.ts +3 -0
- package/dist/expo-inbox-preferences.js +9 -0
- package/dist/expo-media.d.ts +2 -0
- package/dist/expo-media.js +18 -24
- package/dist/expo-messenger.d.ts +8 -0
- package/dist/expo-messenger.js +27 -11
- package/dist/expo-notifications.d.ts +17 -1
- package/dist/expo-notifications.js +36 -16
- package/dist/expo-outbox.d.ts +2 -0
- package/dist/expo-outbox.js +1 -1
- package/dist/expo-oversight.d.ts +15 -0
- package/dist/expo-oversight.js +15 -0
- package/dist/expo-reviews.d.ts +6 -0
- package/dist/expo-reviews.js +145 -0
- package/dist/expo-screen.js +62 -28
- package/dist/expo-thumbnails.d.ts +6 -2
- package/dist/expo-thumbnails.js +73 -8
- package/dist/expo.d.ts +14 -0
- package/dist/expo.js +12 -0
- package/dist/forward.js +2 -2
- package/dist/header-calls.js +1 -1
- package/dist/header-colors.d.ts +5 -0
- package/dist/header-colors.js +7 -0
- package/dist/inbox-search.d.ts +1 -1
- package/dist/inbox-search.js +7 -3
- package/dist/inbox.d.ts +6 -2
- package/dist/inbox.js +27 -55
- package/dist/index.d.ts +14 -6
- package/dist/index.js +195 -78
- package/dist/linked-apps.d.ts +45 -0
- package/dist/linked-apps.js +40 -0
- 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-controller.d.ts +2 -0
- package/dist/native-history-authorization.d.ts +4 -0
- package/dist/native-history-authorization.js +69 -0
- package/dist/native-history-backup.d.ts +16 -0
- package/dist/native-history-backup.js +144 -0
- package/dist/native-history.d.ts +14 -0
- package/dist/native-history.js +186 -0
- package/dist/native-outbox.d.ts +2 -0
- package/dist/oversight-session.d.ts +4 -0
- package/dist/oversight-session.js +14 -0
- package/dist/popup.d.ts +6 -3
- package/dist/popup.js +6 -6
- package/dist/preview-layout.d.ts +12 -0
- package/dist/preview-layout.js +102 -0
- package/dist/recent-media.js +2 -1
- package/dist/reviews.d.ts +19 -0
- package/dist/reviews.js +231 -0
- package/dist/scheduled.js +6 -6
- package/dist/search.js +18 -8
- package/ios/RobonoBackupCloudKit.m +96 -0
- package/ios/RobonoBackupCrypto.m +30 -0
- package/ios/RobonoHistoryStore.m +170 -0
- package/package.json +34 -7
- package/plugin/backup-expiration.cjs +23 -0
- package/plugin/prepare-native.cjs +12 -0
package/dist/inbox.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useDirectoryNavigation, MessagingDirectoryConversation } from './directory-navigation.js';
|
|
2
3
|
import { MessagingBrand } from './brand.js';
|
|
3
4
|
import { messagingScreenAppearance, messagingContrastInk, messagingAvatarStyle, messagingFriendsColors, messagingMenuColors, messagingMenuLayout } from '@robono/messaging';
|
|
4
5
|
import { directoryWithoutChats, MessagingDirectoryRow } from './contact-directory.js';
|
|
@@ -10,11 +11,11 @@ import { MessageMenuRow } from './message-menu.js';
|
|
|
10
11
|
import { InboxMessageSearch } from './inbox-search.js';
|
|
11
12
|
import { MessageIcon } from './icons.js';
|
|
12
13
|
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
13
|
-
import { AppState, FlatList, Image, Platform, Pressable, ScrollView, View } from 'react-native';
|
|
14
|
+
import { ActivityIndicator, AppState, FlatList, Image, Platform, Pressable, ScrollView, StyleSheet, View } from 'react-native';
|
|
14
15
|
import { defaultMessagingSettings } from '@robono/messaging';
|
|
15
16
|
import { MessagingPopup, MessagingMenuSurface, MessagingPopupHeaderBoundary, useMessagingPopupColors, messagingPopupBackdrop } from './popup.js';
|
|
16
17
|
/** Compact Messenger chat rows: avatar, name, last message, time and unread badge. */
|
|
17
|
-
export function MessagingInbox({ client, userId, contacts = {}, appearance, active = true, manageUpdates = true, onSelect, onDeleted, companyName, headerActions, searchText, selectedId, query: controlledQuery, onSearchChange, viewMemory, directory = [], onOpenDirectoryContact }) {
|
|
18
|
+
export function MessagingInbox({ client, userId, selfAvatarUrl, contacts = {}, appearance, active = true, manageUpdates = true, onSelect, onDeleted, companyName, headerActions, searchText, selectedId, query: controlledQuery, onSearchChange, viewMemory, directory = [], onOpenDirectoryContact, onDirectorySelect, onNewConversation }) {
|
|
18
19
|
const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
|
|
19
20
|
const state = useSyncExternalStore(client.subscribe, client.getSnapshot, client.getSnapshot), design = messagingScreenAppearance(appearance ?? state.appearance ?? defaultMessagingSettings().appearance), c = messagingFriendsColors(design), friends = design.screens?.friends;
|
|
20
21
|
const messagingPopupColors = useMessagingPopupColors(design, 'alerts');
|
|
@@ -27,55 +28,24 @@ export function MessagingInbox({ client, userId, contacts = {}, appearance, acti
|
|
|
27
28
|
const [localQuery, setLocalQuery] = useState(memory.query);
|
|
28
29
|
const query = friends?.showSearch === false ? '' : controlledQuery ?? localQuery;
|
|
29
30
|
const setQuery = (value) => { memory.query = value; (onSearchChange ?? setLocalQuery)(value); };
|
|
31
|
+
const [searchOpen, setSearchOpen] = useState(!!query), searchInput = useRef(null);
|
|
32
|
+
const closeSearch = () => { setQuery(''); setSearchOpen(false); };
|
|
33
|
+
useEffect(() => { if (query)
|
|
34
|
+
setSearchOpen(true); }, [query]);
|
|
35
|
+
useEffect(() => { if (searchOpen) {
|
|
36
|
+
const frame = requestAnimationFrame(() => searchInput.current?.focus());
|
|
37
|
+
return () => cancelAnimationFrame(frame);
|
|
38
|
+
} }, [searchOpen]);
|
|
30
39
|
const scroll = useInboxScroll(memory, 'chats:' + query.trim(), state.conversations.length > 0 && !state.loading, !state.hasMore);
|
|
31
40
|
const [selected, setSelected] = useState(null), [confirm, setConfirm] = useState(false), [busy, setBusy] = useState(false), [error, setError] = useState('');
|
|
32
|
-
const avatar = messagingAvatarStyle(friends?.avatarSize ??
|
|
33
|
-
const title = (row) => row.contactId === userId ? uiText('
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
cancelDirectory(); }); return () => sub.remove(); }, []);
|
|
41
|
-
useEffect(() => { if (!active)
|
|
42
|
-
cancelDirectory(); }, [active]);
|
|
43
|
-
useEffect(() => { if (directorySelection) {
|
|
44
|
-
const current = directory.find(c => c.id === directorySelection.id);
|
|
45
|
-
if (!current || current.available !== directorySelection.available || current.contactId !== directorySelection.contactId)
|
|
46
|
-
cancelDirectory();
|
|
47
|
-
} }, [directory, directorySelection]);
|
|
48
|
-
async function openDirectory(entry) {
|
|
49
|
-
directoryRequest.current?.abort();
|
|
50
|
-
setDirectorySelection(entry);
|
|
51
|
-
setDirectoryError('');
|
|
52
|
-
setDirectoryBusy(false);
|
|
53
|
-
if (!entry.available || !onOpenDirectoryContact)
|
|
54
|
-
return;
|
|
55
|
-
const control = new AbortController();
|
|
56
|
-
directoryRequest.current = control;
|
|
57
|
-
setDirectoryBusy(true);
|
|
58
|
-
try {
|
|
59
|
-
const row = await onOpenDirectoryContact(entry, control.signal);
|
|
60
|
-
const current = directoryRef.current.find(c => c.id === entry.id);
|
|
61
|
-
if (control.signal.aborted || !current?.available || current.contactId !== entry.contactId)
|
|
62
|
-
return;
|
|
63
|
-
setDirectorySelection(null);
|
|
64
|
-
onSelect(row);
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
if (!control.signal.aborted)
|
|
68
|
-
setDirectoryError(e instanceof Error ? e.message : uiText('This conversation is unavailable.'));
|
|
69
|
-
}
|
|
70
|
-
finally {
|
|
71
|
-
if (directoryRequest.current === control) {
|
|
72
|
-
directoryRequest.current = null;
|
|
73
|
-
setDirectoryBusy(false);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const directoryRows = directoryWithoutChats(directory, state.conversations, query);
|
|
78
|
-
const inboxRows = [...state.conversations.filter(row => !query.trim() || [title(row), row.lastMessage?.text ?? '', searchText?.(row) ?? ''].join(' ').toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())).map(chat => ({ kind: 'chat', chat })), ...directoryRows.map(entry => ({ kind: 'directory', entry }))];
|
|
41
|
+
const avatar = messagingAvatarStyle(friends?.avatarSize ?? 48, friends?.avatarShape), rowPadding = friends?.rowSpacing === 'compact' ? 6 : friends?.rowSpacing === 'relaxed' ? 16 : 12;
|
|
42
|
+
const title = (row) => row.contactId === userId ? uiText('Me') : row.kind === 'group' ? row.name ?? 'Group' : contacts[row.contactId ?? '']?.name ?? row.contactId ?? 'Chat';
|
|
43
|
+
const directoryNavigation = useDirectoryNavigation({ directory, onOpenDirectoryContact, scope: client, userId, active, onOpen: onSelect });
|
|
44
|
+
const openDirectory = (entry) => onDirectorySelect ? onDirectorySelect(entry) : directoryNavigation.open(entry);
|
|
45
|
+
const isSelf = (row) => row.kind === 'direct' && row.contactId === userId;
|
|
46
|
+
const visibleChats = state.conversations.filter(row => state.showSelf !== false || !isSelf(row)).sort((a, b) => Number(isSelf(b)) - Number(isSelf(a)));
|
|
47
|
+
const directoryRows = directoryWithoutChats(directory.filter(entry => entry.contactId !== userId), state.conversations, query);
|
|
48
|
+
const inboxRows = [...visibleChats.filter(row => !query.trim() || [title(row), row.lastMessage?.text ?? '', searchText?.(row) ?? ''].join(' ').toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())).map(chat => ({ kind: 'chat', chat })), ...directoryRows.map(entry => ({ kind: 'directory', entry }))];
|
|
79
49
|
const rows = useRef(new Map()), pending = useRef(null);
|
|
80
50
|
const [menuVisible, setMenuVisible] = useState(false), [confirmVisible, setConfirmVisible] = useState(false), [anchor, setAnchor] = useState({ x: 12, y: 88 });
|
|
81
51
|
const openOptions = (row) => { if (!state.inboxActionsAvailable)
|
|
@@ -111,19 +81,21 @@ export function MessagingInbox({ client, userId, contacts = {}, appearance, acti
|
|
|
111
81
|
setBusy(false);
|
|
112
82
|
} }
|
|
113
83
|
const preview = (row) => { const m = row.lastMessage; if (!m)
|
|
114
|
-
return 'No messages yet'; const text = m.kind === 'text' ? m.text ?? '' : ({ voice: 'Voice message', image: 'Photo', video: 'Video', document: 'Document', poll: 'Poll' }[m.kind] ?? 'Message'); return (m.senderId === userId ? 'You: ' : '') + text; };
|
|
115
|
-
|
|
84
|
+
return row.deviceHistoryLastMessage ? uiText('Restore your backup to see earlier messages') : uiText('No messages yet'); const text = m.kind === 'text' ? m.text ?? '' : ({ voice: 'Voice message', image: 'Photo', video: 'Video', document: 'Document', poll: 'Poll' }[m.kind] ?? 'Message'); return (m.senderId === userId ? 'You: ' : '') + text; };
|
|
85
|
+
if (directoryNavigation.selection)
|
|
86
|
+
return _jsx(MessagingDirectoryConversation, { entry: directoryNavigation.selection, busy: directoryNavigation.busy, error: directoryNavigation.error, appearance: design, onBack: directoryNavigation.cancel, onRetry: () => void directoryNavigation.open(directoryNavigation.selection) });
|
|
87
|
+
return _jsx(MessagingTypography, { appearance: design, children: _jsxs(View, { style: { flex: 1, minHeight: 0, backgroundColor: c.background }, children: [_jsx(MessagingPopupHeaderBoundary, { children: _jsxs(View, { testID: "messaging-inbox-header", style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: friends?.headerBackground ?? c.background, minHeight: friends?.headerSize === 'compact' ? 48 : friends?.headerSize === 'roomy' ? 80 : 64, paddingHorizontal: 16, paddingVertical: 8, gap: 8 }, children: [_jsx(MessagingBrand, { appearance: design, companyName: companyName }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: [friends?.showSearch !== false && _jsx(Pressable, { testID: "messaging-inbox-search-toggle", accessibilityRole: "button", accessibilityLabel: uiText('Search chats'), accessibilityState: { expanded: searchOpen }, onPress: () => searchOpen ? closeSearch() : setSearchOpen(true), style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "search", size: 23, color: friends?.headerText ?? c.foreground }) }), headerActions] })] }) }), friends?.showSearch !== false && searchOpen && _jsxs(View, { testID: "messaging-inbox-search", style: { minHeight: 46, marginHorizontal: 12, marginTop: 2, marginBottom: 4, flexDirection: 'row', alignItems: 'center', gap: 8, borderRadius: 23, borderWidth: 1, borderColor: c.background, paddingHorizontal: 12, backgroundColor: c.foreground + '26' }, children: [_jsx(MessageIcon, { name: "search", size: 18, color: c.secondary }), _jsx(TextInput, { ref: searchInput, accessibilityLabel: uiText("Search chats"), placeholder: uiText("Search chats"), placeholderTextColor: c.secondary, value: query, onChangeText: setQuery, maxLength: 200, autoCapitalize: "none", autoCorrect: false, style: { flex: 1, minWidth: 0, minHeight: 44, paddingVertical: 8, color: c.foreground, fontSize: 15 } }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Close chat search"), onPress: closeSearch, style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "close", size: 14, color: c.secondary }) })] }), state.error && _jsxs(View, { style: { padding: 12 }, children: [_jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: state.error }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => void client.refresh().catch(() => { }), children: _jsx(Text, { style: { color: c.accent, paddingVertical: 8 }, children: uiText("Try again") }) })] }), query.trim() && state.globalSearchAvailable ? _jsx(InboxMessageSearch, { viewMemory: memory, client: client, query: query.trim(), appearance: { ...design, colors: c }, name: title, chats: visibleChats.filter(row => title(row).toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())), onSelect: onSelect, directoryHeader: directoryRows.map(entry => _jsx(MessagingDirectoryRow, { contact: entry, appearance: design, onPress: () => void openDirectory(entry) }, entry.id)) }, userId) : _jsx(FlatList, { ...scroll, testID: "messaging-inbox-list", data: inboxRows, keyExtractor: row => row.kind === 'chat' ? 'chat:' + row.chat.id : 'directory:' + row.entry.id, contentContainerStyle: { flexGrow: 1, paddingBottom: onNewConversation ? 100 : 0 }, ItemSeparatorComponent: () => friends?.showDividers === false ? null : _jsx(View, { style: { height: StyleSheet.hairlineWidth, backgroundColor: c.foreground + '26', width: '88%', alignSelf: 'center' } }), ListEmptyComponent: _jsx(View, { style: { minHeight: 60, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 20 }, children: state.loading ? _jsx(ActivityIndicator, { accessibilityLabel: uiText("Loading chats…"), color: c.secondary }) : _jsx(Text, { style: { textAlign: 'center', color: c.secondary }, children: state.error ? '' : query ? uiText("No matching chats.") : uiText("No chats yet") }) }), ListFooterComponent: state.hasMore ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("More chats"), accessibilityState: { busy: state.loading }, disabled: state.loading, onPress: () => void client.loadMore().catch(() => { }), style: { minHeight: 48, alignItems: 'center', justifyContent: 'center' }, children: state.loading ? _jsx(ActivityIndicator, { color: c.accent }) : _jsx(Text, { style: { padding: 12, textAlign: 'center', color: c.accent }, children: uiText("More chats") }) }) : null, renderItem: ({ item: row }) => {
|
|
116
88
|
if (row.kind === 'directory')
|
|
117
89
|
return _jsx(MessagingDirectoryRow, { contact: row.entry, appearance: design, onPress: () => void openDirectory(row.entry) });
|
|
118
90
|
const item = row.chat;
|
|
119
|
-
const person = item.contactId ? contacts[item.contactId] : undefined, title = item.contactId === userId ? uiText('
|
|
120
|
-
const
|
|
91
|
+
const person = isSelf(item) ? { name: 'Me', avatarUrl: selfAvatarUrl ?? contacts[userId]?.avatarUrl } : item.contactId ? contacts[item.contactId] : undefined, title = item.contactId === userId ? uiText('Me') : item.kind === 'group' ? item.name ?? 'Group' : person?.name ?? item.contactId ?? 'Chat';
|
|
92
|
+
const dateValue = item.lastMessage?.createdAt ?? item.deviceHistoryLastMessage?.createdAt, date = dateValue ? new Date(dateValue) : null;
|
|
121
93
|
return _jsxs(Pressable, { ref: node => { if (node)
|
|
122
94
|
rows.current.set(item.id, node);
|
|
123
95
|
else
|
|
124
96
|
rows.current.delete(item.id); }, accessibilityRole: "button", accessibilityState: { selected: item.id === selectedId }, accessibilityLabel: item.unreadCount ? uiText('{name}, {count} unread', { name: title, count: uiNumber(item.unreadCount) }) : title, onPress: () => onSelect(item), onLongPress: () => openOptions(item), accessibilityActions: state.inboxActionsAvailable ? [{ name: 'showOptions', label: uiText("Chat options") }] : [], onAccessibilityAction: e => { if (e.nativeEvent.actionName === 'showOptions')
|
|
125
|
-
openOptions(item); }, ...(Platform.OS === 'web' ? { onContextMenu: (e) => { e.preventDefault(); openOptions(item); } } : {}), style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal:
|
|
126
|
-
} }),
|
|
97
|
+
openOptions(item); }, ...(Platform.OS === 'web' ? { onContextMenu: (e) => { e.preventDefault(); openOptions(item); } } : {}), style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 16, paddingVertical: rowPadding, minHeight: Math.max(44, avatar.height + rowPadding * 2), backgroundColor: item.id === selectedId ? c.accent + '15' : undefined }, children: [friends?.showAvatars !== false && (person?.avatarUrl ? _jsx(Image, { source: { uri: person.avatarUrl }, style: { ...avatar } }) : _jsx(View, { style: { ...avatar, backgroundColor: c.accent + '20', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent, fontSize: 18, fontWeight: '700' }, children: title.slice(0, 1).toUpperCase() }) })), _jsxs(View, { style: { flex: 1, minWidth: 0, flexDirection: 'row', alignItems: 'flex-start', gap: 8 }, children: [_jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { color: c.foreground, fontSize: friends?.nameSize ?? 16, fontWeight: '700' }, children: title }), friends?.showPreview !== false && _jsx(Text, { numberOfLines: friends?.previewLines ?? 1, style: { color: c.secondary, marginTop: 3, fontSize: friends?.previewSize ?? 14 }, children: preview(item) })] }), _jsxs(View, { testID: "messaging-inbox-row-meta", style: { flexShrink: 0, minWidth: 48, alignItems: 'flex-end', gap: 4, paddingTop: 1 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', gap: 4 }, children: [item.muted && _jsx(MessageIcon, { name: "notifications-off-outline", size: 13, color: c.secondary }), friends?.showTime !== false && _jsx(Text, { style: { color: item.unreadCount ? c.accent : c.secondary, fontSize: 12 }, children: date ? date.toLocaleTimeString(uiLocale, { hour: 'numeric', minute: '2-digit' }) : '' })] }), friends?.showUnread !== false && item.unreadCount > 0 && _jsx(View, { style: { minWidth: friends?.unreadStyle === 'dot' ? 10 : 20, height: friends?.unreadStyle === 'dot' ? 10 : 20, borderRadius: 10, borderWidth: 1.5, borderColor: c.accent, backgroundColor: friends?.unreadStyle === 'filled' || friends?.unreadStyle === 'dot' ? c.accent : undefined, alignItems: 'center', justifyContent: 'center', paddingHorizontal: friends?.unreadStyle === 'dot' ? 0 : 5 }, children: friends?.unreadStyle !== 'dot' && _jsx(Text, { style: { color: friends?.unreadStyle === 'filled' ? messagingContrastInk(c.accent) : c.accent, fontSize: 10, fontWeight: '900' }, children: item.unreadCount > 99 ? '99+' : item.unreadCount }) })] })] })] });
|
|
98
|
+
} }), onNewConversation && _jsxs(Pressable, { testID: "messaging-new-message", accessibilityRole: "button", accessibilityLabel: uiText('New message'), onPress: onNewConversation, style: { position: 'absolute', end: 16, bottom: 32, minWidth: 124, height: 52, paddingHorizontal: 18, flexDirection: 'row', gap: 9, borderRadius: 26, backgroundColor: c.accent, alignItems: 'center', justifyContent: 'center', boxShadow: '0 8px 12px #0005', elevation: 8 }, children: [_jsx(MessageIcon, { name: "chat", size: 24, color: messagingContrastInk(c.accent) }), _jsx(Text, { style: { color: messagingContrastInk(c.accent), fontSize: 16, fontWeight: '600' }, children: uiText('Message') })] }), selected && _jsxs(_Fragment, { children: [_jsx(MessagingMenuSurface, { visible: menuVisible, onDismiss: dismissed, onClose: () => { if (!busy)
|
|
127
99
|
setSelected(null); }, children: rect => {
|
|
128
100
|
const palette = messagingMenuColors(design, 'friends'), menuLayout = messagingMenuLayout(design.menus?.friends);
|
|
129
101
|
const width = Math.min(218, rect.width - 24), top = Math.max(12, Math.min(anchor.y - rect.top, rect.height - 124));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export { MessagingLinkedAppsScreen } from './linked-apps.js';
|
|
2
|
+
export type { MessagingLinkedApps, MessagingLinkedNetwork, MessagingLinkedContact } from './linked-apps.js';
|
|
3
|
+
export { messagingLanguages } from './account-pages.js';
|
|
4
|
+
export type { MessagingAccountPages, MessagingAccountPage } from './account-pages.js';
|
|
5
|
+
export { messagingHeaderColors } from './header-colors.js';
|
|
6
|
+
export { MessagingReviewInbox } from './reviews.js';
|
|
7
|
+
export type { MessagingReviewInboxProps } from './reviews.js';
|
|
1
8
|
import { type ConversationActions } from './chat-options.js';
|
|
2
9
|
export type { ConversationActions } from './chat-options.js';
|
|
3
10
|
import { type MessagingHeaderOptions } from './conversation-selector.js';
|
|
@@ -117,7 +124,8 @@ export interface MessagingScreenProps {
|
|
|
117
124
|
contact: {
|
|
118
125
|
name: string;
|
|
119
126
|
avatarUrl?: string;
|
|
120
|
-
language?: string;
|
|
127
|
+
language?: string; /** Authenticated directory label for this contact’s network. */
|
|
128
|
+
networkName?: string;
|
|
121
129
|
};
|
|
122
130
|
/** Resolve group member names through your app's authorized contact directory. */
|
|
123
131
|
participants?: Record<string, {
|
|
@@ -126,6 +134,8 @@ export interface MessagingScreenProps {
|
|
|
126
134
|
language?: string;
|
|
127
135
|
}>;
|
|
128
136
|
appearance?: MessagingAppearance;
|
|
137
|
+
/** Appearance already loaded by the inbox, used until conversation settings arrive. */
|
|
138
|
+
initialAppearance?: MessagingAppearance;
|
|
129
139
|
components?: MessagingComponents;
|
|
130
140
|
style?: StyleProp<ViewStyle>;
|
|
131
141
|
/** Set false when this conversation is covered by another route. */
|
|
@@ -195,10 +205,6 @@ export declare function GroupDiscussion({ threadRoot, onClose }: {
|
|
|
195
205
|
threadRoot?: string;
|
|
196
206
|
onClose: () => void;
|
|
197
207
|
}): React.JSX.Element;
|
|
198
|
-
export declare function messagingHeaderColors(design: MessagingAppearance, group: boolean): {
|
|
199
|
-
background: string;
|
|
200
|
-
foreground: string;
|
|
201
|
-
};
|
|
202
208
|
export declare function MessagingHeader({ children }?: {
|
|
203
209
|
children?: ReactNode;
|
|
204
210
|
}): React.JSX.Element;
|
|
@@ -216,7 +222,8 @@ export declare function MessageDeletion({ messages, onClose }: {
|
|
|
216
222
|
export declare function MessagingList(): React.JSX.Element;
|
|
217
223
|
export declare function MessagingComposer(): React.JSX.Element;
|
|
218
224
|
/** Account navigation. Mount in the inbox/app toolbar, never in a contact menu. */
|
|
219
|
-
export declare function MessagingAccountMenu({
|
|
225
|
+
export declare function MessagingAccountMenu({ inbox, onNewGroup, onMaps, onPublicRooms }?: {
|
|
226
|
+
inbox?: import('@robono/messaging').MessagingInboxClient; /** @deprecated Use MessagingInbox.onNewConversation for the floating Message button. */
|
|
220
227
|
onNewConversation?: () => void;
|
|
221
228
|
onNewGroup?: () => void;
|
|
222
229
|
onMaps?: () => void;
|
|
@@ -229,3 +236,4 @@ export { MessagingInbox, type MessagingInboxProps } from './inbox.js';
|
|
|
229
236
|
export type { PlaybackProps } from './media-ui.js';
|
|
230
237
|
export type { InboxViewMemory } from './inbox-view.js';
|
|
231
238
|
export type { MessagingDirectoryContact, MessagingDirectoryOptions } from './contact-directory.js';
|
|
239
|
+
export { MessagingBackupScreen } from './backup.js';
|