fix the name of searchMediaFIleAsync's result
This commit is contained in:
parent
c1fbc2066b
commit
e7244d9bbe
|
@ -144,14 +144,14 @@ class MessageAudio extends React.Component<IMessageAudioProps, IMessageAudioStat
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const { file } = this.props;
|
const { file } = this.props;
|
||||||
const fileSearch = await searchMediaFileAsync({
|
const cachedAudioResult = await searchMediaFileAsync({
|
||||||
type: 'audio',
|
type: 'audio',
|
||||||
mimeType: file.audio_type,
|
mimeType: file.audio_type,
|
||||||
urlToCache: this.getUrl()
|
urlToCache: this.getUrl()
|
||||||
});
|
});
|
||||||
this.filePath = fileSearch.filePath;
|
this.filePath = cachedAudioResult.filePath;
|
||||||
if (fileSearch?.file?.exists) {
|
if (cachedAudioResult?.file?.exists) {
|
||||||
await this.sound.loadAsync({ uri: fileSearch.file.uri });
|
await this.sound.loadAsync({ uri: cachedAudioResult.file.uri });
|
||||||
return this.setState({ loading: false });
|
return this.setState({ loading: false });
|
||||||
}
|
}
|
||||||
await this.handleAutoDownload();
|
await this.handleAutoDownload();
|
||||||
|
|
|
@ -95,16 +95,16 @@ const ImageContainer = React.memo(
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const handleImageSearchAndDownload = async () => {
|
const handleImageSearchAndDownload = async () => {
|
||||||
if (img) {
|
if (img) {
|
||||||
const searchImageCached = await searchMediaFileAsync({
|
const cachedImageResult = await searchMediaFileAsync({
|
||||||
type: 'image',
|
type: 'image',
|
||||||
mimeType: imageCached.image_type,
|
mimeType: imageCached.image_type,
|
||||||
urlToCache: imgUrlToCache
|
urlToCache: imgUrlToCache
|
||||||
});
|
});
|
||||||
filePath.current = searchImageCached.filePath;
|
filePath.current = cachedImageResult.filePath;
|
||||||
if (searchImageCached.file?.exists) {
|
if (cachedImageResult.file?.exists) {
|
||||||
setImageCached(prev => ({
|
setImageCached(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
title_link: searchImageCached.file?.uri
|
title_link: cachedImageResult.file?.uri
|
||||||
}));
|
}));
|
||||||
return setCached(true);
|
return setCached(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,17 +84,17 @@ const Video = React.memo(
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleVideoSearchAndDownload = async () => {
|
const handleVideoSearchAndDownload = async () => {
|
||||||
if (video) {
|
if (video) {
|
||||||
const searchVideoCached = await searchMediaFileAsync({
|
const cachedVideoResult = await searchMediaFileAsync({
|
||||||
type: 'video',
|
type: 'video',
|
||||||
mimeType: file.video_type,
|
mimeType: file.video_type,
|
||||||
urlToCache: video
|
urlToCache: video
|
||||||
});
|
});
|
||||||
filePath.current = searchVideoCached.filePath;
|
filePath.current = cachedVideoResult.filePath;
|
||||||
const downloadActive = isDownloadActive('video', video);
|
const downloadActive = isDownloadActive('video', video);
|
||||||
if (searchVideoCached.file?.exists) {
|
if (cachedVideoResult.file?.exists) {
|
||||||
setVideoCached(prev => ({
|
setVideoCached(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
video_url: searchVideoCached.file?.uri
|
video_url: cachedVideoResult.file?.uri
|
||||||
}));
|
}));
|
||||||
if (downloadActive) {
|
if (downloadActive) {
|
||||||
cancelDownload('video', video);
|
cancelDownload('video', video);
|
||||||
|
|
Loading…
Reference in New Issue