diff --git a/app/containers/message/Audio.js b/app/containers/message/Audio.js index 630e4703b..5621a8d07 100644 --- a/app/containers/message/Audio.js +++ b/app/containers/message/Audio.js @@ -119,10 +119,15 @@ class MessageAudio extends React.Component { const { file } = this.props; const { baseUrl, user } = this.context; + let url = file.audio_url; + if (!url.startsWith('http')) { + url = `${ baseUrl }${ file.audio_url }`; + } + this.setState({ loading: true }); try { await Audio.setAudioModeAsync(mode); - await this.sound.loadAsync({ uri: `${ baseUrl }${ file.audio_url }?rc_uid=${ user.id }&rc_token=${ user.token }` }); + await this.sound.loadAsync({ uri: `${ url }?rc_uid=${ user.id }&rc_token=${ user.token }` }); } catch { // Do nothing } diff --git a/app/containers/message/Reply.js b/app/containers/message/Reply.js index 2278a90ab..df99258f9 100644 --- a/app/containers/message/Reply.js +++ b/app/containers/message/Reply.js @@ -139,7 +139,10 @@ const Reply = React.memo(({ return; } if (attachment.type === 'file') { - url = `${ baseUrl }${ url }?rc_uid=${ user.id }&rc_token=${ user.token }`; + if (!url.startsWith('http')) { + url = `${ baseUrl }${ url }`; + } + url = `${ url }?rc_uid=${ user.id }&rc_token=${ user.token }`; } openLink(url, theme); }; diff --git a/app/views/MessagesView/index.js b/app/views/MessagesView/index.js index 6d8633b8d..cd7b25201 100644 --- a/app/views/MessagesView/index.js +++ b/app/views/MessagesView/index.js @@ -7,7 +7,7 @@ import equal from 'deep-equal'; import ActionSheet from 'react-native-action-sheet'; import styles from './styles'; -import Message from '../../containers/message/Message'; +import Message from '../../containers/message'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; import RocketChat from '../../lib/rocketchat'; @@ -87,6 +87,7 @@ class MessagesView extends React.Component { const { user, baseUrl, theme } = this.props; const renderItemCommonProps = item => ({ + item, baseUrl, user, author: item.u || item.user, @@ -110,21 +111,21 @@ class MessagesView extends React.Component { }, noDataMsg: I18n.t('No_files'), testID: 'room-files-view', - renderItem: (item) => { - const url = getFileUrlFromMessage(item); - - return ( - ( + - ); - } + ...getFileUrlFromMessage(item) + }] + }} + theme={theme} + /> + ) }, // Mentions Messages Screen Mentions: { diff --git a/app/views/SearchMessagesView/index.js b/app/views/SearchMessagesView/index.js index 8c8457816..856d83713 100644 --- a/app/views/SearchMessagesView/index.js +++ b/app/views/SearchMessagesView/index.js @@ -11,7 +11,7 @@ import styles from './styles'; import Markdown from '../../containers/markdown'; import debounce from '../../utils/debounce'; import RocketChat from '../../lib/rocketchat'; -import Message from '../../containers/message/Message'; +import Message from '../../containers/message'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; @@ -115,14 +115,10 @@ class SearchMessagesView extends React.Component { const { user, baseUrl, theme } = this.props; return ( {}} getCustomEmoji={this.getCustomEmoji}