Merge branch 'develop' into single-server

This commit is contained in:
Diego Mello 2020-12-21 13:10:35 -03:00
commit f0ee2d62eb
14 changed files with 279 additions and 77 deletions

View File

@ -248,7 +248,7 @@ commands:
bundle exec fastlane ios build_official
else
if [[ $KEYSTORE ]]; then
bundle exec fastlane ios release # TODO: rename
bundle exec fastlane ios build_experimental
else
bundle exec fastlane ios build_fork
fi

View File

@ -10220,6 +10220,80 @@ exports[`Storyshots Markdown list Markdown 1`] = `
</Text>
</Text>
</View>
<Text
style={
Array [
Object {
"fontSize": 20,
"fontWeight": "300",
"marginLeft": 10,
"marginVertical": 30,
},
Object {
"color": "#0d0e12",
},
Object {
"marginHorizontal": 10,
"marginVertical": 10,
},
]
}
>
Sequential empty spaces
</Text>
<View
style={
Object {
"marginHorizontal": 15,
}
}
>
<Text
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
<Text
accessibilityLabel="a b c"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
a b c
</Text>
</Text>
</View>
<Text
style={
Array [
@ -10382,6 +10456,26 @@ exports[`Storyshots Markdown list Markdown 1`] = `
>
a b c d e
</Text>
<Text
accessibilityLabel="a b c"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
]
}
>
a b c
</Text>
<Text
accessibilityLabel="@rocket.cat @name1 @all @here @unknown #general #unknown"
numberOfLines={1}
@ -10480,7 +10574,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#DB0C27",
"color": "#F5455C",
},
]
}
@ -10526,7 +10620,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -10571,7 +10665,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -10616,7 +10710,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -10727,7 +10821,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#DB0C27",
"color": "#F5455C",
},
]
}
@ -10773,7 +10867,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -10818,7 +10912,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -10863,7 +10957,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -10974,7 +11068,7 @@ exports[`Storyshots Markdown list Markdown 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -17308,7 +17402,7 @@ exports[`Storyshots Message list message 1`] = `
"marginTop": 6,
}
}
testID="message-thread-replied-on-Thread with emoji🙂 😂"
testID="message-thread-replied-on-Thread with emoji :) :joy:"
>
<Text
allowFontScaling={false}
@ -17334,9 +17428,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Thread with emoji🙂 😂"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -21634,7 +21739,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -21681,7 +21786,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DB0C27",
"color": "#F5455C",
},
]
}
@ -21727,7 +21832,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -21773,7 +21878,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -21820,7 +21925,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -22050,7 +22155,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -22097,7 +22202,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DB0C27",
"color": "#F5455C",
},
]
}
@ -22143,7 +22248,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -22189,7 +22294,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#E26D0E",
"color": "#F38C39",
},
]
}
@ -22236,7 +22341,7 @@ exports[`Storyshots Message list message 1`] = `
"textAlign": "left",
},
Object {
"color": "#DFAC00",
"color": "#F3BE08",
},
]
}
@ -33583,9 +33688,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="How are you?"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -33786,7 +33902,7 @@ exports[`Storyshots Message list message 1`] = `
"marginTop": 6,
}
}
testID="message-thread-replied-on-Thread with emoji🙂 😂"
testID="message-thread-replied-on-Thread with emoji :) :joy:"
>
<Text
allowFontScaling={false}
@ -33812,9 +33928,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Thread with emoji🙂 😂"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -34015,7 +34142,7 @@ exports[`Storyshots Message list message 1`] = `
"marginTop": 6,
}
}
testID="message-thread-replied-on-Markdown: link block code"
testID="message-thread-replied-on-Markdown: [link](http://www.google.com/) \`\`\`block code\`\`\`"
>
<Text
allowFontScaling={false}
@ -34041,9 +34168,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Markdown: link block code"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -34270,9 +34408,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -34499,9 +34648,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="How are you?"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -34728,9 +34888,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -34957,9 +35128,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="Thread with attachment"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,
@ -36039,9 +36221,20 @@ exports[`Storyshots Message list message 1`] = `
</Text>
<Text
accessibilityLabel="How are you?"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
Object {
"backgroundColor": "transparent",
"flex": 1,

View File

@ -11,13 +11,11 @@ export const SWITCH_TRACK_COLOR = {
};
const mentions = {
unreadBackground: '#6C727A',
tunreadBackground: '#1d74f5',
mentionMeColor: '#DB0C27',
mentionMeBackground: '#F5455C',
mentionGroupColor: '#E26D0E',
mentionGroupBackground: '#F38C39',
mentionOtherColor: '#DFAC00'
unreadColor: '#6C727A',
tunreadColor: '#1d74f5',
mentionMeColor: '#F5455C',
mentionGroupColor: '#F38C39',
mentionOtherColor: '#F3BE08'
};
export const themes = {

View File

@ -384,6 +384,8 @@ class Markdown extends PureComponent {
if (preview) {
m = shortnameToUnicode(m);
// Removes sequential empty spaces
m = m.replace(/\s+/g, ' ');
m = removeMarkdown(m);
m = m.replace(/\n+/g, ' ');
return (

View File

@ -1,13 +1,12 @@
import React from 'react';
import { View, Text } from 'react-native';
import removeMarkdown from 'remove-markdown';
import { View } from 'react-native';
import PropTypes from 'prop-types';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import { CustomIcon } from '../../lib/Icons';
import styles from './styles';
import { themes } from '../../constants/colors';
import I18n from '../../i18n';
import Markdown from '../markdown';
const RepliedThread = React.memo(({
tmid, tmsg, isHeader, fetchThreadName, id, isEncrypted, theme
@ -21,8 +20,7 @@ const RepliedThread = React.memo(({
return null;
}
let msg = shortnameToUnicode(tmsg);
msg = removeMarkdown(msg);
let msg = tmsg;
if (isEncrypted) {
msg = I18n.t('Encrypted_message');
@ -31,7 +29,13 @@ const RepliedThread = React.memo(({
return (
<View style={styles.repliedThread} testID={`message-thread-replied-on-${ msg }`}>
<CustomIcon name='threads' size={20} style={styles.repliedThreadIcon} color={themes[theme].tintColor} />
<Text style={[styles.repliedThreadName, { color: themes[theme].tintColor }]} numberOfLines={1}>{msg}</Text>
<Markdown
msg={msg}
theme={theme}
style={[styles.repliedThreadName, { color: themes[theme].tintColor }]}
preview
numberOfLines={1}
/>
<View style={styles.repliedThreadDisclosure}>
<CustomIcon
name='chevron-right'

View File

@ -7,14 +7,14 @@ export const getUnreadStyle = ({
return {};
}
let backgroundColor = themes[theme].unreadBackground;
let backgroundColor = themes[theme].unreadColor;
const color = themes[theme].buttonText;
if (userMentions > 0 || tunreadUser?.length) {
backgroundColor = themes[theme].mentionMeBackground;
backgroundColor = themes[theme].mentionMeColor;
} else if (groupMentions > 0 || tunreadGroup?.length) {
backgroundColor = themes[theme].mentionGroupBackground;
backgroundColor = themes[theme].mentionGroupColor;
} else if (tunread?.length > 0) {
backgroundColor = themes[theme].tunreadBackground;
backgroundColor = themes[theme].tunreadColor;
}
return {

View File

@ -13,7 +13,7 @@ const testsForTheme = (theme) => {
expect(getUnreadStyleUtil({
unread: 1
})).toEqual({
backgroundColor: themes[theme].unreadBackground,
backgroundColor: themes[theme].unreadColor,
color: themes[theme].buttonText
});
});
@ -22,7 +22,7 @@ const testsForTheme = (theme) => {
expect(getUnreadStyleUtil({
tunread: [1]
})).toEqual({
backgroundColor: themes[theme].tunreadBackground,
backgroundColor: themes[theme].tunreadColor,
color: themes[theme].buttonText
});
});
@ -32,7 +32,7 @@ const testsForTheme = (theme) => {
unread: 1,
userMentions: 1
})).toEqual({
backgroundColor: themes[theme].mentionMeBackground,
backgroundColor: themes[theme].mentionMeColor,
color: themes[theme].buttonText
});
});
@ -42,7 +42,7 @@ const testsForTheme = (theme) => {
unread: 1,
groupMentions: 1
})).toEqual({
backgroundColor: themes[theme].mentionGroupBackground,
backgroundColor: themes[theme].mentionGroupColor,
color: themes[theme].buttonText
});
});
@ -54,7 +54,7 @@ const testsForTheme = (theme) => {
groupMentions: 1,
tunread: [1]
})).toEqual({
backgroundColor: themes[theme].mentionMeBackground,
backgroundColor: themes[theme].mentionMeColor,
color: themes[theme].buttonText
});
expect(getUnreadStyleUtil({
@ -62,14 +62,14 @@ const testsForTheme = (theme) => {
groupMentions: 1,
tunread: [1]
})).toEqual({
backgroundColor: themes[theme].mentionGroupBackground,
backgroundColor: themes[theme].mentionGroupColor,
color: themes[theme].buttonText
});
expect(getUnreadStyleUtil({
unread: 1,
tunread: [1]
})).toEqual({
backgroundColor: themes[theme].tunreadBackground,
backgroundColor: themes[theme].tunreadColor,
color: themes[theme].buttonText
});
});

View File

@ -34,13 +34,13 @@ export const formatDateThreads = date => moment(date).calendar(null, {
export const getBadgeColor = ({ subscription, messageId, theme }) => {
if (subscription?.tunreadUser?.includes(messageId)) {
return themes[theme].mentionMeBackground;
return themes[theme].mentionMeColor;
}
if (subscription?.tunreadGroup?.includes(messageId)) {
return themes[theme].mentionGroupBackground;
return themes[theme].mentionGroupColor;
}
if (subscription?.tunread?.includes(messageId)) {
return themes[theme].tunreadBackground;
return themes[theme].tunreadColor;
}
};

View File

@ -53,20 +53,16 @@ class List extends React.Component {
this.count = 0;
this.needsFetch = false;
this.mounted = false;
this.animated = false;
this.state = {
loading: true,
end: false,
messages: [],
refreshing: false,
animated: false
refreshing: false
};
this.query();
this.unsubscribeFocus = props.navigation.addListener('focus', () => {
if (this.mounted) {
this.setState({ animated: true });
} else {
this.state.animated = true;
}
this.animated = true;
});
console.timeEnd(`${ this.constructor.name } init`);
}
@ -290,8 +286,7 @@ class List extends React.Component {
// eslint-disable-next-line react/sort-comp
update = () => {
const { animated } = this.state;
if (animated) {
if (this.animated) {
animateNextTransition();
}
this.forceUpdate();

View File

@ -1008,12 +1008,7 @@ class RoomView extends React.Component {
renderActions = () => {
const { room, readOnly } = this.state;
const {
user, navigation
} = this.props;
if (!navigation.isFocused()) {
return null;
}
const { user } = this.props;
return (
<>
<MessageActions

View File

@ -105,21 +105,21 @@ stories.add('content', () => (
stories.add('badge', () => (
<>
<BaseItem
badgeColor={themes.light.mentionMeBackground}
badgeColor={themes.light.mentionMeColor}
/>
<List.Separator />
<BaseItem
badgeColor={themes.light.mentionGroupBackground}
badgeColor={themes.light.mentionGroupColor}
/>
<List.Separator />
<BaseItem
badgeColor={themes.light.tunreadBackground}
badgeColor={themes.light.tunreadColor}
/>
<BaseItem
item={{
msg: longText
}}
badgeColor={themes.light.tunreadBackground}
badgeColor={themes.light.tunreadColor}
/>
</>
));
@ -129,7 +129,7 @@ const ThemeStory = ({ theme }) => (
value={{ theme }}
>
<BaseItem
badgeColor={themes[theme].mentionMeBackground}
badgeColor={themes[theme].mentionMeColor}
/>
</ThemeContext.Provider>
);

View File

@ -42,7 +42,7 @@ platform :ios do
end
desc "Build Experimental app"
lane :release do
lane :build_experimental do
api_key = app_store_connect_api_key(
key_id: "F296L2294Y",
issuer_id: "69a6de8e-75cf-47e3-e053-5b8c7c11a4d1",
@ -60,11 +60,6 @@ platform :ios do
)
end
desc "Build fork app"
lane :build_fork do
gym(scheme: "RocketChatRN", workspace: "RocketChatRN.xcworkspace", skip_codesigning: true, skip_archive: true)
end
desc "Build Official app"
lane :build_official do
sh "../../scripts/prepare_ios_official.sh"
@ -100,6 +95,11 @@ platform :ios do
)
end
desc "Build fork app"
lane :build_fork do
gym(scheme: "RocketChatRN", workspace: "RocketChatRN.xcworkspace", skip_codesigning: true, skip_archive: true)
end
after_all do |lane|
delete_keychain(name: ENV["MATCH_KEYCHAIN_NAME"])
end

View File

@ -26,6 +26,7 @@ d
e`;
const sequentialEmptySpacesText = 'a b c';
const getCustomEmoji = (content) => {
const customEmoji = {
@ -69,6 +70,14 @@ export default ({ theme }) => {
/>
</View>
<StoriesSeparator style={styles.separator} title='Sequential empty spaces' theme={theme} />
<View style={styles.container}>
<Markdown
msg={sequentialEmptySpacesText}
theme={theme}
/>
</View>
<StoriesSeparator style={styles.separator} title='Edited' theme={theme} />
<View style={styles.container}>
<Markdown
@ -92,6 +101,12 @@ export default ({ theme }) => {
numberOfLines={1}
preview
/>
<Markdown
msg={sequentialEmptySpacesText}
theme={theme}
numberOfLines={1}
preview
/>
<Markdown
msg='@rocket.cat @name1 @all @here @unknown #general #unknown'
theme={theme}

View File

@ -64,7 +64,7 @@ const messageDecorator = story => (
onReactionPress: () => {},
onDiscussionPress: () => {},
onReactionLongPress: () => {},
threadBadgeColor: themes.light.tunreadBackground
threadBadgeColor: themes.light.tunreadColor
}}
>
{story()}