desestructured params to download too
This commit is contained in:
parent
27eacaad9f
commit
07e097000a
|
@ -293,7 +293,10 @@ class MessageAudio extends React.Component<IMessageAudioProps, IMessageAudioStat
|
||||||
mimeType: file.audio_type,
|
mimeType: file.audio_type,
|
||||||
messageId
|
messageId
|
||||||
});
|
});
|
||||||
const audio = await downloadMediaFile(`${url}?rc_uid=${user.id}&rc_token=${user.token}`, fileSearch.filePath);
|
const audio = await downloadMediaFile({
|
||||||
|
url: `${url}?rc_uid=${user.id}&rc_token=${user.token}`,
|
||||||
|
filePath: fileSearch.filePath
|
||||||
|
});
|
||||||
await this.sound.loadAsync({ uri: audio });
|
await this.sound.loadAsync({ uri: audio });
|
||||||
return this.setState({ loading: false, toDownload: false });
|
return this.setState({ loading: false, toDownload: false });
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,15 @@ export const searchMediaFileAsync = async ({
|
||||||
return { file, filePath };
|
return { file, filePath };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const downloadMediaFile = async (url: string, filePath: string, downloadResumable?: FileSystem.DownloadResumable) => {
|
export const downloadMediaFile = async ({
|
||||||
|
url,
|
||||||
|
filePath,
|
||||||
|
downloadResumable
|
||||||
|
}: {
|
||||||
|
url: string;
|
||||||
|
filePath: string;
|
||||||
|
downloadResumable?: FileSystem.DownloadResumable;
|
||||||
|
}) => {
|
||||||
let uri = '';
|
let uri = '';
|
||||||
try {
|
try {
|
||||||
if (downloadResumable) {
|
if (downloadResumable) {
|
||||||
|
|
Loading…
Reference in New Issue