@@ -15,15 +15,23 @@ import {
1515 VideoProgressData ,
1616 VideoSeekResponse ,
1717} from '../../native' ;
18- import { AudioUpload , FileTypes } from '../../types/types' ;
18+ import { AudioConfig , FileTypes } from '../../types/types' ;
1919import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle' ;
2020import { ProgressControl } from '../ProgressControl/ProgressControl' ;
2121import { WaveProgressBar } from '../ProgressControl/WaveProgressBar' ;
2222
2323dayjs . extend ( duration ) ;
2424
25+ export type AudioAttachmentType = AudioConfig & {
26+ asset_url ?: string ;
27+ id : string ;
28+ title ?: string ;
29+ type : 'audio' | 'voiceRecording' ;
30+ waveform_data ?: number [ ] ;
31+ } ;
32+
2533export type AudioAttachmentProps = {
26- item : Omit < AudioUpload , 'state' > ;
34+ item : AudioAttachmentType ;
2735 onLoad : ( index : string , duration : number ) => void ;
2836 onPlayPause : ( index : string , pausedStatus ?: boolean ) => void ;
2937 onProgress : ( index : string , progress : number ) => void ;
@@ -180,9 +188,9 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
180188 useEffect ( ( ) => {
181189 if ( isExpoCLI ) {
182190 const initiateSound = async ( ) => {
183- if ( item && item . file && item . file . uri && NativeHandlers . Sound ?. initializeSound ) {
191+ if ( item && item . asset_url && NativeHandlers . Sound ?. initializeSound ) {
184192 soundRef . current = await NativeHandlers . Sound . initializeSound (
185- { uri : item . file . uri } ,
193+ { uri : item . asset_url } ,
186194 {
187195 pitchCorrectionQuality : 'high' ,
188196 progressUpdateIntervalMillis : 100 ,
@@ -318,22 +326,22 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
318326 filenameText ,
319327 ] }
320328 >
321- { getTrimmedAttachmentTitle ( item . file . name ) }
329+ { getTrimmedAttachmentTitle ( item . title ) }
322330 </ Text >
323331 < View style = { styles . audioInfo } >
324332 < Text style = { [ styles . progressDurationText , { color : grey_dark } , progressDurationText ] } >
325333 { progressDuration }
326334 </ Text >
327335 { ! hideProgressBar && (
328336 < View style = { [ styles . progressControlContainer , progressControlContainer ] } >
329- { item . file . waveform_data ? (
337+ { item . waveform_data ? (
330338 < WaveProgressBar
331339 amplitudesCount = { 30 }
332340 onEndDrag = { dragEnd }
333341 onProgressDrag = { dragProgress }
334342 onStartDrag = { dragStart }
335343 progress = { item . progress as number }
336- waveformData = { item . file . waveform_data }
344+ waveformData = { item . waveform_data }
337345 />
338346 ) : (
339347 < ProgressControl
@@ -359,7 +367,7 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
359367 rate = { currentSpeed }
360368 soundRef = { soundRef as RefObject < SoundReturnType > }
361369 testID = 'sound-player'
362- uri = { item . file . uri }
370+ uri = { item . asset_url }
363371 />
364372 ) }
365373 </ View >
0 commit comments