@robono/messaging-react-native 0.26.2 → 0.27.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 +4 -0
- package/README.md +18 -1
- package/SBOM.spdx.json +1698 -618
- package/app.plugin.cjs +4 -0
- package/dist/bubble-design.d.ts +1 -0
- package/dist/bubble-design.js +1 -0
- package/dist/call-message-decoration.d.ts +15 -0
- package/dist/call-message-decoration.js +23 -0
- package/dist/calling-timeline.d.ts +40 -0
- package/dist/calling-timeline.js +79 -0
- package/dist/calling.d.ts +4 -1
- package/dist/calling.js +8 -5
- package/dist/expo-connected-calling.d.ts +4 -0
- package/dist/expo-connected-calling.js +3 -1
- package/dist/expo-messenger.d.ts +10 -0
- package/dist/expo-messenger.js +7 -1
- package/dist/expo-reviews.js +1 -1
- package/dist/expo-screen.d.ts +32 -0
- package/dist/expo-screen.js +93 -49
- package/dist/expo-thumbnails.js +2 -2
- package/dist/expo-video-orientation.d.ts +7 -0
- package/dist/expo-video-orientation.js +14 -0
- package/dist/expo-video-thumbnail.d.ts +6 -0
- package/dist/expo-video-thumbnail.js +30 -0
- package/dist/expo-voicemail-recorder.d.ts +18 -0
- package/dist/expo-voicemail-recorder.js +214 -0
- package/dist/expo-voicemail-storage.d.ts +10 -0
- package/dist/expo-voicemail-storage.js +81 -0
- package/dist/expo-voicemail-video.d.ts +15 -0
- package/dist/expo-voicemail-video.js +44 -0
- package/dist/expo-voicemail.d.ts +34 -0
- package/dist/expo-voicemail.js +110 -0
- package/dist/expo.d.ts +3 -0
- package/dist/expo.js +3 -0
- package/dist/header-action-group.d.ts +11 -0
- package/dist/header-action-group.js +7 -0
- package/dist/header-calls.js +2 -1
- package/dist/history-anchor.d.ts +29 -0
- package/dist/history-anchor.js +74 -0
- package/dist/history-follow.d.ts +18 -0
- package/dist/history-follow.js +35 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +105 -63
- package/dist/message-time.d.ts +7 -0
- package/dist/message-time.js +17 -0
- package/dist/messenger-video-view.d.ts +4 -1
- package/dist/messenger-video-view.js +15 -4
- package/dist/recording-notice.d.ts +5 -0
- package/dist/recording-notice.js +13 -0
- package/dist/use-quote-gesture.d.ts +1 -0
- package/dist/use-quote-gesture.js +1 -0
- package/dist/video-message-badge.d.ts +7 -0
- package/dist/video-message-badge.js +8 -0
- package/dist/video-orientation.d.ts +13 -0
- package/dist/video-orientation.js +58 -0
- package/dist/voice-composer.d.ts +3 -1
- package/dist/voice-composer.js +7 -6
- package/dist/voicemail-flow.d.ts +60 -0
- package/dist/voicemail-flow.js +156 -0
- package/dist/voicemail-media.d.ts +19 -0
- package/dist/voicemail-media.js +45 -0
- package/dist/voicemail-message.d.ts +41 -0
- package/dist/voicemail-message.js +48 -0
- package/dist/voicemail-prompts.d.ts +4 -0
- package/dist/voicemail-prompts.js +3 -0
- package/dist/voicemail-recording.d.ts +15 -0
- package/dist/voicemail-recording.js +46 -0
- package/dist/voicemail-session.d.ts +19 -0
- package/dist/voicemail-session.js +48 -0
- package/dist/voicemail.d.ts +179 -0
- package/dist/voicemail.js +234 -0
- package/package.json +9 -5
- package/plugin/prepare-native.cjs +1 -0
- package/plugin/video-display-mirror.cjs +66 -0
- package/setup.plugin.cjs +1 -0
package/dist/expo-screen.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { RecordingNotice } from './recording-notice.js';
|
|
2
3
|
import { usePlaybackReporting } from './playback-reporting.js';
|
|
3
4
|
import { withMessagingDeadline } from '@robono/messaging';
|
|
4
5
|
import { Linking } from 'react-native';
|
|
@@ -44,7 +45,7 @@ function Control({ label, icon, onPress, disabled = false, color }) {
|
|
|
44
45
|
return _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: label, disabled: disabled, onPress: onPress, style: { minHeight: 48, padding: 12, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, opacity: disabled ? .45 : 1 }, children: [_jsx(MaterialIcons, { name: icon, size: 24, color: color }), _jsx(Text, { style: { color, fontSize: 16 }, children: label })] });
|
|
45
46
|
}
|
|
46
47
|
const voiceStops = new Set();
|
|
47
|
-
const stopVoicePlayers = async (except) => { await Promise.all([...voiceStops].filter(stop => stop !== except).map(stop => stop())); };
|
|
48
|
+
export const stopVoicePlayers = async (except) => { await Promise.all([...voiceStops].filter(stop => stop !== except).map(stop => stop())); };
|
|
48
49
|
const voiceScope = () => ({ alive: true, busy: false, epoch: 0, release: null, acquiring: null, releasing: Promise.resolve() });
|
|
49
50
|
function releaseVoice(scope) {
|
|
50
51
|
const release = scope.release;
|
|
@@ -76,8 +77,10 @@ async function acquireVoice(scope, audio) {
|
|
|
76
77
|
}
|
|
77
78
|
return scope.alive && scope.epoch === epoch && !!scope.release;
|
|
78
79
|
}
|
|
79
|
-
function VoicePlayer({ file, audio, design, inline, draft, autoPlay = false }) {
|
|
80
|
+
export function VoicePlayer({ file, audio, design, inline, draft, autoPlay = false, onPlayed, onLongPress }) {
|
|
80
81
|
const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
|
|
82
|
+
const playedCallback = useRef(onPlayed);
|
|
83
|
+
playedCallback.current = onPlayed;
|
|
81
84
|
const [playing, setPlaying] = useState(false), [position, setPosition] = useState(0), [error, setError] = useState('');
|
|
82
85
|
const source = useMemo(() => file.stream ? { uri: file.uri, headers: file.stream.headers } : file.uri, [file]);
|
|
83
86
|
const reportPlayback = useContext(MediaPlayback);
|
|
@@ -150,6 +153,8 @@ function VoicePlayer({ file, audio, design, inline, draft, autoPlay = false }) {
|
|
|
150
153
|
const subscription = player.addListener('playbackStatusUpdate', status => {
|
|
151
154
|
if (!scope.alive)
|
|
152
155
|
return;
|
|
156
|
+
if (status.playing && status.currentTime > 0)
|
|
157
|
+
playedCallback.current?.();
|
|
153
158
|
setLoaded(status.isLoaded);
|
|
154
159
|
if (status.didJustFinish) {
|
|
155
160
|
if (completed.current)
|
|
@@ -276,63 +281,85 @@ function VoicePlayer({ file, audio, design, inline, draft, autoPlay = false }) {
|
|
|
276
281
|
const duration = file.durationMs ?? player.duration * 1000;
|
|
277
282
|
if (draft)
|
|
278
283
|
return _jsx(VoiceDraftPlayback, { compact: draft.compact, appearance: design, playing: playing, positionMs: position, durationMs: duration, waveform: draft.waveform, onToggle: () => void toggle(), onRemove: draft.onRemove, disabled: draft.disabled, error: error });
|
|
279
|
-
return _jsx(VoicePlayback, { message: inline?.message, mine: inline?.mine, heard: inline?.heard, onPlayed: inline?.onPlayed, background: inline?.background, ink: inline?.ink ?? c.foreground, accent: inline?.accent ?? c.accent, waveform: inline?.waveform, showWaveform: inline?.showWaveform, footer: inline?.footer, onLongPress: inline?.onLongPress, durationMs: duration, positionMs: position, playing: playing, loading: !!file.stream && !loaded && !error, error: error, onToggle: () => void toggle(), onSeek: ms => { completed.current = false; lastPosition.current = Math.max(0, Math.min(duration, ms)); void player.seekTo(lastPosition.current / 1000).catch(() => { if (!recoverStream())
|
|
284
|
+
return _jsx(VoicePlayback, { message: inline?.message, mine: inline?.mine, heard: inline?.heard, onPlayed: inline?.onPlayed, background: inline?.background, ink: inline?.ink ?? c.foreground, accent: inline?.accent ?? c.accent, waveform: inline?.waveform, showWaveform: inline?.showWaveform, footer: inline?.footer, onLongPress: inline?.onLongPress ?? onLongPress, durationMs: duration, positionMs: position, playing: playing, loading: !!file.stream && !loaded && !error, error: error, onToggle: () => void toggle(), onSeek: ms => { completed.current = false; lastPosition.current = Math.max(0, Math.min(duration, ms)); void player.seekTo(lastPosition.current / 1000).catch(() => { if (!recoverStream())
|
|
280
285
|
setError(uiText("Could not seek. Try again.")); }); } });
|
|
281
286
|
}
|
|
282
|
-
function VideoPlayer({ file, audio, posterUri }) {
|
|
287
|
+
export function VideoPlayer({ file, audio, posterUri, onPlayed, playbackControl, onDimensions }) {
|
|
283
288
|
const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
|
|
289
|
+
const playedCallback = useRef(onPlayed);
|
|
290
|
+
playedCallback.current = onPlayed;
|
|
284
291
|
const mediaReady = useContext(MediaReadiness), recover = useContext(StreamRecovery), reportPlayback = useContext(MediaPlayback);
|
|
285
292
|
const source = useMemo(() => file.stream ? { uri: file.uri, headers: file.stream.headers, contentType: 'progressive', useCaching: false } : file.uri, [file]);
|
|
286
293
|
const player = useVideoPlayer(source, p => { p.loop = false; p.audioMixingMode = 'mixWithOthers'; if (file.stream)
|
|
287
294
|
p.bufferOptions = { preferredForwardBufferDuration: 5, minBufferForPlayback: 0.5 }; });
|
|
288
295
|
const [ready, setReady] = useState(false), [error, setError] = useState(''), [frameReady, setFrameReady] = useState(false);
|
|
296
|
+
const [playing, setPlaying] = useState(false), [videoPosition, setVideoPosition] = useState(0);
|
|
289
297
|
const desired = useRef(file.autoPlay ?? true), lastPosition = useRef(file.resumeAtMs ?? 0);
|
|
290
298
|
useEffect(() => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
299
|
+
const scope = voiceScope();
|
|
300
|
+
let recovered = false, resumed = false, suppressPause = false, acquiring = null;
|
|
301
|
+
desired.current = file.autoPlay ?? true;
|
|
302
|
+
setReady(true);
|
|
303
|
+
const stop = async () => { desired.current = false; scope.epoch++; try {
|
|
296
304
|
player.pause();
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
player.currentTime = file.resumeAtMs / 1000; if (desired.current && AppState.currentState === 'active' && audio.isAvailable?.() !== false)
|
|
305
|
+
}
|
|
306
|
+
catch { } await releaseVoice(scope); await scope.acquiring?.catch(() => { }); await releaseVoice(scope); };
|
|
307
|
+
const begin = () => { if (!scope.alive || recovered || !scope.release || player.status !== 'readyToPlay')
|
|
308
|
+
return; if (!resumed) {
|
|
309
|
+
resumed = true;
|
|
310
|
+
if (file.resumeAtMs)
|
|
311
|
+
player.currentTime = file.resumeAtMs / 1000;
|
|
312
|
+
} if (desired.current && AppState.currentState === 'active')
|
|
306
313
|
player.play(); };
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
const acquire = () => {
|
|
315
|
+
if (acquiring)
|
|
316
|
+
return acquiring;
|
|
317
|
+
acquiring = (async () => { await stopVoicePlayers(stop); if (!scope.alive || recovered || !desired.current || AppState.currentState !== 'active')
|
|
318
|
+
return; if (await acquireVoice(scope, audio))
|
|
319
|
+
begin(); })().catch(e => { if (scope.alive)
|
|
320
|
+
setError(e.message); }).finally(() => { acquiring = null; });
|
|
321
|
+
return acquiring;
|
|
322
|
+
};
|
|
323
|
+
const recoverStream = () => { if (!scope.alive || recovered || !file.stream)
|
|
324
|
+
return false; const wanted = desired.current; recovered = true; player.pause(); void releaseVoice(scope).then(() => { if (scope.alive)
|
|
325
|
+
recover(file.uri, lastPosition.current, wanted); }); return true; };
|
|
326
|
+
voiceStops.add(stop);
|
|
312
327
|
let consumed = false;
|
|
313
|
-
const timer = setInterval(() => { if (!alive)
|
|
314
|
-
return;
|
|
328
|
+
const timer = setInterval(() => { if (!scope.alive)
|
|
329
|
+
return; if (playbackControl)
|
|
330
|
+
setVideoPosition(player.currentTime * 1000); reportPlayback(file.uri, { positionMs: player.currentTime * 1000, durationMs: player.duration * 1000, playing: player.playing, activeView: AppState.currentState === 'active', rate: player.playbackRate }); if (!consumed && player.playing && player.currentTime > 0) {
|
|
315
331
|
consumed = true;
|
|
332
|
+
playedCallback.current?.();
|
|
316
333
|
mediaReady('video-playing', file.uri);
|
|
317
334
|
} if (player.currentTime > 0)
|
|
318
|
-
lastPosition.current = player.currentTime * 1000; if (audio.isAvailable?.() === false)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
setReady(false);
|
|
322
|
-
setError(uiText("Playback paused for a call. Close and reopen the video to continue."));
|
|
323
|
-
void release?.().catch(() => { });
|
|
324
|
-
release = undefined;
|
|
325
|
-
} }, 100);
|
|
326
|
-
// Native controls must retain resume intent and respect the host's call audio session.
|
|
327
|
-
const ended = player.addListener('playToEnd', () => reportPlayback(file.uri, { positionMs: player.duration * 1000, durationMs: player.duration * 1000, playing: false, ended: true, activeView: AppState.currentState === 'active' }));
|
|
335
|
+
lastPosition.current = player.currentTime * 1000; if (audio.isAvailable?.() === false)
|
|
336
|
+
void stop(); }, 100);
|
|
337
|
+
const ended = player.addListener('playToEnd', () => { reportPlayback(file.uri, { positionMs: player.duration * 1000, durationMs: player.duration * 1000, playing: false, ended: true, activeView: AppState.currentState === 'active' }); void stop(); });
|
|
328
338
|
const playback = player.addListener('playingChange', ({ isPlaying }) => {
|
|
329
|
-
|
|
339
|
+
setPlaying(isPlaying);
|
|
340
|
+
if (recovered || !scope.alive)
|
|
330
341
|
return;
|
|
331
|
-
if (isPlaying &&
|
|
332
|
-
|
|
342
|
+
if (!isPlaying && suppressPause) {
|
|
343
|
+
suppressPause = false;
|
|
333
344
|
return;
|
|
334
345
|
}
|
|
335
|
-
|
|
346
|
+
if (isPlaying) {
|
|
347
|
+
desired.current = true;
|
|
348
|
+
if (AppState.currentState !== 'active' || audio.isAvailable?.() === false) {
|
|
349
|
+
void stop();
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (!scope.release) {
|
|
353
|
+
suppressPause = true;
|
|
354
|
+
player.pause();
|
|
355
|
+
void acquire();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
desired.current = false;
|
|
360
|
+
scope.epoch++;
|
|
361
|
+
void releaseVoice(scope);
|
|
362
|
+
}
|
|
336
363
|
});
|
|
337
364
|
const listener = player.addListener('statusChange', s => { if (s.status === 'error') {
|
|
338
365
|
if (!recoverStream())
|
|
@@ -342,18 +369,21 @@ function VideoPlayer({ file, audio, posterUri }) {
|
|
|
342
369
|
begin(); });
|
|
343
370
|
if (player.status === 'error')
|
|
344
371
|
recoverStream();
|
|
345
|
-
|
|
372
|
+
else if (desired.current)
|
|
373
|
+
void acquire();
|
|
374
|
+
const timeout = setTimeout(() => { if (scope.alive && desired.current && player.currentTime === 0 && player.status !== 'readyToPlay' && !recoverStream())
|
|
346
375
|
setError(uiText("This video could not be loaded. Try again.")); }, 15000);
|
|
347
|
-
const app = AppState.addEventListener('change', s => { if (s !== 'active')
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
} });
|
|
351
|
-
return () => { reportPlayback(file.uri, null); ended.remove(); alive = false; clearTimeout(timeout); clearInterval(timer); listener.remove(); playback.remove(); app.remove(); try {
|
|
352
|
-
player.pause();
|
|
353
|
-
}
|
|
354
|
-
catch { } void release?.().catch(() => { }); };
|
|
376
|
+
const app = AppState.addEventListener('change', s => { if (s !== 'active')
|
|
377
|
+
void stop(); });
|
|
378
|
+
return () => { scope.alive = false; reportPlayback(file.uri, null); ended.remove(); clearTimeout(timeout); clearInterval(timer); listener.remove(); playback.remove(); app.remove(); void stop().finally(() => voiceStops.delete(stop)); };
|
|
355
379
|
}, [player, audio]);
|
|
356
|
-
return _jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsx(MessengerVideoView, { posterUri: posterUri, testID: "messenger-video-player", onFirstFrameRender: () => { setFrameReady(true); mediaReady('video-frame', file.uri); }, player: player, nativeControls: ready
|
|
380
|
+
return _jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsx(MessengerVideoView, { sourceUri: file.uri, posterUri: posterUri, allowFullscreen: !playbackControl, onDimensions: onDimensions, testID: "messenger-video-player", onFirstFrameRender: () => { setFrameReady(true); mediaReady('video-frame', file.uri); }, player: player, nativeControls: ready && !playbackControl, style: { height: '100%', width: '100%', ...playbackControl?.corners } }), playbackControl && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: playing ? playbackControl.pauseLabel : playbackControl.playLabel, onLongPress: playbackControl.onLongPress, onPress: () => { if (player.playing)
|
|
381
|
+
player.pause();
|
|
382
|
+
else {
|
|
383
|
+
if (player.currentTime >= player.duration)
|
|
384
|
+
player.currentTime = 0;
|
|
385
|
+
player.play();
|
|
386
|
+
} }, style: { position: 'absolute', inset: 0, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 48, height: 48, borderRadius: 24, backgroundColor: '#0007', alignItems: 'center', justifyContent: 'center' }, children: _jsx(MaterialIcons, { name: playing ? 'pause' : 'play', size: 30, color: "#fff" }) }) }), posterUri && !frameReady && _jsx(View, { pointerEvents: "none", style: { position: 'absolute', width: '100%', height: '100%' }, children: _jsx(Image, { testID: "video-loading-preview", source: { uri: posterUri }, resizeMode: "contain", style: { width: '100%', height: '100%' } }) }), playbackControl && _jsx(View, { pointerEvents: "none", style: { position: 'absolute', right: 6, bottom: 6 + (playbackControl.bottomInset ?? 0), borderRadius: 4, backgroundColor: '#0009', paddingHorizontal: 5, paddingVertical: 2 }, children: _jsx(Text, { style: { color: '#fff', fontSize: 11, fontVariant: ['tabular-nums'] }, children: time(Math.max(0, (file.durationMs ?? player.duration * 1000) - videoPosition)) }) }), _jsx(RecordingNotice, { message: error })] });
|
|
357
387
|
}
|
|
358
388
|
function FileViewer({ file, kind, audio, design }) {
|
|
359
389
|
const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
|
|
@@ -608,6 +638,20 @@ function ExpoMessagingScreenContent({ storage, audioSession, renderConversation,
|
|
|
608
638
|
}, thumbnails.peek(m)?.uri);
|
|
609
639
|
}, [restore, controller, thumbnails]);
|
|
610
640
|
const screenProps = { ...props, requestedMessageAction,
|
|
641
|
+
sendLocalRecording: async (file, kind) => {
|
|
642
|
+
const copy = await copyMessagingCache(file), conversationId = props.client.getSnapshot().conversationId;
|
|
643
|
+
const media = { assetId: Crypto.randomUUID(), mimeType: file.mimeType, fileName: file.fileName, byteSize: file.byteSize, durationMs: file.durationMs };
|
|
644
|
+
controller.restorePrepared(media.assetId, copy, kind);
|
|
645
|
+
try {
|
|
646
|
+
await outbox?.saveFile(conversationId, media, copy, kind);
|
|
647
|
+
await props.client.send({ kind, media }, async () => ({ kind, media: await prepare(kind, media) }));
|
|
648
|
+
}
|
|
649
|
+
catch (error) {
|
|
650
|
+
await outbox?.releaseFile(conversationId, media.assetId);
|
|
651
|
+
await controller.releasePrepared(media.assetId);
|
|
652
|
+
throw error;
|
|
653
|
+
}
|
|
654
|
+
},
|
|
611
655
|
onQuoteReady: props.onQuoteReady ?? defaultQuoteReady,
|
|
612
656
|
copyText: props.copyText ?? defaultCopyText,
|
|
613
657
|
components,
|
package/dist/expo-thumbnails.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { createMessagingVideoThumbnail } from './expo-video-thumbnail.js';
|
|
1
2
|
import { isSmallMessagingJpeg, useSmallOriginalPreview } from './media-access.js';
|
|
2
3
|
import { MessagingPreviewCache } from './preview-cache.js';
|
|
3
4
|
import * as ImageManipulator from 'expo-image-manipulator';
|
|
4
|
-
import * as VideoThumbnails from 'expo-video-thumbnails';
|
|
5
5
|
import * as FS from 'expo-file-system/legacy';
|
|
6
6
|
import { Image } from 'react-native';
|
|
7
7
|
/** Small local previews, with bounded downloads and memory. Large originals stay
|
|
@@ -63,7 +63,7 @@ export function createExpoThumbnails(storage, local, remove, history) {
|
|
|
63
63
|
return signal.aborted ? {} : { uri: 'data:image/jpeg;base64,' + base64 };
|
|
64
64
|
}
|
|
65
65
|
if (message.kind === 'video' && !dedicated)
|
|
66
|
-
poster = (await
|
|
66
|
+
poster = (await createMessagingVideoThumbnail(file.uri, { time: 0, quality: .6 })).uri;
|
|
67
67
|
const result = await ImageManipulator.manipulateAsync(poster ?? file.uri, [{ resize: { width: 480 } }], { compress: .7, format: ImageManipulator.SaveFormat.JPEG, base64: true });
|
|
68
68
|
thumbnail = result.uri;
|
|
69
69
|
return !signal.aborted && result.base64 ? { uri: 'data:image/jpeg;base64,' + result.base64 } : {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as FS from 'expo-file-system/legacy';
|
|
2
|
+
import { readVideoOrientation } from './video-orientation.js';
|
|
3
|
+
/** Header reads only; never copy or transcode the recording. */
|
|
4
|
+
export async function readLocalVideoOrientation(uri) {
|
|
5
|
+
if (!uri.startsWith('file:'))
|
|
6
|
+
return;
|
|
7
|
+
const info = await FS.getInfoAsync(uri);
|
|
8
|
+
if (!info.exists)
|
|
9
|
+
return;
|
|
10
|
+
return readVideoOrientation(async (position, length) => {
|
|
11
|
+
const value = await FS.readAsStringAsync(uri, { encoding: FS.EncodingType.Base64, position, length });
|
|
12
|
+
return Uint8Array.from(atob(value), c => c.charCodeAt(0));
|
|
13
|
+
}, info.size);
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Thumbnails from 'expo-video-thumbnails';
|
|
2
|
+
/** Normalize Android decoder frames using the original video's display matrix. */
|
|
3
|
+
export declare function createMessagingVideoThumbnail(uri: string, options?: {
|
|
4
|
+
time?: number;
|
|
5
|
+
quality?: number;
|
|
6
|
+
}): Promise<Thumbnails.VideoThumbnailsResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import * as FS from 'expo-file-system/legacy';
|
|
3
|
+
import * as Thumbnails from 'expo-video-thumbnails';
|
|
4
|
+
import * as Images from 'expo-image-manipulator';
|
|
5
|
+
import { thumbnailRotation } from './video-orientation.js';
|
|
6
|
+
import { readLocalVideoOrientation } from './expo-video-orientation.js';
|
|
7
|
+
/** Normalize Android decoder frames using the original video's display matrix. */
|
|
8
|
+
export async function createMessagingVideoThumbnail(uri, options = {}) {
|
|
9
|
+
const frame = await Thumbnails.getThumbnailAsync(uri, options);
|
|
10
|
+
if (Platform.OS !== 'android' || !uri.startsWith('file:'))
|
|
11
|
+
return frame;
|
|
12
|
+
try {
|
|
13
|
+
const track = await readLocalVideoOrientation(uri);
|
|
14
|
+
const rotation = thumbnailRotation(track, frame.width, frame.height);
|
|
15
|
+
if (!rotation && !track?.mirrored)
|
|
16
|
+
return frame;
|
|
17
|
+
const actions = [];
|
|
18
|
+
if (rotation)
|
|
19
|
+
actions.push({ rotate: rotation });
|
|
20
|
+
if (track?.mirrored)
|
|
21
|
+
actions.push({ flip: Images.FlipType.Horizontal });
|
|
22
|
+
const corrected = await Images.manipulateAsync(frame.uri, actions, { compress: options.quality ?? .6, format: Images.SaveFormat.JPEG });
|
|
23
|
+
if (FS.cacheDirectory && frame.uri.startsWith(FS.cacheDirectory))
|
|
24
|
+
await FS.deleteAsync(frame.uri, { idempotent: true }).catch(() => { });
|
|
25
|
+
return corrected;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return frame;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type MessagingAppearance } from '@robono/messaging';
|
|
3
|
+
import { type MessagingAudioSession } from './expo-media.js';
|
|
4
|
+
import type { LocalMessagingMedia, MessagingMediaStorage } from './media-controller.js';
|
|
5
|
+
import type { VoicemailUploadAPI, VoicemailRecord } from './voicemail.js';
|
|
6
|
+
/** Embedded recorder: exactly one capture surface, shared by both phone platforms. */
|
|
7
|
+
export declare function ExpoVoicemailRecorder({ client, callId, storage, audioSession, appearance, onCancel, onSent, registerHangUp, initialKind, onSendMessage }: {
|
|
8
|
+
onSendMessage?: (file: LocalMessagingMedia, kind: 'voice' | 'video') => Promise<void>;
|
|
9
|
+
initialKind?: 'voice' | 'video';
|
|
10
|
+
client: VoicemailUploadAPI;
|
|
11
|
+
callId: string;
|
|
12
|
+
storage: MessagingMediaStorage;
|
|
13
|
+
audioSession?: MessagingAudioSession;
|
|
14
|
+
appearance?: MessagingAppearance;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
onSent: (message: VoicemailRecord | null) => void;
|
|
17
|
+
registerHangUp?: (handler: () => void) => () => void;
|
|
18
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { MessageIcon, composerSurface } from './icons.js';
|
|
4
|
+
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
|
|
5
|
+
import { ActivityIndicator, AppState, BackHandler, Modal, Platform, Pressable, Text, View, useWindowDimensions } from 'react-native';
|
|
6
|
+
import { MaterialIcons } from '@expo/vector-icons';
|
|
7
|
+
import { AudioModule, createAudioPlayer } from 'expo-audio';
|
|
8
|
+
import * as FS from 'expo-file-system/legacy';
|
|
9
|
+
import { randomUUID } from 'expo-crypto';
|
|
10
|
+
import { defaultMessagingSettings } from '@robono/messaging';
|
|
11
|
+
import { VoicemailFlow } from './voicemail-flow.js';
|
|
12
|
+
import { voicemailPrompts } from './voicemail-prompts.js';
|
|
13
|
+
import { VoiceMessageComposer } from './voice-composer.js';
|
|
14
|
+
import { VoicePlayer, VideoPlayer, stopVoicePlayers } from './expo-screen.js';
|
|
15
|
+
import { RecordingNotice } from './recording-notice.js';
|
|
16
|
+
import { allocateMessagingCache, removeMessagingCacheUri } from './expo-cache.js';
|
|
17
|
+
import { createExpoMessagingDevice, createExpoMessagingAudioSession } from './expo-media.js';
|
|
18
|
+
const aborted = () => Object.assign(Error('Closed'), { name: 'AbortError' });
|
|
19
|
+
function check(signal) { if (signal.aborted)
|
|
20
|
+
throw aborted(); }
|
|
21
|
+
async function greeting(kind, audio, signal, ownsAudio = false) {
|
|
22
|
+
const dir = await allocateMessagingCache(), uri = dir + 'prompt.wav';
|
|
23
|
+
let release, player;
|
|
24
|
+
try {
|
|
25
|
+
check(signal);
|
|
26
|
+
await FS.writeAsStringAsync(uri, voicemailPrompts[kind], { encoding: FS.EncodingType.Base64 });
|
|
27
|
+
if (!ownsAudio)
|
|
28
|
+
release = await audio.acquire('playback');
|
|
29
|
+
check(signal);
|
|
30
|
+
player = createAudioPlayer(uri, { keepAudioSessionActive: true });
|
|
31
|
+
await new Promise((resolve, reject) => {
|
|
32
|
+
let done = false;
|
|
33
|
+
const finish = (e) => { if (done)
|
|
34
|
+
return; done = true; clearTimeout(timer); subscription.remove(); signal.removeEventListener('abort', cancel); e ? reject(e) : resolve(); };
|
|
35
|
+
const cancel = () => finish(aborted());
|
|
36
|
+
const subscription = player.addListener('playbackStatusUpdate', s => { if (s.didJustFinish)
|
|
37
|
+
finish(); });
|
|
38
|
+
const timer = setTimeout(() => finish(Error('Prompt could not play')), 12000);
|
|
39
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
40
|
+
if (signal.aborted)
|
|
41
|
+
cancel();
|
|
42
|
+
else
|
|
43
|
+
player.play();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
player?.remove();
|
|
48
|
+
await release?.();
|
|
49
|
+
await removeMessagingCacheUri(uri);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Embedded recorder: exactly one capture surface, shared by both phone platforms. */
|
|
53
|
+
export function ExpoVoicemailRecorder({ client, callId, storage, audioSession, appearance, onCancel, onSent, registerHangUp, initialKind, onSendMessage }) {
|
|
54
|
+
const insets = useSafeAreaInsets(), window = useWindowDimensions();
|
|
55
|
+
const callbacks = useRef({ onCancel, onSent, onSendMessage });
|
|
56
|
+
callbacks.current = { onCancel, onSent, onSendMessage };
|
|
57
|
+
const [associated, setAssociated] = useState(true), association = useRef(true);
|
|
58
|
+
const audio = useMemo(() => audioSession ?? createExpoMessagingAudioSession(), [audioSession]);
|
|
59
|
+
const design = useMemo(() => appearance ?? defaultMessagingSettings('Voicemail').appearance, [appearance]), c = design.colors;
|
|
60
|
+
const camera = useRef(null), ready = useRef(false), [cameraEnabled, setCameraEnabled] = useState(false), [kind, setKind] = useState(initialKind ?? 'voice');
|
|
61
|
+
const flow = useMemo(() => {
|
|
62
|
+
const device = createExpoMessagingDevice(audio);
|
|
63
|
+
let sentMessage = null;
|
|
64
|
+
let activeKind = 'voice', video, videoStarted = 0, timer, stopping = false, max = 60000, captureStage = 'prepare', releaseVideoAudio;
|
|
65
|
+
const releaseVideo = async () => { const release = releaseVideoAudio; releaseVideoAudio = undefined; if (camera.current) {
|
|
66
|
+
setCameraEnabled(false);
|
|
67
|
+
const until = Date.now() + 1000;
|
|
68
|
+
while (camera.current && Date.now() < until)
|
|
69
|
+
await new Promise(r => setTimeout(r, 20));
|
|
70
|
+
} try {
|
|
71
|
+
await release?.();
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (__DEV__)
|
|
75
|
+
console.warn('[voicemail-audio-release]', String(error));
|
|
76
|
+
} };
|
|
77
|
+
const clean = async () => { clearInterval(timer); try {
|
|
78
|
+
if (activeKind === 'voice') {
|
|
79
|
+
const file = await device.stopRecording();
|
|
80
|
+
if (file)
|
|
81
|
+
await device.remove(file);
|
|
82
|
+
}
|
|
83
|
+
else if (video) {
|
|
84
|
+
stopping = true;
|
|
85
|
+
camera.current?.stopRecording();
|
|
86
|
+
const file = await video.catch(() => null);
|
|
87
|
+
video = undefined;
|
|
88
|
+
if (file?.uri)
|
|
89
|
+
await FS.deleteAsync(file.uri, { idempotent: true });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
setCameraEnabled(false);
|
|
94
|
+
await releaseVideo();
|
|
95
|
+
} };
|
|
96
|
+
return new VoicemailFlow({ authorize: () => client.options(callId), capture: {
|
|
97
|
+
async prepare(option, signal) {
|
|
98
|
+
captureStage = 'prepare';
|
|
99
|
+
await stopVoicePlayers();
|
|
100
|
+
check(signal);
|
|
101
|
+
activeKind = option.kind;
|
|
102
|
+
setKind(option.kind);
|
|
103
|
+
max = option.maxDurationMs;
|
|
104
|
+
stopping = false;
|
|
105
|
+
if (!(await AudioModule.requestRecordingPermissionsAsync()).granted)
|
|
106
|
+
throw Error('Microphone permission required');
|
|
107
|
+
check(signal);
|
|
108
|
+
if (option.kind === 'video') {
|
|
109
|
+
const module = require('expo-camera');
|
|
110
|
+
if (!(await module.Camera.requestCameraPermissionsAsync()).granted)
|
|
111
|
+
throw Error('Camera permission required');
|
|
112
|
+
check(signal);
|
|
113
|
+
captureStage = 'camera audio';
|
|
114
|
+
releaseVideoAudio = await audio.acquire('recording');
|
|
115
|
+
if (signal.aborted) {
|
|
116
|
+
await releaseVideo();
|
|
117
|
+
throw aborted();
|
|
118
|
+
}
|
|
119
|
+
ready.current = false;
|
|
120
|
+
setCameraEnabled(true);
|
|
121
|
+
const deadline = Date.now() + 10000;
|
|
122
|
+
while (!ready.current) {
|
|
123
|
+
check(signal);
|
|
124
|
+
if (Date.now() > deadline)
|
|
125
|
+
throw Error('Camera unavailable');
|
|
126
|
+
await new Promise(r => setTimeout(r, 50));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, prompt: (kind, signal) => { captureStage = 'prompt'; return greeting(kind, audio, signal, kind === 'video'); },
|
|
130
|
+
async start(option, signal, progress, limit) {
|
|
131
|
+
captureStage = 'capture';
|
|
132
|
+
check(signal);
|
|
133
|
+
if (option.kind === 'voice') {
|
|
134
|
+
await device.startRecording(option.maxDurationMs, signal);
|
|
135
|
+
timer = setInterval(() => { const s = device.recordingStatus(); progress(s.durationMs, s.level); if (s.limitReached) {
|
|
136
|
+
clearInterval(timer);
|
|
137
|
+
limit();
|
|
138
|
+
} }, 100);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
videoStarted = Date.now();
|
|
142
|
+
if (!camera.current)
|
|
143
|
+
throw Error('Camera unavailable');
|
|
144
|
+
const options = { maxDuration: Math.max(1, (option.maxDurationMs - 200) / 1000), maxFileSize: option.maxByteSize, ...(Platform.OS === 'ios' ? { codec: 'avc1' } : {}) };
|
|
145
|
+
video = camera.current.recordAsync(options);
|
|
146
|
+
void video.then(() => { if (!stopping && !signal.aborted)
|
|
147
|
+
limit(); }).catch(() => { if (!signal.aborted)
|
|
148
|
+
limit(); });
|
|
149
|
+
timer = setInterval(() => progress(Date.now() - videoStarted), 100);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
async stop() {
|
|
153
|
+
clearInterval(timer);
|
|
154
|
+
stopping = true;
|
|
155
|
+
let file = null;
|
|
156
|
+
if (activeKind === 'voice')
|
|
157
|
+
file = await device.stopRecording();
|
|
158
|
+
else {
|
|
159
|
+
const durationMs = Math.min(max, Date.now() - videoStarted);
|
|
160
|
+
camera.current?.stopRecording();
|
|
161
|
+
let result;
|
|
162
|
+
try {
|
|
163
|
+
result = await video;
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
video = undefined;
|
|
167
|
+
setCameraEnabled(false);
|
|
168
|
+
await releaseVideo();
|
|
169
|
+
}
|
|
170
|
+
if (result?.uri) {
|
|
171
|
+
const extension = Platform.OS === 'ios' ? 'mov' : 'mp4';
|
|
172
|
+
const dir = await allocateMessagingCache(), uri = dir + 'voicemail.' + extension;
|
|
173
|
+
await FS.moveAsync({ from: result.uri, to: uri });
|
|
174
|
+
const info = await FS.getInfoAsync(uri);
|
|
175
|
+
if (!info.exists)
|
|
176
|
+
throw Error('Recording missing');
|
|
177
|
+
file = { uri, fileName: 'Voicemail.' + extension, mimeType: Platform.OS === 'ios' ? 'video/quicktime' : 'video/mp4', byteSize: info.size, durationMs, autoPlay: false };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return file ? { file, id: randomUUID(), kind: activeKind } : null;
|
|
181
|
+
}, cancel: clean, release: async (draft) => { await stopVoicePlayers(); await device.remove(draft.file); },
|
|
182
|
+
}, send: async (draft) => {
|
|
183
|
+
await stopVoicePlayers();
|
|
184
|
+
if (!association.current) {
|
|
185
|
+
if (!callbacks.current.onSendMessage)
|
|
186
|
+
throw Error('Messaging is unavailable');
|
|
187
|
+
await callbacks.current.onSendMessage(draft.file, draft.kind);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (!draft.uploaded)
|
|
191
|
+
draft.uploaded = await storage.upload(draft.file, { uploadId: draft.id, conversationId: callId, kind: draft.kind, signal: new AbortController().signal, onProgress: () => { } });
|
|
192
|
+
draft.pending ??= client.prepareSend(callId, draft.uploaded.assetId, flow.getSnapshot().waveform);
|
|
193
|
+
const response = await client.send(draft.pending);
|
|
194
|
+
sentMessage = response.message;
|
|
195
|
+
}, onSent: () => callbacks.current.onSent(sentMessage), onCancel: () => callbacks.current.onCancel(), onError: error => { if (__DEV__)
|
|
196
|
+
console.warn('[voicemail-capture]', captureStage, error instanceof Error ? error.message : String(error)); } });
|
|
197
|
+
}, [client, callId, storage, audio]);
|
|
198
|
+
const state = useSyncExternalStore(flow.subscribe, flow.getSnapshot, flow.getSnapshot);
|
|
199
|
+
useEffect(() => flow.attach(), [flow]);
|
|
200
|
+
useEffect(() => registerHangUp?.(() => { void flow.hangUp(); }), [flow, registerHangUp]);
|
|
201
|
+
useEffect(() => { const back = BackHandler.addEventListener('hardwareBackPress', () => { void flow.cancel(); return true; }); const app = AppState.addEventListener('change', s => { if (s === 'background' && kind === 'video' && flow.getSnapshot().phase === 'recording')
|
|
202
|
+
void flow.hangUp(); }); return () => { back.remove(); app.remove(); }; }, [flow, kind]);
|
|
203
|
+
const recording = state.phase === 'recording', review = state.phase === 'review', sending = state.phase === 'sending';
|
|
204
|
+
const button = (label, icon, run, primary = false) => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, onPress: run, style: { ...(label === 'Stop recording' || label === 'Record again' ? { position: 'absolute', left: (window.width - 52) / 2, top: 12 } : {}), width: 52, height: 52, borderRadius: 26, alignItems: 'center', justifyContent: 'center', backgroundColor: label === 'Stop recording' ? '#d9363e' : primary ? c.accent : 'transparent', opacity: label === 'Stop recording' && Math.floor(state.elapsedMs / 500) % 2 ? .7 : 1 }, children: _jsx(MessageIcon, { name: icon === 'delete-outline' ? 'trash' : icon === 'replay' ? 'refresh' : icon, size: 30, color: label === 'Discard recording' ? '#ef4444' : primary || label === 'Stop recording' || kind === 'video' ? '#fff' : c.foreground }) });
|
|
205
|
+
let Camera = null;
|
|
206
|
+
if (cameraEnabled) {
|
|
207
|
+
Camera = require('expo-camera').CameraView;
|
|
208
|
+
}
|
|
209
|
+
const detach = () => { association.current = false; setAssociated(false); };
|
|
210
|
+
const header = associated ? _jsxs(View, { style: { alignSelf: 'flex-start', marginLeft: kind === 'voice' ? 24 : 0, flexDirection: 'row', alignItems: 'center', paddingLeft: 10, borderTopLeftRadius: 8, borderTopRightRadius: 8, backgroundColor: kind === 'voice' ? composerSurface(c.background) : '#111' }, children: [_jsx(Text, { style: { color: kind === 'voice' ? c.incomingText : '#fff', fontSize: 12 }, children: "Voicemail message" }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: onSendMessage ? 'Remove voicemail association' : 'Cancel voicemail', disabled: sending, onPress: onSendMessage ? detach : () => void flow.cancel(), style: { width: 36, height: 36, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MaterialIcons, { name: "close", size: 18, color: kind === 'voice' ? c.incomingText : '#fff' }) })] }) : null;
|
|
211
|
+
if (kind === 'voice')
|
|
212
|
+
return _jsxs(View, { testID: "voicemail-recorder", style: { gap: 0, backgroundColor: c.background }, children: [header, _jsx(VoiceMessageComposer, { appearance: design, maxSeconds: 60, busy: sending, phase: recording ? 'recording' : review ? 'review' : sending ? 'uploading' : state.phase === 'error' ? 'failed' : 'preparing', elapsedMs: state.elapsedMs, waveform: state.waveform, error: state.error, onRecord: () => void flow.begin(), onRecordAgain: () => void flow.begin(), onStop: () => void flow.finish(), onSend: () => void flow.finish(true), sendWhileRecording: true, onRemove: () => void flow.cancel(), review: state.draft ? _jsx(VoicePlayer, { file: state.draft.file, audio: audio, design: design, draft: { waveform: state.waveform, disabled: sending, onRemove: () => void flow.cancel() } }) : undefined })] });
|
|
213
|
+
return _jsx(Modal, { transparent: true, visible: true, animationType: "none", onRequestClose: () => void flow.cancel(), children: _jsx(View, { style: { flex: 1, justifyContent: 'flex-end' }, children: _jsxs(View, { style: { gap: 0 }, testID: "voicemail-recorder", children: [header, kind === 'video' ? _jsx(View, { style: { height: Math.round(window.height * .68), overflow: 'hidden', backgroundColor: '#111' }, children: Camera ? _jsx(Camera, { ref: camera, facing: "front", mode: "video", mirror: true, videoQuality: "480p", videoBitrate: 1500000, onCameraReady: () => { ready.current = true; }, style: { flex: 1 } }) : state.draft ? _jsx(VideoPlayer, { file: state.draft.file, audio: audio, design: design, playbackControl: { bottomInset: 60 + Math.max(insets.bottom, 12), playLabel: 'Play recording', pauseLabel: 'Pause recording' } }) : state.phase === 'error' ? _jsx(View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MaterialIcons, { name: "videocam-off", size: 32, color: "#aaa" }) }) : _jsx(ActivityIndicator, { style: { flex: 1 }, color: c.accent }) }) : state.draft ? _jsx(VoicePlayer, { file: state.draft.file, audio: audio, design: design }) : _jsx(View, { style: { height: 58, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 3 }, children: (state.waveform.length ? state.waveform : Array(32).fill(.08)).map((v, i) => _jsx(View, { style: { width: 3, height: Math.max(3, v * 36), borderRadius: 2, backgroundColor: c.accent } }, i)) }), _jsx(View, { testID: "voicemail-video-controls", style: { position: 'absolute', bottom: Platform.OS === 'ios' ? 0 : insets.bottom, left: 0, right: 0, height: 76 + (Platform.OS === 'ios' ? insets.bottom : 0), paddingTop: 12, paddingBottom: 12 + (Platform.OS === 'ios' ? insets.bottom : 0), paddingHorizontal: 12, backgroundColor: '#0005', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }, children: recording ? _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [button('Discard recording', 'delete-outline', () => void flow.cancel()), _jsxs(Text, { style: { color: '#fff', fontVariant: ['tabular-nums'] }, children: [Math.floor(state.elapsedMs / 60000), ":", String(Math.floor(state.elapsedMs / 1000) % 60).padStart(2, '0')] })] }), button('Stop recording', 'stop', () => void flow.finish()), button('Send voicemail', 'send', () => void flow.finish(true), true)] }) : review ? _jsxs(_Fragment, { children: [button('Discard recording', 'delete-outline', () => void flow.cancel()), button('Record again', 'replay', () => void flow.begin()), button('Send voicemail', 'send', () => void flow.send(), true)] }) : state.phase === 'error' ? _jsxs(_Fragment, { children: [button('Discard recording', 'delete-outline', () => void flow.cancel()), button(state.draft ? 'Retry sending' : 'Try recording again', 'refresh', () => void (state.draft ? flow.send() : flow.begin()), true)] }) : _jsxs(_Fragment, { children: [!sending && button('Discard recording', 'delete-outline', () => void flow.cancel()), _jsx(ActivityIndicator, { color: c.accent })] }) }), _jsx(RecordingNotice, { message: state.error })] }) }) });
|
|
214
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VoicemailRecordingStorage } from './voicemail-recording.js';
|
|
2
|
+
export declare const expoVoicemailRecordingStorage: VoicemailRecordingStorage;
|
|
3
|
+
/** Device-history originals use the same hashing/fsync native store as ordinary
|
|
4
|
+
* attachments. The normal media store still supplies retention-aware play copies. */
|
|
5
|
+
export declare function withExpoDurableVoicemailStorage(namespace: string, base: VoicemailRecordingStorage): VoicemailRecordingStorage;
|
|
6
|
+
/** Explicit account removal, never triggered by viewing or server delivery cleanup. */
|
|
7
|
+
export declare function clearExpoDurableVoicemailAccount(namespace: string, owner: {
|
|
8
|
+
appId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
}): Promise<void>;
|