From 03e8df617e74cabe50417d71ac9e0c25203adafe Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 29 Mar 2022 15:53:10 -0300 Subject: [PATCH] Merge 4.26.1 into master (#3979) --- android/app/build.gradle | 2 +- app/containers/FormContainer.tsx | 46 +++++---- app/containers/List/ListContainer.tsx | 2 +- app/containers/List/ListHeader.tsx | 1 + app/containers/List/ListIcon.tsx | 19 ++-- app/containers/List/ListItem.tsx | 92 +++++++++--------- app/containers/List/ListSection.tsx | 5 +- app/containers/List/ListSeparator.tsx | 13 +-- app/containers/RoomHeader/RoomHeader.tsx | 3 +- app/containers/RoomHeader/index.tsx | 6 +- app/containers/RoomTypeIcon.tsx | 10 +- app/containers/Status/Status.tsx | 10 +- app/containers/Status/definition.ts | 9 ++ app/containers/Status/index.tsx | 27 +++--- app/containers/markdown/AtMention.tsx | 15 +-- app/containers/markdown/BlockQuote.tsx | 2 +- app/containers/markdown/Hashtag.tsx | 8 +- app/containers/markdown/Link.tsx | 2 +- app/containers/markdown/List.tsx | 7 +- app/containers/markdown/ListItem.tsx | 2 +- app/containers/markdown/Preview.tsx | 6 +- app/containers/markdown/Table.tsx | 2 +- app/containers/markdown/TableCell.tsx | 2 +- app/containers/markdown/TableRow.tsx | 4 +- app/containers/markdown/interfaces.ts | 1 + app/containers/markdown/new/BigEmoji.tsx | 2 +- app/containers/markdown/new/Bold.tsx | 2 +- app/containers/markdown/new/Code.tsx | 8 +- app/containers/markdown/new/CodeLine.tsx | 2 +- app/containers/markdown/new/Emoji.tsx | 4 +- app/containers/markdown/new/Heading.tsx | 4 +- app/containers/markdown/new/Image.tsx | 4 +- app/containers/markdown/new/Inline.tsx | 2 +- app/containers/markdown/new/InlineCode.tsx | 8 +- app/containers/markdown/new/Italic.tsx | 2 +- app/containers/markdown/new/Link.tsx | 4 +- app/containers/markdown/new/OrderedList.tsx | 4 +- app/containers/markdown/new/Paragraph.tsx | 4 +- app/containers/markdown/new/Plain.tsx | 4 +- app/containers/markdown/new/Quote.tsx | 4 +- app/containers/markdown/new/Strike.tsx | 2 +- app/containers/markdown/new/TaskList.tsx | 4 +- app/containers/markdown/new/UnorderedList.tsx | 4 +- app/containers/markdown/new/index.tsx | 2 +- app/containers/message/Attachments.tsx | 2 +- app/definitions/ILoggedUser.ts | 4 +- app/definitions/IUser.ts | 8 +- app/definitions/TUserStatus.ts | 3 + app/definitions/UserStatus.ts | 6 -- app/definitions/index.ts | 1 + app/dimensions.tsx | 6 +- app/lib/rocketchat/rocketchat.js | 1 - app/lib/rocketchat/services/connect.ts | 7 +- app/presentation/RoomItem/RoomItem.tsx | 3 +- app/presentation/RoomItem/TypeIcon.tsx | 3 +- app/presentation/RoomItem/index.tsx | 7 +- app/reducers/activeUsers.test.ts | 3 +- app/reducers/activeUsers.ts | 5 +- app/reducers/login.test.ts | 4 +- app/reducers/login.ts | 5 +- app/views/AddChannelTeamView.tsx | 4 - app/views/ForgotPasswordView.tsx | 2 +- app/views/LoginView.tsx | 2 +- app/views/NewServerView/index.tsx | 2 +- app/views/RegisterView.tsx | 96 ++++++++++--------- app/views/ScreenLockConfigView.tsx | 2 +- app/views/SendEmailConfirmationView.tsx | 2 +- app/views/SidebarView/index.tsx | 3 +- app/views/StatusView.tsx | 16 ++-- app/views/ThemeView.tsx | 4 +- app/views/WorkspaceView/index.tsx | 2 +- ios/RocketChatRN.xcodeproj/project.pbxproj | 4 +- ios/RocketChatRN/Info.plist | 2 +- ios/ShareRocketChatRN/Info.plist | 2 +- package.json | 2 +- .../stories/__snapshots__/List.storyshot | 2 +- .../stories/__snapshots__/Message.storyshot | 2 +- .../stories/__snapshots__/RoomItem.storyshot | 2 +- 78 files changed, 302 insertions(+), 283 deletions(-) create mode 100644 app/containers/Status/definition.ts create mode 100644 app/definitions/TUserStatus.ts delete mode 100644 app/definitions/UserStatus.ts diff --git a/android/app/build.gradle b/android/app/build.gradle index 2207ca59c2..f7e9a5f4eb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -144,7 +144,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode VERSIONCODE as Integer - versionName "4.26.0" + versionName "4.26.1" vectorDrawables.useSupportLibrary = true if (!isFoss) { manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String] diff --git a/app/containers/FormContainer.tsx b/app/containers/FormContainer.tsx index ff233952a9..8c862b54de 100644 --- a/app/containers/FormContainer.tsx +++ b/app/containers/FormContainer.tsx @@ -5,15 +5,15 @@ import { themes } from '../constants/colors'; import sharedStyles from '../views/Styles'; import scrollPersistTaps from '../utils/scrollPersistTaps'; import KeyboardView from '../presentation/KeyboardView'; +import { useTheme } from '../theme'; import StatusBar from './StatusBar'; import AppVersion from './AppVersion'; import { isTablet } from '../utils/deviceInfo'; import SafeAreaView from './SafeAreaView'; interface IFormContainer extends ScrollViewProps { - theme: string; testID: string; - children: React.ReactNode; + children: React.ReactElement | React.ReactElement[] | null; } const styles = StyleSheet.create({ @@ -22,27 +22,31 @@ const styles = StyleSheet.create({ } }); -export const FormContainerInner = ({ children }: { children: React.ReactNode }): JSX.Element => ( +export const FormContainerInner = ({ children }: { children: (React.ReactElement | null)[] }) => ( {children} ); -const FormContainer = ({ children, theme, testID, ...props }: IFormContainer): JSX.Element => ( - - - - - {children} - - - - -); +const FormContainer = ({ children, testID, ...props }: IFormContainer) => { + const { theme } = useTheme(); + + return ( + + + + + {children} + + + + + ); +}; export default FormContainer; diff --git a/app/containers/List/ListContainer.tsx b/app/containers/List/ListContainer.tsx index deb9c8a710..349c71beed 100644 --- a/app/containers/List/ListContainer.tsx +++ b/app/containers/List/ListContainer.tsx @@ -11,7 +11,7 @@ const styles = StyleSheet.create({ }); interface IListContainer { - children: React.ReactNode; + children: (React.ReactElement | null)[] | React.ReactElement | null; testID?: string; } const ListContainer = React.memo(({ children, ...props }: IListContainer) => ( diff --git a/app/containers/List/ListHeader.tsx b/app/containers/List/ListHeader.tsx index d9cb58eb9c..469d4cec66 100644 --- a/app/containers/List/ListHeader.tsx +++ b/app/containers/List/ListHeader.tsx @@ -25,6 +25,7 @@ interface IListHeader { const ListHeader = React.memo(({ title, translateTitle = true }: IListHeader) => { const { theme } = useTheme(); + return ( diff --git a/app/containers/List/ListIcon.tsx b/app/containers/List/ListIcon.tsx index 71e4fbdf23..c134b16903 100644 --- a/app/containers/List/ListIcon.tsx +++ b/app/containers/List/ListIcon.tsx @@ -3,11 +3,10 @@ import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; import { themes } from '../../constants/colors'; import { CustomIcon } from '../../lib/Icons'; -import { withTheme } from '../../theme'; +import { useTheme } from '../../theme'; import { ICON_SIZE } from './constants'; interface IListIcon { - theme?: string; name: string; color?: string; style?: StyleProp; @@ -21,12 +20,16 @@ const styles = StyleSheet.create({ } }); -const ListIcon = React.memo(({ theme, name, color, style, testID }: IListIcon) => ( - - - -)); +const ListIcon = React.memo(({ name, color, style, testID }: IListIcon) => { + const { theme } = useTheme(); + + return ( + + + + ); +}); ListIcon.displayName = 'List.Icon'; -export default withTheme(ListIcon); +export default ListIcon; diff --git a/app/containers/List/ListItem.tsx b/app/containers/List/ListItem.tsx index 79b3dcbf73..c09266a418 100644 --- a/app/containers/List/ListItem.tsx +++ b/app/containers/List/ListItem.tsx @@ -4,11 +4,11 @@ import { I18nManager, StyleSheet, Text, View } from 'react-native'; import Touch from '../../utils/touch'; import { themes } from '../../constants/colors'; import sharedStyles from '../../views/Styles'; -import { withTheme } from '../../theme'; +import { useTheme } from '../../theme'; import I18n from '../../i18n'; import { Icon } from '.'; import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants'; -import { withDimensions } from '../../dimensions'; +import { useDimensions } from '../../dimensions'; import { CustomIcon } from '../../lib/Icons'; const styles = StyleSheet.create({ @@ -59,13 +59,12 @@ interface IListItemContent { left?: () => JSX.Element | null; right?: () => JSX.Element | null; disabled?: boolean; + theme: string; testID?: string; - theme?: string; color?: string; translateTitle?: boolean; translateSubtitle?: boolean; showActionIndicator?: boolean; - fontScale?: number; alert?: boolean; } @@ -78,78 +77,85 @@ const Content = React.memo( left, right, color, - theme, - fontScale, alert, translateTitle = true, translateSubtitle = true, - showActionIndicator = false - }: IListItemContent) => ( - - {left ? {left()} : null} - - - - {translateTitle ? I18n.t(title) : title} - - {alert ? ( - + showActionIndicator = false, + theme + }: IListItemContent) => { + const { fontScale } = useDimensions(); + + return ( + + {left ? {left()} : null} + + + + {translateTitle ? I18n.t(title) : title} + + {alert ? ( + + ) : null} + + {subtitle ? ( + + {translateSubtitle ? I18n.t(subtitle) : subtitle} + ) : null} - {subtitle ? ( - - {translateSubtitle ? I18n.t(subtitle) : subtitle} - + {right || showActionIndicator ? ( + + {right ? right() : null} + {showActionIndicator ? : null} + ) : null} - {right || showActionIndicator ? ( - - {right ? right() : null} - {showActionIndicator ? : null} - - ) : null} - - ) + ); + } ); -interface IListButtonPress { - onPress?: Function; +interface IListButtonPress extends IListItemButton { + onPress: Function; } -interface IListItemButton extends IListButtonPress { +interface IListItemButton { title?: string; disabled?: boolean; - theme?: string; + theme: string; backgroundColor?: string; underlayColor?: string; } -const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }: IListItemButton) => ( +const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }: IListButtonPress) => ( onPress!(props.title)} - style={{ backgroundColor: backgroundColor || themes[props.theme!].backgroundColor }} + onPress={() => onPress(props.title)} + style={{ backgroundColor: backgroundColor || themes[props.theme].backgroundColor }} underlayColor={underlayColor} enabled={!props.disabled} - theme={props.theme!}> + theme={props.theme}> )); -interface IListItem extends IListItemContent, IListItemButton { +interface IListItem extends Omit, Omit { backgroundColor?: string; + onPress?: Function; } -const ListItem = React.memo(({ ...props }: IListItem) => { +const ListItem = React.memo(({ ...props }: IListItem) => { + const { theme } = useTheme(); + if (props.onPress) { - return