Skip to content

Commit d3e0992

Browse files
authored
chore: Merge 4.44.1 into master (#5433)
2 parents 087c8d2 + d600f1f commit d3e0992

File tree

32 files changed

+237
-80
lines changed

32 files changed

+237
-80
lines changed

.storybook/storybook.requires.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const getStories = () => {
2929
require("../app/containers/markdown/Markdown.stories.tsx"),
3030
require("../app/containers/markdown/new/NewMarkdown.stories.tsx"),
3131
require("../app/containers/message/Components/CollapsibleQuote/CollapsibleQuote.stories.tsx"),
32+
require("../app/containers/CollapsibleText/CollapsibleText.stories.tsx"),
3233
require("../app/containers/message/Message.stories.tsx"),
3334
require("../app/containers/ReactionsList/ReactionsList.stories.tsx"),
3435
require("../app/containers/RoomHeader/RoomHeader.stories.tsx"),

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# Rocket.Chat Mobile
22

3-
[![Project Dependencies](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative.svg)](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative)
4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bb15e2392a71473ea59d3f634f35c54e)](https://www.codacy.com/app/RocketChat/Rocket.Chat.ReactNative?utm_source=github.com&utm_medium=referral&utm_content=RocketChat/Rocket.Chat.ReactNative&utm_campaign=badger)
5-
[![codecov](https://codecov.io/gh/RocketChat/Rocket.Chat.ReactNative/branch/master/graph/badge.svg)](https://codecov.io/gh/RocketChat/Rocket.Chat.ReactNative)
6-
[![CodeFactor](https://www.codefactor.io/repository/github/rocketchat/rocket.chat.reactnative/badge)](https://www.codefactor.io/repository/github/rocketchat/rocket.chat.reactnative)
7-
83
- **Supported server versions:** 0.70.0+
94
- **Supported iOS versions**: 12+
105
- **Supported Android versions**: 6.0+
@@ -35,7 +30,7 @@ Do you want to make the app run on your own server only? [Follow our whitelabel
3530

3631
## Engage with us
3732
### Share your story
38-
We’d love to hear about [your experience](https://survey.zohopublic.com/zs/e4BUFG) and potentially feature it on our [blog](https://rocket.chat/case-studies/?utm_source=github&utm_medium=readme&utm_campaign=community).
33+
We’d love to hear about [your experience](https://survey.zohopublic.com/zs/e4BUFG) and potentially feature it on our [blog](https://www.rocket.chat/blog?utm_source=github&utm_medium=readme&utm_campaign=community).
3934

4035
### Subscribe for Updates
4136
Once a month our marketing team releases an email update with news about product releases, company related topics, events and use cases. [Sign up!](https://rocket.chat/newsletter/?utm_source=github&utm_medium=readme&utm_campaign=community)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Storyshots Collapsible Text Item 1`] = `"{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":{\\"padding\\":20}},\\"children\\":[{\\"type\\":\\"Text\\",\\"props\\":{\\"accessibilityLabel\\":\\"Lorem ipsum dolor sit amet\\",\\"style\\":[{\\"fontSize\\":16,\\"textAlign\\":\\"left\\",\\"backgroundColor\\":\\"transparent\\",\\"fontFamily\\":\\"Inter\\",\\"fontWeight\\":\\"400\\",\\"textAlignVertical\\":\\"center\\"},{\\"color\\":\\"#2f343d\\",\\"height\\":0}],\\"testID\\":\\"collapsible-text-Lorem ipsum dolor sit amet\\"},\\"children\\":[\\"Lorem ipsum dolor sit amet\\"]},{\\"type\\":\\"Text\\",\\"props\\":{\\"accessibilityLabel\\":\\"linesToTruncate: 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\",\\"style\\":[{\\"fontSize\\":16,\\"textAlign\\":\\"left\\",\\"backgroundColor\\":\\"transparent\\",\\"fontFamily\\":\\"Inter\\",\\"fontWeight\\":\\"400\\",\\"textAlignVertical\\":\\"center\\"},{\\"color\\":\\"#2f343d\\",\\"height\\":0}],\\"testID\\":\\"collapsible-text-linesToTruncate: 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\"},\\"children\\":[\\"linesToTruncate: 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\"]},{\\"type\\":\\"Text\\",\\"props\\":{\\"accessibilityLabel\\":\\"linesToTruncate: 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\",\\"style\\":[{\\"fontSize\\":16,\\"textAlign\\":\\"left\\",\\"backgroundColor\\":\\"transparent\\",\\"fontFamily\\":\\"Inter\\",\\"fontWeight\\":\\"400\\",\\"textAlignVertical\\":\\"center\\"},{\\"color\\":\\"#2f343d\\",\\"height\\":0}],\\"testID\\":\\"collapsible-text-linesToTruncate: 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\"},\\"children\\":[\\"linesToTruncate: 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.\\"]}]}"`;

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ android {
147147
minSdkVersion rootProject.ext.minSdkVersion
148148
targetSdkVersion rootProject.ext.targetSdkVersion
149149
versionCode VERSIONCODE as Integer
150-
versionName "4.44.0"
150+
versionName "4.44.1"
151151
vectorDrawables.useSupportLibrary = true
152152
if (!isFoss) {
153153
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import { View } from 'react-native';
3+
4+
import CollapsibleText from '.';
5+
6+
const smallText = 'Lorem ipsum dolor sit amet';
7+
8+
const text120 =
9+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel vestibulum neque. Proin dignissim neque in urna nec.';
10+
11+
export default {
12+
title: 'Collapsible Text'
13+
};
14+
15+
export const Item = () => (
16+
<View style={{ padding: 20 }}>
17+
<CollapsibleText linesToTruncate={1} msg={`${smallText}`} />
18+
<CollapsibleText linesToTruncate={1} msg={`linesToTruncate: 1 - ${text120}`} />
19+
<CollapsibleText linesToTruncate={2} msg={`linesToTruncate: 2 - ${text120}`} />
20+
</View>
21+
);
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React, { useState } from 'react';
2+
import { TextStyle, Text, StyleSheet } from 'react-native';
3+
4+
import sharedStyles from '../../views/Styles';
5+
import { useTheme } from '../../theme';
6+
import { previewFormatText } from '../markdown/previewFormatText';
7+
import I18n from '../../i18n';
8+
9+
interface ICollapsibleText {
10+
msg?: string;
11+
style?: TextStyle[];
12+
linesToTruncate?: number;
13+
}
14+
15+
const styles = StyleSheet.create({
16+
text: {
17+
fontSize: 16,
18+
...sharedStyles.textRegular,
19+
textAlignVertical: 'center'
20+
},
21+
textInfo: {
22+
fontSize: 14,
23+
...sharedStyles.textRegular
24+
}
25+
});
26+
27+
const CollapsibleText = ({ msg, style = [], linesToTruncate = 1 }: ICollapsibleText) => {
28+
const [truncatedText, setTruncatedText] = useState('');
29+
const [showTruncated, setShowTruncated] = useState(true);
30+
31+
const { colors } = useTheme();
32+
33+
if (!msg) {
34+
return null;
35+
}
36+
37+
const m = previewFormatText(msg);
38+
39+
if (truncatedText && showTruncated) {
40+
return (
41+
<Text testID={`collapsible-text-truncated-${m}`}>
42+
<Text accessibilityLabel={truncatedText} style={[styles.text, { color: colors.bodyText }, ...style]}>
43+
{`${truncatedText}... `}
44+
</Text>
45+
<Text onPress={() => setShowTruncated(false)} style={[styles.textInfo, { color: colors.actionTintColor }]}>
46+
{I18n.t('Show_more')}
47+
</Text>
48+
</Text>
49+
);
50+
}
51+
52+
return (
53+
<Text
54+
accessibilityLabel={m}
55+
style={[styles.text, { color: colors.bodyText, height: !showTruncated ? undefined : 0 }, ...style]}
56+
testID={`collapsible-text-${m}`}
57+
onTextLayout={event => {
58+
const { lines } = event.nativeEvent;
59+
if (lines.length > linesToTruncate) {
60+
const text = lines
61+
.splice(0, linesToTruncate)
62+
.map(line => line.text)
63+
.join('');
64+
const truncatedTextLengthWithShowMore = text.length - (4 + I18n.t('Show_more').length);
65+
const clippedText = text.slice(0, truncatedTextLengthWithShowMore);
66+
setTruncatedText(clippedText);
67+
} else {
68+
setShowTruncated(false);
69+
}
70+
}}
71+
>
72+
{m}
73+
{truncatedText ? (
74+
<Text
75+
testID='collapsible-text-show-less'
76+
onPress={() => setShowTruncated(true)}
77+
style={[styles.textInfo, { color: colors.actionTintColor }]}
78+
>
79+
{` ${I18n.t('Show_less')}`}
80+
</Text>
81+
) : null}
82+
</Text>
83+
);
84+
};
85+
86+
export default CollapsibleText;

app/containers/DirectoryItem/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import RoomTypeIcon from '../RoomTypeIcon';
77
import styles, { ROW_HEIGHT } from './styles';
88
import { themes } from '../../lib/constants';
99
import { TSupportedThemes, useTheme } from '../../theme';
10+
import { MarkdownPreview } from '../markdown';
1011

1112
export { ROW_HEIGHT };
1213

@@ -60,9 +61,11 @@ const DirectoryItem = ({
6061
</Text>
6162
</View>
6263
{description ? (
63-
<Text style={[styles.directoryItemUsername, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
64-
{description}
65-
</Text>
64+
<MarkdownPreview
65+
msg={description}
66+
style={[styles.directoryItemUsername, { color: themes[theme].auxiliaryText }]}
67+
numberOfLines={1}
68+
/>
6669
) : null}
6770
</View>
6871
<DirectoryItemLabel text={rightLabel} theme={theme} />

app/containers/markdown/AtMention.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ const AtMention = React.memo(({ mention, mentions, username, navToRoomInfo, styl
3434
);
3535
}
3636

37+
const itsMe = mention === username;
3738
let mentionStyle = {};
38-
if (mention === username) {
39+
if (itsMe) {
3940
mentionStyle = {
4041
color: themes[theme].mentionMeColor
4142
};
@@ -51,7 +52,8 @@ const AtMention = React.memo(({ mention, mentions, username, navToRoomInfo, styl
5152
logEvent(events.ROOM_MENTION_GO_USER_INFO);
5253
const navParam = {
5354
t: 'd',
54-
rid: user && user._id
55+
rid: user && user._id,
56+
itsMe
5557
};
5658
if (navToRoomInfo) {
5759
navToRoomInfo(navParam);

app/i18n/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export const LANGUAGES: ILanguage[] = [
6060
file: () => require('./locales/hi-IN.json')
6161
},
6262

63+
{
64+
label: 'Hungarian',
65+
value: 'hu',
66+
file: () => require('./locales/hu.json')
67+
},
68+
6369
{
6470
label: 'Italiano',
6571
value: 'it',

app/i18n/locales/ar.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
"Share": "مشاركة",
345345
"Share_Link": "مشاركة رابط",
346346
"Share_this_app": "مشاركة هذا البرنامج",
347-
"Show_more": "إظهار أكثر..",
347+
"Show_more": "إظهار أكثر",
348348
"Sign_Up": "تسجيل جديد",
349349
"Sound": "الصوت",
350350
"Star": "تمييز",

0 commit comments

Comments
 (0)