[IMPROVEMENT] Remove useMarkdown (#1774)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
b166d59cbd
commit
c583e0c8f5
|
@ -50,7 +50,6 @@ export const SNIPPETED_MESSAGES = createRequestTypes('SNIPPETED_MESSAGES', ['OPE
|
|||
export const DEEP_LINKING = createRequestTypes('DEEP_LINKING', ['OPEN']);
|
||||
export const SORT_PREFERENCES = createRequestTypes('SORT_PREFERENCES', ['SET_ALL', 'SET']);
|
||||
export const NOTIFICATION = createRequestTypes('NOTIFICATION', ['RECEIVED', 'REMOVE']);
|
||||
export const TOGGLE_MARKDOWN = 'TOGGLE_MARKDOWN';
|
||||
export const TOGGLE_CRASH_REPORT = 'TOGGLE_CRASH_REPORT';
|
||||
export const SET_CUSTOM_EMOJIS = 'SET_CUSTOM_EMOJIS';
|
||||
export const SET_ACTIVE_USERS = 'SET_ACTIVE_USERS';
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import * as types from './actionsTypes';
|
||||
|
||||
export function toggleMarkdown(value) {
|
||||
return {
|
||||
type: types.TOGGLE_MARKDOWN,
|
||||
payload: value
|
||||
};
|
||||
}
|
|
@ -42,7 +42,7 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
const ReplyPreview = React.memo(({
|
||||
message, Message_TimeFormat, baseUrl, username, useMarkdown, replying, getCustomEmoji, close, theme
|
||||
message, Message_TimeFormat, baseUrl, username, replying, getCustomEmoji, close, theme
|
||||
}) => {
|
||||
if (!replying) {
|
||||
return null;
|
||||
|
@ -67,7 +67,6 @@ const ReplyPreview = React.memo(({
|
|||
username={username}
|
||||
getCustomEmoji={getCustomEmoji}
|
||||
numberOfLines={1}
|
||||
useMarkdown={useMarkdown}
|
||||
preview
|
||||
theme={theme}
|
||||
/>
|
||||
|
@ -79,7 +78,6 @@ const ReplyPreview = React.memo(({
|
|||
|
||||
ReplyPreview.propTypes = {
|
||||
replying: PropTypes.bool,
|
||||
useMarkdown: PropTypes.bool,
|
||||
message: PropTypes.object.isRequired,
|
||||
Message_TimeFormat: PropTypes.string.isRequired,
|
||||
close: PropTypes.func.isRequired,
|
||||
|
@ -90,7 +88,6 @@ ReplyPreview.propTypes = {
|
|||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
useMarkdown: state.markdown.useMarkdown,
|
||||
Message_TimeFormat: state.settings.Message_TimeFormat,
|
||||
baseUrl: state.server.server
|
||||
});
|
||||
|
|
|
@ -71,7 +71,6 @@ class Markdown extends PureComponent {
|
|||
tmid: PropTypes.string,
|
||||
isEdited: PropTypes.bool,
|
||||
numberOfLines: PropTypes.number,
|
||||
useMarkdown: PropTypes.bool,
|
||||
customEmojis: PropTypes.bool,
|
||||
useRealName: PropTypes.bool,
|
||||
channels: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||
|
@ -368,9 +367,7 @@ class Markdown extends PureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
msg, useMarkdown = true, numberOfLines, preview = false, theme
|
||||
} = this.props;
|
||||
const { msg, preview = false } = this.props;
|
||||
|
||||
if (!msg) {
|
||||
return null;
|
||||
|
@ -389,10 +386,6 @@ class Markdown extends PureComponent {
|
|||
return this.renderer.render(ast);
|
||||
}
|
||||
|
||||
if (!useMarkdown && !preview) {
|
||||
return <Text style={[styles.text, { color: themes[theme].bodyText }]} numberOfLines={numberOfLines}>{m}</Text>;
|
||||
}
|
||||
|
||||
const ast = parser.parse(m);
|
||||
this.isMessageContainsOnlyEmoji = isOnlyEmoji(m) && emojiCount(m) <= 3;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import Video from './Video';
|
|||
import Reply from './Reply';
|
||||
|
||||
const Attachments = React.memo(({
|
||||
attachments, timeFormat, user, baseUrl, useMarkdown, showAttachment, getCustomEmoji, theme
|
||||
attachments, timeFormat, user, baseUrl, showAttachment, getCustomEmoji, theme
|
||||
}) => {
|
||||
if (!attachments || attachments.length === 0) {
|
||||
return null;
|
||||
|
@ -16,17 +16,17 @@ const Attachments = React.memo(({
|
|||
|
||||
return attachments.map((file, index) => {
|
||||
if (file.image_url) {
|
||||
return <Image key={file.image_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
|
||||
return <Image key={file.image_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
|
||||
}
|
||||
if (file.audio_url) {
|
||||
return <Audio key={file.audio_url} file={file} user={user} baseUrl={baseUrl} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
|
||||
return <Audio key={file.audio_url} file={file} user={user} baseUrl={baseUrl} getCustomEmoji={getCustomEmoji} theme={theme} />;
|
||||
}
|
||||
if (file.video_url) {
|
||||
return <Video key={file.video_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
|
||||
return <Video key={file.video_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
return <Reply key={index} index={index} attachment={file} timeFormat={timeFormat} user={user} baseUrl={baseUrl} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
|
||||
return <Reply key={index} index={index} attachment={file} timeFormat={timeFormat} user={user} baseUrl={baseUrl} getCustomEmoji={getCustomEmoji} theme={theme} />;
|
||||
});
|
||||
}, (prevProps, nextProps) => isEqual(prevProps.attachments, nextProps.attachments) && prevProps.theme === nextProps.theme);
|
||||
|
||||
|
@ -35,7 +35,6 @@ Attachments.propTypes = {
|
|||
timeFormat: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
baseUrl: PropTypes.string,
|
||||
useMarkdown: PropTypes.bool,
|
||||
showAttachment: PropTypes.func,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
theme: PropTypes.string
|
||||
|
|
|
@ -74,7 +74,6 @@ class Audio extends React.Component {
|
|||
file: PropTypes.object.isRequired,
|
||||
baseUrl: PropTypes.string.isRequired,
|
||||
user: PropTypes.object.isRequired,
|
||||
useMarkdown: PropTypes.bool,
|
||||
theme: PropTypes.string,
|
||||
split: PropTypes.bool,
|
||||
getCustomEmoji: PropTypes.func
|
||||
|
@ -157,7 +156,7 @@ class Audio extends React.Component {
|
|||
uri, paused, currentTime, duration
|
||||
} = this.state;
|
||||
const {
|
||||
user, baseUrl, file, getCustomEmoji, useMarkdown, split, theme
|
||||
user, baseUrl, file, getCustomEmoji, split, theme
|
||||
} = this.props;
|
||||
const { description } = file;
|
||||
|
||||
|
@ -199,7 +198,7 @@ class Audio extends React.Component {
|
|||
/>
|
||||
<Text style={[styles.duration, { color: themes[theme].auxiliaryText }]}>{this.duration}</Text>
|
||||
</View>
|
||||
<Markdown msg={description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />
|
||||
<Markdown msg={description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} theme={theme} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ const Content = React.memo((props) => {
|
|||
preview={props.tmid && !props.isThreadRoom}
|
||||
channels={props.channels}
|
||||
mentions={props.mentions}
|
||||
useMarkdown={props.useMarkdown && (!props.tmid || props.isThreadRoom)}
|
||||
navToRoomInfo={props.navToRoomInfo}
|
||||
tmid={props.tmid}
|
||||
useRealName={props.useRealName}
|
||||
|
@ -53,7 +52,6 @@ Content.propTypes = {
|
|||
msg: PropTypes.string,
|
||||
theme: PropTypes.string,
|
||||
isEdited: PropTypes.bool,
|
||||
useMarkdown: PropTypes.bool,
|
||||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
|
|
|
@ -41,7 +41,7 @@ export const MessageImage = React.memo(({ img, theme }) => (
|
|||
));
|
||||
|
||||
const ImageContainer = React.memo(({
|
||||
file, imageUrl, baseUrl, user, useMarkdown, showAttachment, getCustomEmoji, split, theme
|
||||
file, imageUrl, baseUrl, user, showAttachment, getCustomEmoji, split, theme
|
||||
}) => {
|
||||
const img = imageUrl || formatAttachmentUrl(file.image_url, user.id, user.token, baseUrl);
|
||||
if (!img) {
|
||||
|
@ -55,7 +55,7 @@ const ImageContainer = React.memo(({
|
|||
<Button split={split} theme={theme} onPress={onPress}>
|
||||
<View>
|
||||
<MessageImage img={img} theme={theme} />
|
||||
<Markdown msg={file.description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />
|
||||
<Markdown msg={file.description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} theme={theme} />
|
||||
</View>
|
||||
</Button>
|
||||
);
|
||||
|
@ -73,7 +73,6 @@ ImageContainer.propTypes = {
|
|||
imageUrl: PropTypes.string,
|
||||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
useMarkdown: PropTypes.bool,
|
||||
showAttachment: PropTypes.func,
|
||||
theme: PropTypes.string,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
|
|
|
@ -79,7 +79,7 @@ const Title = React.memo(({ attachment, timeFormat, theme }) => {
|
|||
});
|
||||
|
||||
const Description = React.memo(({
|
||||
attachment, baseUrl, user, getCustomEmoji, useMarkdown, theme
|
||||
attachment, baseUrl, user, getCustomEmoji, theme
|
||||
}) => {
|
||||
const text = attachment.text || attachment.title;
|
||||
if (!text) {
|
||||
|
@ -91,7 +91,6 @@ const Description = React.memo(({
|
|||
baseUrl={baseUrl}
|
||||
username={user.username}
|
||||
getCustomEmoji={getCustomEmoji}
|
||||
useMarkdown={useMarkdown}
|
||||
theme={theme}
|
||||
/>
|
||||
);
|
||||
|
@ -125,7 +124,7 @@ const Fields = React.memo(({ attachment, theme }) => {
|
|||
}, (prevProps, nextProps) => isEqual(prevProps.attachment.fields, nextProps.attachment.fields) && prevProps.theme === nextProps.theme);
|
||||
|
||||
const Reply = React.memo(({
|
||||
attachment, timeFormat, baseUrl, user, index, getCustomEmoji, useMarkdown, split, theme
|
||||
attachment, timeFormat, baseUrl, user, index, getCustomEmoji, split, theme
|
||||
}) => {
|
||||
if (!attachment) {
|
||||
return null;
|
||||
|
@ -164,7 +163,6 @@ const Reply = React.memo(({
|
|||
baseUrl={baseUrl}
|
||||
user={user}
|
||||
getCustomEmoji={getCustomEmoji}
|
||||
useMarkdown={useMarkdown}
|
||||
theme={theme}
|
||||
/>
|
||||
<Fields attachment={attachment} theme={theme} />
|
||||
|
@ -179,7 +177,6 @@ Reply.propTypes = {
|
|||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
index: PropTypes.number,
|
||||
useMarkdown: PropTypes.bool,
|
||||
theme: PropTypes.string,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
split: PropTypes.bool
|
||||
|
@ -197,7 +194,6 @@ Description.propTypes = {
|
|||
attachment: PropTypes.object,
|
||||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
useMarkdown: PropTypes.bool,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
theme: PropTypes.string
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
const Video = React.memo(({
|
||||
file, baseUrl, user, useMarkdown, showAttachment, getCustomEmoji, theme
|
||||
file, baseUrl, user, showAttachment, getCustomEmoji, theme
|
||||
}) => {
|
||||
if (!baseUrl) {
|
||||
return null;
|
||||
|
@ -54,7 +54,7 @@ const Video = React.memo(({
|
|||
color={themes[theme].buttonText}
|
||||
/>
|
||||
</Touchable>
|
||||
<Markdown msg={file.description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />
|
||||
<Markdown msg={file.description} baseUrl={baseUrl} username={user.username} getCustomEmoji={getCustomEmoji} theme={theme} />
|
||||
</>
|
||||
);
|
||||
}, (prevProps, nextProps) => isEqual(prevProps.file, nextProps.file) && prevProps.theme === nextProps.theme);
|
||||
|
@ -63,7 +63,6 @@ Video.propTypes = {
|
|||
file: PropTypes.object,
|
||||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.object,
|
||||
useMarkdown: PropTypes.bool,
|
||||
showAttachment: PropTypes.func,
|
||||
getCustomEmoji: PropTypes.func,
|
||||
theme: PropTypes.string
|
||||
|
|
|
@ -28,7 +28,6 @@ class MessageContainer extends React.Component {
|
|||
isReadReceiptEnabled: PropTypes.bool,
|
||||
isThreadRoom: PropTypes.bool,
|
||||
useRealName: PropTypes.bool,
|
||||
useMarkdown: PropTypes.bool,
|
||||
autoTranslateRoom: PropTypes.bool,
|
||||
autoTranslateLanguage: PropTypes.string,
|
||||
status: PropTypes.number,
|
||||
|
@ -227,7 +226,7 @@ class MessageContainer extends React.Component {
|
|||
|
||||
render() {
|
||||
const {
|
||||
item, user, style, archived, baseUrl, useRealName, broadcast, fetchThreadName, customThreadTimeFormat, showAttachment, timeFormat, useMarkdown, isReadReceiptEnabled, autoTranslateRoom, autoTranslateLanguage, navToRoomInfo, getCustomEmoji, isThreadRoom, callJitsi, blockAction, rid, theme
|
||||
item, user, style, archived, baseUrl, useRealName, broadcast, fetchThreadName, customThreadTimeFormat, showAttachment, timeFormat, isReadReceiptEnabled, autoTranslateRoom, autoTranslateLanguage, navToRoomInfo, getCustomEmoji, isThreadRoom, callJitsi, blockAction, rid, theme
|
||||
} = this.props;
|
||||
const {
|
||||
id, msg, ts, attachments, urls, reactions, t, avatar, u, alias, editedBy, role, drid, dcount, dlm, tmid, tcount, tlm, tmsg, mentions, channels, unread, blocks, autoTranslate: autoTranslateMessage
|
||||
|
@ -272,7 +271,6 @@ class MessageContainer extends React.Component {
|
|||
tcount={tcount}
|
||||
tlm={tlm}
|
||||
tmsg={tmsg}
|
||||
useMarkdown={useMarkdown}
|
||||
fetchThreadName={fetchThreadName}
|
||||
mentions={mentions}
|
||||
channels={channels}
|
||||
|
|
|
@ -183,7 +183,6 @@ export default {
|
|||
EMAIL: 'EMAIL',
|
||||
email: 'Email',
|
||||
Enable_Auto_Translate: 'Automatische Übersetzung aktivieren',
|
||||
Enable_markdown: 'Markdown aktivieren',
|
||||
Enable_notifications: 'Benachrichtigungen aktivieren',
|
||||
Everyone_can_access_this_channel: 'Jeder kann auf diesen Kanal zugreifen',
|
||||
erasing_room: 'lösche Raum',
|
||||
|
|
|
@ -183,7 +183,6 @@ export default {
|
|||
EMAIL: 'EMAIL',
|
||||
email: 'e-mail',
|
||||
Enable_Auto_Translate: 'Enable Auto-Translate',
|
||||
Enable_markdown: 'Enable markdown',
|
||||
Enable_notifications: 'Enable notifications',
|
||||
Everyone_can_access_this_channel: 'Everyone can access this channel',
|
||||
erasing_room: 'erasing room',
|
||||
|
|
|
@ -176,7 +176,6 @@ export default {
|
|||
EMAIL: 'EMAIL',
|
||||
email: 'e-mail',
|
||||
Enable_Auto_Translate: 'Permitir Auto-Translate',
|
||||
Enable_markdown: 'Permitir markdown',
|
||||
Enable_notifications: 'Permitir notificaciones',
|
||||
Everyone_can_access_this_channel: 'Todos los usuarios pueden acceder a este canal',
|
||||
erasing_room: 'eliminando sala',
|
||||
|
|
|
@ -179,7 +179,6 @@ export default {
|
|||
EMAIL: 'E-MAIL',
|
||||
email: 'e-mail',
|
||||
Enable_Auto_Translate: 'Abilita traduzione automatica',
|
||||
Enable_markdown: 'Abilita Markdown',
|
||||
Enable_notifications: 'Abilita notifiche',
|
||||
Everyone_can_access_this_channel: 'Tutti hanno accesso a questo canale',
|
||||
erasing_room: 'cancellazione stanza',
|
||||
|
|
|
@ -179,7 +179,6 @@ export default {
|
|||
EMAIL: 'EMAIL',
|
||||
email: 'e-mail',
|
||||
Enable_Auto_Translate: 'Zet Auto-Translate aan',
|
||||
Enable_markdown: 'Zet markdown aan',
|
||||
Enable_notifications: 'Zet notifications aan',
|
||||
Everyone_can_access_this_channel: 'Iedereen kan bij dit kanaal',
|
||||
erasing_room: 'kamer legen',
|
||||
|
|
|
@ -177,7 +177,6 @@ export default {
|
|||
Email_or_password_field_is_empty: 'Email ou senha estão vazios',
|
||||
Email: 'Email',
|
||||
email: 'e-mail',
|
||||
Enable_markdown: 'Habilitar markdown',
|
||||
Enable_notifications: 'Habilitar notificações',
|
||||
Everyone_can_access_this_channel: 'Todos podem acessar este canal',
|
||||
Error_uploading: 'Erro subindo',
|
||||
|
|
|
@ -171,7 +171,6 @@ export default {
|
|||
EMAIL: 'EMAIL',
|
||||
email: 'e-mail',
|
||||
Enable_Auto_Translate: 'Включить автоперевод',
|
||||
Enable_markdown: 'Включить markdown',
|
||||
Enable_notifications: 'Включить уведомления',
|
||||
Everyone_can_access_this_channel: 'Каждый может получить доступ к этому каналу',
|
||||
erasing_room: 'стирание комнаты',
|
||||
|
|
|
@ -50,7 +50,6 @@ import I18n from '../i18n';
|
|||
|
||||
const TOKEN_KEY = 'reactnativemeteor_usertoken';
|
||||
const SORT_PREFS_KEY = 'RC_SORT_PREFS_KEY';
|
||||
export const MARKDOWN_KEY = 'RC_MARKDOWN_KEY';
|
||||
export const THEME_PREFERENCES_KEY = 'RC_THEME_PREFERENCES_KEY';
|
||||
export const CRASH_REPORT_KEY = 'RC_CRASH_REPORT_KEY';
|
||||
const returnAnArray = obj => obj || [];
|
||||
|
@ -884,13 +883,6 @@ const RocketChat = {
|
|||
// RC 0.51.0
|
||||
return this.sdk.methodCall('setAvatarFromService', data, contentType, service);
|
||||
},
|
||||
async getUseMarkdown() {
|
||||
const useMarkdown = await AsyncStorage.getItem(MARKDOWN_KEY);
|
||||
if (useMarkdown === null) {
|
||||
return true;
|
||||
}
|
||||
return JSON.parse(useMarkdown);
|
||||
},
|
||||
async getAllowCrashReport() {
|
||||
const allowCrashReport = await AsyncStorage.getItem(CRASH_REPORT_KEY);
|
||||
if (allowCrashReport === null) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import createChannel from './createChannel';
|
|||
import app from './app';
|
||||
import sortPreferences from './sortPreferences';
|
||||
import notification from './notification';
|
||||
import markdown from './markdown';
|
||||
import share from './share';
|
||||
import crashReport from './crashReport';
|
||||
import customEmojis from './customEmojis';
|
||||
|
@ -28,7 +27,6 @@ export default combineReducers({
|
|||
rooms,
|
||||
sortPreferences,
|
||||
notification,
|
||||
markdown,
|
||||
share,
|
||||
crashReport,
|
||||
customEmojis,
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
import { TOGGLE_MARKDOWN } from '../actions/actionsTypes';
|
||||
|
||||
const initialState = {
|
||||
useMarkdown: true
|
||||
};
|
||||
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case TOGGLE_MARKDOWN:
|
||||
return {
|
||||
useMarkdown: action.payload
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
|
@ -7,7 +7,6 @@ import RNBootSplash from 'react-native-bootsplash';
|
|||
import * as actions from '../actions';
|
||||
import { selectServerRequest } from '../actions/server';
|
||||
import { setAllPreferences } from '../actions/sortPreferences';
|
||||
import { toggleMarkdown } from '../actions/markdown';
|
||||
import { toggleCrashReport } from '../actions/crashReport';
|
||||
import { APP } from '../actions/actionsTypes';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
|
@ -24,9 +23,6 @@ export const initLocalSettings = function* initLocalSettings() {
|
|||
const sortPreferences = yield RocketChat.getSortPreferences();
|
||||
yield put(setAllPreferences(sortPreferences));
|
||||
|
||||
const useMarkdown = yield RocketChat.getUseMarkdown();
|
||||
yield put(toggleMarkdown(useMarkdown));
|
||||
|
||||
const allowCrashReport = yield RocketChat.getAllowCrashReport();
|
||||
yield put(toggleCrashReport(allowCrashReport));
|
||||
};
|
||||
|
|
|
@ -175,7 +175,6 @@ class RoomInfoView extends React.Component {
|
|||
<View style={styles.item}>
|
||||
<Text style={[styles.itemLabel, { color: themes[theme].auxiliaryText }]}>{I18n.t(camelize(key))}</Text>
|
||||
<Markdown
|
||||
useMarkdown
|
||||
msg={room[key] ? room[key] : `__${ I18n.t(`No_${ key }_provided`) }__`}
|
||||
theme={theme}
|
||||
/>
|
||||
|
|
|
@ -146,7 +146,6 @@ class RoomView extends React.Component {
|
|||
baseUrl: PropTypes.string,
|
||||
customEmojis: PropTypes.object,
|
||||
screenProps: PropTypes.object,
|
||||
useMarkdown: PropTypes.bool,
|
||||
theme: PropTypes.string,
|
||||
replyBroadcast: PropTypes.func
|
||||
};
|
||||
|
@ -726,7 +725,7 @@ class RoomView extends React.Component {
|
|||
renderItem = (item, previousItem) => {
|
||||
const { room, lastOpen, canAutoTranslate } = this.state;
|
||||
const {
|
||||
user, Message_GroupingPeriod, Message_TimeFormat, useRealName, baseUrl, useMarkdown, Message_Read_Receipt_Enabled, theme
|
||||
user, Message_GroupingPeriod, Message_TimeFormat, useRealName, baseUrl, Message_Read_Receipt_Enabled, theme
|
||||
} = this.props;
|
||||
let dateSeparator = null;
|
||||
let showUnreadSeparator = false;
|
||||
|
@ -767,7 +766,6 @@ class RoomView extends React.Component {
|
|||
Message_GroupingPeriod={Message_GroupingPeriod}
|
||||
timeFormat={Message_TimeFormat}
|
||||
useRealName={useRealName}
|
||||
useMarkdown={useMarkdown}
|
||||
isReadReceiptEnabled={Message_Read_Receipt_Enabled}
|
||||
autoTranslateRoom={canAutoTranslate && room.autoTranslate}
|
||||
autoTranslateLanguage={room.autoTranslateLanguage}
|
||||
|
@ -805,7 +803,6 @@ class RoomView extends React.Component {
|
|||
return (
|
||||
<BorderlessButton style={[styles.announcementTextContainer, { backgroundColor: themes[theme].bannerBackground }]} key='room-user-status' testID='room-user-status' onPress={() => this.toggleAnnouncementModal(true)}>
|
||||
<Markdown
|
||||
useMarkdown
|
||||
msg={room.announcement}
|
||||
theme={theme}
|
||||
numberOfLines={1}
|
||||
|
@ -834,7 +831,6 @@ class RoomView extends React.Component {
|
|||
<Text style={[styles.announcementTitle, { color: themes[theme].auxiliaryText }]}>{I18n.t('Announcement')}</Text>
|
||||
<ScrollView style={styles.modalScrollView}>
|
||||
<Markdown
|
||||
useMarkdown
|
||||
msg={room.announcement}
|
||||
theme={theme}
|
||||
/>
|
||||
|
@ -1007,7 +1003,6 @@ const mapStateToProps = state => ({
|
|||
isAuthenticated: state.login.isAuthenticated,
|
||||
Message_GroupingPeriod: state.settings.Message_GroupingPeriod,
|
||||
Message_TimeFormat: state.settings.Message_TimeFormat,
|
||||
useMarkdown: state.markdown.useMarkdown,
|
||||
customEmojis: state.customEmojis,
|
||||
baseUrl: state.server.server,
|
||||
Message_Read_Receipt_Enabled: state.settings.Message_Read_Receipt_Enabled,
|
||||
|
|
|
@ -7,7 +7,6 @@ import { connect } from 'react-redux';
|
|||
import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import { logout as logoutAction, loginRequest as loginRequestAction } from '../../actions/login';
|
||||
import { toggleMarkdown as toggleMarkdownAction } from '../../actions/markdown';
|
||||
import { toggleCrashReport as toggleCrashReportAction } from '../../actions/crashReport';
|
||||
import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
|
||||
import { DrawerButton, CloseModalButton } from '../../containers/HeaderButton';
|
||||
|
@ -16,7 +15,7 @@ import ListItem from '../../containers/ListItem';
|
|||
import { DisclosureImage } from '../../containers/DisclosureIndicator';
|
||||
import Separator from '../../containers/Separator';
|
||||
import I18n from '../../i18n';
|
||||
import RocketChat, { MARKDOWN_KEY, CRASH_REPORT_KEY } from '../../lib/rocketchat';
|
||||
import RocketChat, { CRASH_REPORT_KEY } from '../../lib/rocketchat';
|
||||
import {
|
||||
getReadableVersion, getDeviceModel, isAndroid
|
||||
} from '../../utils/deviceInfo';
|
||||
|
@ -77,9 +76,7 @@ class SettingsView extends React.Component {
|
|||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
server: PropTypes.object,
|
||||
useMarkdown: PropTypes.bool,
|
||||
allowCrashReport: PropTypes.bool,
|
||||
toggleMarkdown: PropTypes.func,
|
||||
toggleCrashReport: PropTypes.func,
|
||||
theme: PropTypes.string,
|
||||
split: PropTypes.bool,
|
||||
|
@ -118,12 +115,6 @@ class SettingsView extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
toggleMarkdown = (value) => {
|
||||
AsyncStorage.setItem(MARKDOWN_KEY, JSON.stringify(value));
|
||||
const { toggleMarkdown } = this.props;
|
||||
toggleMarkdown(value);
|
||||
}
|
||||
|
||||
toggleCrashReport = (value) => {
|
||||
AsyncStorage.setItem(CRASH_REPORT_KEY, JSON.stringify(value));
|
||||
const { toggleCrashReport } = this.props;
|
||||
|
@ -185,17 +176,6 @@ class SettingsView extends React.Component {
|
|||
return <DisclosureImage theme={theme} />;
|
||||
}
|
||||
|
||||
renderMarkdownSwitch = () => {
|
||||
const { useMarkdown } = this.props;
|
||||
return (
|
||||
<Switch
|
||||
value={useMarkdown}
|
||||
trackColor={SWITCH_TRACK_COLOR}
|
||||
onValueChange={this.toggleMarkdown}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderCrashReportSwitch = () => {
|
||||
const { allowCrashReport } = this.props;
|
||||
return (
|
||||
|
@ -323,13 +303,6 @@ class SettingsView extends React.Component {
|
|||
|
||||
<SectionSeparator theme={theme} />
|
||||
|
||||
<ListItem
|
||||
title={I18n.t('Enable_markdown')}
|
||||
testID='settings-view-markdown'
|
||||
right={() => this.renderMarkdownSwitch()}
|
||||
theme={theme}
|
||||
/>
|
||||
<Separator theme={theme} />
|
||||
<ListItem
|
||||
title={I18n.t('Send_crash_report')}
|
||||
testID='settings-view-crash-report'
|
||||
|
@ -370,14 +343,12 @@ class SettingsView extends React.Component {
|
|||
const mapStateToProps = state => ({
|
||||
server: state.server,
|
||||
token: getUserSelector(state).token,
|
||||
useMarkdown: state.markdown.useMarkdown,
|
||||
allowCrashReport: state.crashReport.allowCrashReport
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
logout: () => dispatch(logoutAction()),
|
||||
loginRequest: (...params) => dispatch(loginRequestAction(...params)),
|
||||
toggleMarkdown: params => dispatch(toggleMarkdownAction(params)),
|
||||
toggleCrashReport: params => dispatch(toggleCrashReportAction(params)),
|
||||
appStart: params => dispatch(appStartAction(params))
|
||||
});
|
||||
|
|
|
@ -45,10 +45,6 @@ describe('Settings screen', () => {
|
|||
await expect(element(by.id('settings-view-server-version'))).toExist();
|
||||
});
|
||||
|
||||
it('should have enable markdown', async() => {
|
||||
await expect(element(by.id('settings-view-markdown'))).toExist();
|
||||
});
|
||||
|
||||
after(async() => {
|
||||
takeScreenshot();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue