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