diff --git a/app/containers/Avatar/Avatar.stories.tsx b/app/containers/Avatar/Avatar.stories.tsx
index 224cedaaa6f..b251b35d0c6 100644
--- a/app/containers/Avatar/Avatar.stories.tsx
+++ b/app/containers/Avatar/Avatar.stories.tsx
@@ -1,9 +1,13 @@
import { StyleSheet } from 'react-native';
+import { setCustomEmojis } from '../../actions/customEmojis';
+import { mockedStore } from '../../reducers/mockedStore';
import Status from '../Status/Status';
import sharedStyles from '../../views/Styles';
import Avatar from './Avatar';
+mockedStore.dispatch(setCustomEmojis({ troll: { name: 'troll', extension: 'jpg' } }));
+
const styles = StyleSheet.create({
custom: {
padding: 16
@@ -40,9 +44,7 @@ export const WithETag = () => (
export const WithoutETag = () => ;
-export const Emoji = () => (
- ({ name: 'troll', extension: 'jpg' })} server={server} size={56} />
-);
+export const Emoji = () => ;
export const Direct = () => ;
diff --git a/app/containers/Avatar/Avatar.tsx b/app/containers/Avatar/Avatar.tsx
index 834012c6485..6d375147249 100644
--- a/app/containers/Avatar/Avatar.tsx
+++ b/app/containers/Avatar/Avatar.tsx
@@ -7,7 +7,6 @@ import Emoji from '../markdown/components/emoji/Emoji';
import { getAvatarURL } from '../../lib/methods/helpers/getAvatarUrl';
import { SubscriptionType } from '../../definitions';
import { type IAvatar } from './interfaces';
-import MarkdownContext from '../markdown/contexts/MarkdownContext';
import I18n from '../../i18n';
import Touch from '../Touch';
@@ -21,7 +20,6 @@ const Avatar = memo(
token,
onPress,
emoji,
- getCustomEmoji,
avatarETag,
isStatic,
rid,
@@ -51,16 +49,11 @@ const Avatar = memo(
let image;
if (emoji) {
image = (
-
-
-
+
);
} else {
let uri = avatar;
diff --git a/app/containers/Avatar/AvatarContainer.tsx b/app/containers/Avatar/AvatarContainer.tsx
index 11db5c78ba4..9889fb95319 100644
--- a/app/containers/Avatar/AvatarContainer.tsx
+++ b/app/containers/Avatar/AvatarContainer.tsx
@@ -17,7 +17,6 @@ const AvatarContainer = ({
type,
children,
onPress,
- getCustomEmoji,
isStatic,
rid,
accessibilityLabel,
@@ -61,7 +60,6 @@ const AvatarContainer = ({
userId={id}
token={token}
onPress={onPress}
- getCustomEmoji={getCustomEmoji}
isStatic={isStatic}
rid={rid}
blockUnauthenticatedAccess={blockUnauthenticatedAccess}
diff --git a/app/containers/Avatar/AvatarWithEdit.tsx b/app/containers/Avatar/AvatarWithEdit.tsx
index d736a6c8cdc..2b7a26a8b0e 100644
--- a/app/containers/Avatar/AvatarWithEdit.tsx
+++ b/app/containers/Avatar/AvatarWithEdit.tsx
@@ -39,7 +39,6 @@ const AvatarWithEdit = ({
type,
children,
onPress,
- getCustomEmoji,
isStatic,
rid,
handleEdit,
@@ -62,7 +61,6 @@ const AvatarWithEdit = ({
borderRadius={borderRadius}
type={type}
onPress={onPress}
- getCustomEmoji={getCustomEmoji}
isStatic={isStatic}
rid={rid}>
{children}
diff --git a/app/containers/Avatar/interfaces.ts b/app/containers/Avatar/interfaces.ts
index aac0a8ef262..d66edad90e8 100644
--- a/app/containers/Avatar/interfaces.ts
+++ b/app/containers/Avatar/interfaces.ts
@@ -1,8 +1,6 @@
import { type ReactElement } from 'react';
import { type ViewStyle } from 'react-native';
-import { type TGetCustomEmoji } from '../../definitions/IEmoji';
-
export interface IAvatar {
server?: string;
style?: ViewStyle;
@@ -16,7 +14,6 @@ export interface IAvatar {
userId?: string;
token?: string;
onPress?: () => void;
- getCustomEmoji?: TGetCustomEmoji;
avatarETag?: string;
isStatic?: boolean | string;
rid?: string;
diff --git a/app/containers/ReactionsList/AllTab.tsx b/app/containers/ReactionsList/AllTab.tsx
index 2184697e3d3..92ee7e9427e 100644
--- a/app/containers/ReactionsList/AllTab.tsx
+++ b/app/containers/ReactionsList/AllTab.tsx
@@ -4,22 +4,19 @@ import { Text, View, FlatList } from 'react-native';
import Emoji from '../message/Emoji';
import { useTheme } from '../../theme';
import { type IReaction } from '../../definitions';
-import { type TGetCustomEmoji } from '../../definitions/IEmoji';
import I18n from '../../i18n';
import styles from './styles';
import { useAppSelector } from '../../lib/hooks/useAppSelector';
interface IAllReactionsListItemProps {
- getCustomEmoji: TGetCustomEmoji;
item: IReaction;
}
interface IAllTabProps {
- getCustomEmoji: TGetCustomEmoji;
reactions?: IReaction[];
}
-const AllReactionsListItem = ({ item, getCustomEmoji }: IAllReactionsListItemProps) => {
+const AllReactionsListItem = ({ item }: IAllReactionsListItemProps) => {
const { colors } = useTheme();
const useRealName = useAppSelector(state => state.settings.UI_Use_Real_Name);
const username = useAppSelector(state => state.login.user.username);
@@ -48,7 +45,6 @@ const AllReactionsListItem = ({ item, getCustomEmoji }: IAllReactionsListItemPro
content={item.emoji}
standardEmojiStyle={styles.allTabStandardEmojiStyle}
customEmojiStyle={styles.allTabCustomEmojiStyle}
- getCustomEmoji={getCustomEmoji}
/>
@@ -60,12 +56,12 @@ const AllReactionsListItem = ({ item, getCustomEmoji }: IAllReactionsListItemPro
);
};
-const AllTab = ({ reactions, getCustomEmoji }: IAllTabProps): ReactElement => (
+const AllTab = ({ reactions }: IAllTabProps): ReactElement => (
}
+ renderItem={({ item }) => }
keyExtractor={item => item.emoji}
/>
diff --git a/app/containers/ReactionsList/ReactionsList.stories.tsx b/app/containers/ReactionsList/ReactionsList.stories.tsx
index 01f907525ed..9719194310d 100644
--- a/app/containers/ReactionsList/ReactionsList.stories.tsx
+++ b/app/containers/ReactionsList/ReactionsList.stories.tsx
@@ -1,18 +1,17 @@
import { View } from 'react-native';
-import { type TGetCustomEmoji, type ICustomEmoji } from '../../definitions';
import ReactionsList from '.';
import { mockedStore as store } from '../../reducers/mockedStore';
import { updateSettings } from '../../actions/settings';
+import { setCustomEmojis } from '../../actions/customEmojis';
-const getCustomEmoji: TGetCustomEmoji = content => {
- const customEmoji = {
- marioparty: { name: content, extension: 'gif' },
- react_rocket: { name: content, extension: 'png' },
- nyan_rocket: { name: content, extension: 'png' }
- }[content] as ICustomEmoji;
- return customEmoji;
-};
+store.dispatch(
+ setCustomEmojis({
+ marioparty: { name: 'marioparty', extension: 'gif' },
+ react_rocket: { name: 'react_rocket', extension: 'png' },
+ nyan_rocket: { name: 'nyan_rocket', extension: 'png' }
+ })
+);
const reactions = [
{
@@ -51,7 +50,7 @@ export const ReactionsListStory = () => {
store.dispatch(updateSettings('UI_Use_Real_Name', false));
return (
-
+
);
};
@@ -60,7 +59,7 @@ export const ReactionsListFullName = () => {
store.dispatch(updateSettings('UI_Use_Real_Name', true));
return (
-
+
);
};
diff --git a/app/containers/ReactionsList/ReactionsList.test.tsx b/app/containers/ReactionsList/ReactionsList.test.tsx
index dc431e8b2bc..25209464920 100644
--- a/app/containers/ReactionsList/ReactionsList.test.tsx
+++ b/app/containers/ReactionsList/ReactionsList.test.tsx
@@ -2,6 +2,7 @@ import { type ReactElement, type ReactNode } from 'react';
import { screen, render, fireEvent, within } from '@testing-library/react-native';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
+import { Image as ExpoImage } from 'expo-image';
import ReactionsList from './index';
import { type IReaction } from '../../definitions';
@@ -105,16 +106,12 @@ const mockStore = createStore(
server: {
server: 'https://open.rocket.chat',
version: '6.0.0'
- }
+ },
+ customEmojis: {}
}
) => state
);
-const mockGetCustomEmoji = (emoji: string) => ({
- name: emoji,
- extension: 'png'
-});
-
const mockReactions: IReaction[] = [
{
_id: 'reaction1',
@@ -138,13 +135,13 @@ describe('ReactionsList Integration Tests', () => {
});
it('renders empty ReactionsList when no reactions', () => {
- renderWithRedux();
+ renderWithRedux();
expect(screen.getByTestId('reactionsList')).toBeOnTheScreen();
expect(screen.getByTestId('reactionsListAllTab')).toBeOnTheScreen();
});
it('renders ReactionsList with reactions and allows navigation between tabs', () => {
- renderWithRedux();
+ renderWithRedux();
// Verify All tab content
expect(screen.getByText('4 people reacted')).toBeOnTheScreen();
@@ -185,14 +182,15 @@ describe('ReactionsList Integration Tests', () => {
server: {
server: 'https://open.rocket.chat',
version: '6.0.0'
- }
+ },
+ customEmojis: {}
}
) => state
);
render(
-
+
);
@@ -218,6 +216,30 @@ describe('ReactionsList Integration Tests', () => {
});
it('handles custom emojis correctly', () => {
+ const storeWithCustomEmoji = createStore(
+ (
+ state = {
+ settings: {
+ UI_Use_Real_Name: true
+ },
+ login: {
+ user: {
+ id: 'user123',
+ username: 'testuser',
+ name: 'Test User'
+ }
+ },
+ server: {
+ server: 'https://open.rocket.chat',
+ version: '6.0.0'
+ },
+ customEmojis: {
+ custom_emoji: { name: 'custom_emoji', extension: 'png' }
+ }
+ }
+ ) => state
+ );
+
const customReactions: IReaction[] = [
{
_id: 'reaction3',
@@ -227,11 +249,18 @@ describe('ReactionsList Integration Tests', () => {
}
];
- renderWithRedux();
+ render(
+
+
+
+ );
- // Verify custom emoji is rendered
expect(screen.getByTestId('tab-:custom_emoji:')).toBeOnTheScreen();
expect(screen.getByText('1 person reacted')).toBeOnTheScreen();
+
+ // Resolves against the store and renders as a custom emoji image, not the shortname text
+ expect(screen.UNSAFE_getAllByType(ExpoImage).length).toBeGreaterThan(0);
+ expect(screen.queryByText(':custom_emoji:')).toBeNull();
});
});
diff --git a/app/containers/ReactionsList/index.tsx b/app/containers/ReactionsList/index.tsx
index 3057aa2c8d3..ea7748fd4a2 100644
--- a/app/containers/ReactionsList/index.tsx
+++ b/app/containers/ReactionsList/index.tsx
@@ -1,6 +1,5 @@
import { Text, View } from 'react-native';
-import { type TGetCustomEmoji } from '../../definitions/IEmoji';
import { type IReaction } from '../../definitions';
import I18n from '../../i18n';
import styles from './styles';
@@ -10,7 +9,6 @@ import { TabView } from '../TabView';
import Emoji from '../message/Emoji';
interface IReactionsListProps {
- getCustomEmoji: TGetCustomEmoji;
reactions?: IReaction[];
}
@@ -50,12 +48,12 @@ const useRoutes = (reactions: IReaction[] | undefined) => {
};
};
-const ReactionsList = ({ reactions, getCustomEmoji }: IReactionsListProps) => {
+const ReactionsList = ({ reactions }: IReactionsListProps) => {
const { routes, sortedReactions } = useRoutes(reactions);
const renderScene = ({ route }: { route: IRoute }) => {
if (route.key === 'all') {
- return ;
+ return ;
}
if (route.emoji && route.usernames && route.names) {
return ;
@@ -74,12 +72,7 @@ const ReactionsList = ({ reactions, getCustomEmoji }: IReactionsListProps) => {
if (tab.emoji) {
return (
-
+
{tab.usernames?.length}
);
diff --git a/app/containers/markdown/Markdown.stories.tsx b/app/containers/markdown/Markdown.stories.tsx
index ccc89d98cf8..fb9b7fa94c1 100644
--- a/app/containers/markdown/Markdown.stories.tsx
+++ b/app/containers/markdown/Markdown.stories.tsx
@@ -2,8 +2,9 @@ import { ScrollView, StyleSheet, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import Markdown, { MarkdownPreview } from '.';
+import { setCustomEmojis } from '../../actions/customEmojis';
+import { mockedStore } from '../../reducers/mockedStore';
import { themes } from '../../lib/constants/colors';
-import { type TGetCustomEmoji, type ICustomEmoji } from '../../definitions/IEmoji';
const theme = 'light';
@@ -27,14 +28,12 @@ d
e`;
const sequentialEmptySpacesText = 'a b c';
-const getCustomEmoji: TGetCustomEmoji = content => {
- const customEmoji = {
- marioparty: { name: content, extension: 'gif' },
- react_rocket: { name: content, extension: 'png' },
- nyan_rocket: { name: content, extension: 'png' }
- }[content] as ICustomEmoji;
- return customEmoji;
+const customEmojis = {
+ marioparty: { name: 'marioparty', extension: 'gif' },
+ react_rocket: { name: 'react_rocket', extension: 'png' },
+ nyan_rocket: { name: 'nyan_rocket', extension: 'png' }
};
+mockedStore.dispatch(setCustomEmojis(customEmojis));
export default {
title: 'Markdown',
@@ -94,8 +93,8 @@ export const Emoji = () => (
-
-
+
+
);
diff --git a/app/containers/markdown/components/emoji/Emoji.tsx b/app/containers/markdown/components/emoji/Emoji.tsx
index 9d83009f32d..dab66684618 100644
--- a/app/containers/markdown/components/emoji/Emoji.tsx
+++ b/app/containers/markdown/components/emoji/Emoji.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { Text, View, useWindowDimensions } from 'react-native';
import { type Emoji as EmojiProps } from '@rocket.chat/message-parser';
@@ -7,8 +6,8 @@ import useShortnameToUnicode from '../../../../lib/hooks/useShortnameToUnicode';
import { useTheme } from '../../../../theme';
import styles from '../../styles';
import CustomEmoji from '../../../EmojiPicker/CustomEmoji';
-import MarkdownContext from '../../contexts/MarkdownContext';
import { useAppSelector } from '../../../../lib/hooks/useAppSelector';
+import { useCustomEmoji } from '../../../../lib/hooks/useCustomEmoji';
import { getUserSelector } from '../../../../selectors/login';
import { useResponsiveLayout } from '../../../../lib/hooks/useResponsiveLayout/useResponsiveLayout';
@@ -34,7 +33,7 @@ function getEmojiToken(block: EmojiProps, isAvatar: boolean) {
const Emoji = ({ block, isBigEmoji, style = {}, index, isAvatar = false }: IEmojiProps) => {
const { colors } = useTheme();
- const { getCustomEmoji } = useContext(MarkdownContext);
+ const getCustomEmoji = useCustomEmoji();
const { fontScale } = useWindowDimensions();
const { fontScaleLimited } = useResponsiveLayout();
const { formatShortnameToUnicode } = useShortnameToUnicode();
diff --git a/app/containers/markdown/contexts/MarkdownContext.ts b/app/containers/markdown/contexts/MarkdownContext.ts
index dfd8541805e..ee58ef1c1cd 100644
--- a/app/containers/markdown/contexts/MarkdownContext.ts
+++ b/app/containers/markdown/contexts/MarkdownContext.ts
@@ -9,7 +9,6 @@ interface IMarkdownContext {
useRealName?: boolean;
username?: string;
navToRoomInfo?: Function;
- getCustomEmoji?: Function;
onLinkPress?: Function;
textStyle?: StyleProp;
}
diff --git a/app/containers/markdown/index.tsx b/app/containers/markdown/index.tsx
index ba20bbffeaa..46d9118d7e3 100644
--- a/app/containers/markdown/index.tsx
+++ b/app/containers/markdown/index.tsx
@@ -5,7 +5,6 @@ import type { Root } from '@rocket.chat/message-parser';
import isEmpty from 'lodash/isEmpty';
import { type IUserMention, type IUserChannel, type TOnLinkPress } from './interfaces';
-import { type TGetCustomEmoji } from '../../definitions/IEmoji';
import MarkdownContext from './contexts/MarkdownContext';
import LineBreak from './components/LineBreak';
import { KaTeX } from './components/Katex';
@@ -26,7 +25,6 @@ interface IMarkdownProps {
msg?: string | null;
md?: Root;
mentions?: IUserMention[];
- getCustomEmoji?: TGetCustomEmoji;
username?: string;
useRealName?: boolean;
channels?: IUserChannel[];
@@ -109,7 +107,6 @@ const Markdown: FC = ({
navToRoomInfo,
useRealName,
username = '',
- getCustomEmoji,
onLinkPress,
isTranslated,
textStyle
@@ -133,7 +130,6 @@ const Markdown: FC = ({
useRealName,
username,
navToRoomInfo,
- getCustomEmoji,
onLinkPress,
textStyle
};
diff --git a/app/containers/message/Components/Attachments/AttachedActions.tsx b/app/containers/message/Components/Attachments/AttachedActions.tsx
index fdb804af534..3faea7c5e6f 100644
--- a/app/containers/message/Components/Attachments/AttachedActions.tsx
+++ b/app/containers/message/Components/Attachments/AttachedActions.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import Button from '../../../Button';
import MessageContext from '../../Context';
-import { type IAttachment, type TGetCustomEmoji } from '../../../../definitions';
+import { type IAttachment } from '../../../../definitions';
import openLink from '../../../../lib/methods/helpers/openLink';
import Markdown from '../../../markdown';
@@ -13,7 +13,7 @@ export type TElement = {
text: string;
};
-const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachment; getCustomEmoji: TGetCustomEmoji }) => {
+const AttachedActions = ({ attachment }: { attachment: IAttachment }) => {
'use memo';
const { onAnswerButtonPress } = useContext(MessageContext);
@@ -41,7 +41,7 @@ const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachme
});
return (
<>
-
+
{attachedButtons}
>
);
diff --git a/app/containers/message/Components/Attachments/Attachments.stories.tsx b/app/containers/message/Components/Attachments/Attachments.stories.tsx
index 43947a2a374..31206364f05 100644
--- a/app/containers/message/Components/Attachments/Attachments.stories.tsx
+++ b/app/containers/message/Components/Attachments/Attachments.stories.tsx
@@ -54,7 +54,7 @@ export const SingleImageOldServer = () => (
- null} timeFormat='LT' />
+
@@ -65,7 +65,7 @@ export const SingleImageNewServer = () => (
- null} timeFormat='LT' />
+
@@ -76,7 +76,7 @@ export const SingleImageNoAlt = () => (
- null} timeFormat='LT' />
+
@@ -87,7 +87,7 @@ export const MultipleImagesNewServer = () => (
- null} timeFormat='LT' />
+
@@ -98,7 +98,7 @@ export const MultipleImagesOldServer = () => (
- null} timeFormat='LT' />
+
diff --git a/app/containers/message/Components/Attachments/Attachments.tsx b/app/containers/message/Components/Attachments/Attachments.tsx
index 329c0e48eec..68b2c173535 100644
--- a/app/containers/message/Components/Attachments/Attachments.tsx
+++ b/app/containers/message/Components/Attachments/Attachments.tsx
@@ -14,7 +14,7 @@ import { getMessageFromAttachment } from '../../utils';
import { isContentAttachment } from './utils';
const Attachments: FC = memo(
- ({ attachments, timeFormat, showAttachment, getCustomEmoji, author }: IMessageAttachments) => {
+ ({ attachments, timeFormat, showAttachment, author }: IMessageAttachments) => {
'use memo';
const { translateLanguage } = useContext(MessageContext);
@@ -34,7 +34,6 @@ const Attachments: FC = memo(
key={file.image_url}
file={file}
showAttachment={showAttachment}
- getCustomEmoji={getCustomEmoji}
author={author}
msg={msg}
imagePreview={file.image_preview}
@@ -44,30 +43,15 @@ const Attachments: FC = memo(
}
if (file.audio_url) {
- return ;
+ return ;
}
if (file.video_url) {
- return (
-
- );
+ return ;
}
if (file.actions && file.actions.length > 0) {
- return (
-
- );
+ return ;
}
if (typeof file.collapsed === 'boolean') {
return (
@@ -75,7 +59,6 @@ const Attachments: FC = memo(
key={file.title_link || file.message_link || `collapsible-${index}`}
attachment={file}
timeFormat={timeFormat}
- getCustomEmoji={getCustomEmoji}
/>
);
}
@@ -86,7 +69,6 @@ const Attachments: FC = memo(
key={file.title_link || file.message_link || `reply-${index}`}
attachment={file}
timeFormat={timeFormat}
- getCustomEmoji={getCustomEmoji}
showAttachment={showAttachment}
msg={msg}
/>
diff --git a/app/containers/message/Components/Attachments/Audio.tsx b/app/containers/message/Components/Attachments/Audio.tsx
index 37bbf5206f4..d6879209af5 100644
--- a/app/containers/message/Components/Attachments/Audio.tsx
+++ b/app/containers/message/Components/Attachments/Audio.tsx
@@ -2,7 +2,6 @@ import { useContext } from 'react';
import { View } from 'react-native';
import { type IAttachment, type IUserMessage } from '../../../../definitions';
-import { type TGetCustomEmoji } from '../../../../definitions/IEmoji';
import AudioPlayer from '../../../AudioPlayer';
import Markdown from '../../../markdown';
import MessageContext from '../../Context';
@@ -10,12 +9,11 @@ import { useMediaAutoDownload } from '../../hooks/useMediaAutoDownload';
interface IMessageAudioProps {
file: IAttachment;
- getCustomEmoji: TGetCustomEmoji;
author?: IUserMessage;
msg?: string;
}
-const MessageAudio = ({ file, getCustomEmoji, author, msg }: IMessageAudioProps) => {
+const MessageAudio = ({ file, author, msg }: IMessageAudioProps) => {
'use memo';
const { user, id, rid } = useContext(MessageContext);
@@ -23,7 +21,7 @@ const MessageAudio = ({ file, getCustomEmoji, author, msg }: IMessageAudioProps)
return (
- {msg ? : null}
+ {msg ? : null}
);
diff --git a/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.stories.tsx b/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.stories.tsx
index 72a56c70f4c..eb69fcc104e 100644
--- a/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.stories.tsx
+++ b/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.stories.tsx
@@ -28,7 +28,7 @@ export const Item = () => (
onLongPress: () => {},
user: { username: 'Marcos' }
}}>
- null} timeFormat='LT' />
+
);
diff --git a/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.test.tsx b/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.test.tsx
index b86d3135cc6..651c59c02fa 100644
--- a/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.test.tsx
+++ b/app/containers/message/Components/Attachments/CollapsibleQuote/CollapsibleQuote.test.tsx
@@ -21,8 +21,6 @@ const testAttachment = {
collapsed: true
};
-const mockFn = jest.fn();
-
const initialMockedStoreState = () => {
mockedStore.dispatch(
setUser({
@@ -44,7 +42,7 @@ const Render = () => (
onLongPress: () => {},
user: { username: 'Marcos' }
}}>
-
+
);
diff --git a/app/containers/message/Components/Attachments/CollapsibleQuote/index.tsx b/app/containers/message/Components/Attachments/CollapsibleQuote/index.tsx
index 202c0a32b5b..0b46a1cbf92 100644
--- a/app/containers/message/Components/Attachments/CollapsibleQuote/index.tsx
+++ b/app/containers/message/Components/Attachments/CollapsibleQuote/index.tsx
@@ -5,7 +5,6 @@ import { StyleSheet, Text, View } from 'react-native';
import { themes } from '../../../../../lib/constants/colors';
import { type IAttachment } from '../../../../../definitions/IAttachment';
-import { type TGetCustomEmoji } from '../../../../../definitions/IEmoji';
import { CustomIcon } from '../../../../CustomIcon';
import { useTheme } from '../../../../../theme';
import sharedStyles from '../../../../../views/Styles';
@@ -69,22 +68,19 @@ const styles = StyleSheet.create({
interface IMessageAttText {
text?: string;
- getCustomEmoji: TGetCustomEmoji;
}
interface IMessageFields {
attachment: IAttachment;
- getCustomEmoji: TGetCustomEmoji;
}
interface IMessageReply {
attachment: IAttachment;
timeFormat?: string;
- getCustomEmoji: TGetCustomEmoji;
}
const AttText = memo(
- ({ text, getCustomEmoji }: IMessageAttText) => {
+ ({ text }: IMessageAttText) => {
'use memo';
const { user } = useContext(MessageContext);
@@ -93,13 +89,13 @@ const AttText = memo(
return null;
}
- return ;
+ return ;
},
(prevProps, nextProps) => prevProps.text === nextProps.text
);
const Fields = memo(
- ({ attachment, getCustomEmoji }: IMessageFields) => {
+ ({ attachment }: IMessageFields) => {
'use memo';
const { theme } = useTheme();
@@ -116,7 +112,7 @@ const Fields = memo(
{field.title}
-
+
))}
>
@@ -126,7 +122,7 @@ const Fields = memo(
);
const CollapsibleQuote = memo(
- ({ attachment, getCustomEmoji }: IMessageReply) => {
+ ({ attachment }: IMessageReply) => {
'use memo';
const { theme } = useTheme();
@@ -177,8 +173,8 @@ const CollapsibleQuote = memo(
{attachment.title}
- {!collapsed && }
- {!collapsed && }
+ {!collapsed && }
+ {!collapsed && }
diff --git a/app/containers/message/Components/Attachments/Image/Container.tsx b/app/containers/message/Components/Attachments/Image/Container.tsx
index bd288bcc046..cd2c78f219a 100644
--- a/app/containers/message/Components/Attachments/Image/Container.tsx
+++ b/app/containers/message/Components/Attachments/Image/Container.tsx
@@ -12,15 +12,7 @@ import { WidthAwareView } from '../../WidthAwareView';
import { useAltTextSupported } from '../../../../../lib/hooks/useAltTextSupported';
import I18n from '../../../../../i18n';
-const ImageContainer = ({
- file,
- showAttachment,
- getCustomEmoji,
- author,
- msg,
- imagePreview,
- imageType
-}: IImageContainer): ReactElement | null => {
+const ImageContainer = ({ file, showAttachment, author, msg, imagePreview, imageType }: IImageContainer): ReactElement | null => {
'use memo';
const { user } = useContext(MessageContext);
@@ -52,7 +44,7 @@ const ImageContainer = ({
if (msg) {
return (
-
+
{image}
);
diff --git a/app/containers/message/Components/Attachments/Image/definitions.ts b/app/containers/message/Components/Attachments/Image/definitions.ts
index 34fdaaca3a2..5ca4662a95b 100644
--- a/app/containers/message/Components/Attachments/Image/definitions.ts
+++ b/app/containers/message/Components/Attachments/Image/definitions.ts
@@ -1,11 +1,9 @@
import { type IAttachment, type IUserMessage } from '../../../../../definitions';
-import { type TGetCustomEmoji } from '../../../../../definitions/IEmoji';
import { type TDownloadState } from '../../../../../lib/methods/handleMediaDownload';
export interface IImageContainer {
file: IAttachment;
showAttachment?: (file: IAttachment) => void;
- getCustomEmoji?: TGetCustomEmoji;
author?: IUserMessage;
msg?: string;
imagePreview?: string;
diff --git a/app/containers/message/Components/Attachments/Quote.tsx b/app/containers/message/Components/Attachments/Quote.tsx
index 5d45a1e034b..eae787177cb 100644
--- a/app/containers/message/Components/Attachments/Quote.tsx
+++ b/app/containers/message/Components/Attachments/Quote.tsx
@@ -10,7 +10,7 @@ import { getMessageFromAttachment } from '../../utils';
import { isQuoteAttachment } from './utils';
const Quote: FC = memo(
- ({ attachments, timeFormat, showAttachment, getCustomEmoji }: IMessageAttachments) => {
+ ({ attachments, timeFormat, showAttachment }: IMessageAttachments) => {
'use memo';
const { translateLanguage } = useContext(MessageContext);
@@ -24,16 +24,7 @@ const Quote: FC = memo(
const quotesElements = quotes.map((file: IAttachment, index: number) => {
const msg = getMessageFromAttachment(file, translateLanguage);
- return (
-
- );
+ return ;
});
return {quotesElements};
diff --git a/app/containers/message/Components/Attachments/Reply.tsx b/app/containers/message/Components/Attachments/Reply.tsx
index da15a41b9dd..5bb9cd5f494 100644
--- a/app/containers/message/Components/Attachments/Reply.tsx
+++ b/app/containers/message/Components/Attachments/Reply.tsx
@@ -3,7 +3,7 @@ import { useContext, useState, memo } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Image } from 'expo-image';
-import { type IAttachment, type TGetCustomEmoji } from '../../../../definitions';
+import { type IAttachment } from '../../../../definitions';
import { themes } from '../../../../lib/constants/colors';
import { fileDownloadAndPreview } from '../../../../lib/methods/helpers';
import { formatAttachmentUrl } from '../../../../lib/methods/helpers/formatAttachmentUrl';
@@ -95,7 +95,6 @@ const styles = StyleSheet.create({
interface IMessageReply {
attachment: IAttachment;
timeFormat?: string;
- getCustomEmoji: TGetCustomEmoji;
msg?: string;
showAttachment?: (file: IAttachment) => void;
}
@@ -120,7 +119,7 @@ const Title = memo(
);
const Description = memo(
- ({ attachment, getCustomEmoji }: { attachment: IAttachment; getCustomEmoji: TGetCustomEmoji }) => {
+ ({ attachment }: { attachment: IAttachment }) => {
'use memo';
const { user } = useContext(MessageContext);
@@ -140,7 +139,7 @@ const Description = memo(
return ;
}
- return ;
+ return ;
},
(prevProps, nextProps) => {
if (prevProps.attachment.text !== nextProps.attachment.text) {
@@ -173,15 +172,7 @@ const UrlImage = memo(
);
const Fields = memo(
- ({
- attachment,
- theme,
- getCustomEmoji
- }: {
- attachment: IAttachment;
- theme: TSupportedThemes;
- getCustomEmoji: TGetCustomEmoji;
- }) => {
+ ({ attachment, theme }: { attachment: IAttachment; theme: TSupportedThemes }) => {
'use memo';
const { user } = useContext(MessageContext);
@@ -195,7 +186,7 @@ const Fields = memo(
{attachment.fields.map(field => (
{field.title}
-
+
))}
@@ -206,7 +197,7 @@ const Fields = memo(
);
const Reply = memo(
- ({ attachment, timeFormat, getCustomEmoji, msg, showAttachment }: IMessageReply) => {
+ ({ attachment, timeFormat, msg, showAttachment }: IMessageReply) => {
'use memo';
const [loading, setLoading] = useState(false);
@@ -252,20 +243,10 @@ const Reply = memo(
-
-
-
-
+
+
+
+
{loading ? (
- {msg ? : null}
+ {msg ? : null}
);
},
diff --git a/app/containers/message/Components/Attachments/Video.tsx b/app/containers/message/Components/Attachments/Video.tsx
index 7d9c90054ad..6f6c2e5ba2e 100644
--- a/app/containers/message/Components/Attachments/Video.tsx
+++ b/app/containers/message/Components/Attachments/Video.tsx
@@ -3,7 +3,6 @@ import { StyleSheet, Text, View } from 'react-native';
import { type IUserMessage } from '../../../../definitions';
import { type IAttachment } from '../../../../definitions/IAttachment';
-import { type TGetCustomEmoji } from '../../../../definitions/IEmoji';
import I18n from '../../../../i18n';
import { fileDownload, isIOS } from '../../../../lib/methods/helpers';
import EventEmitter from '../../../../lib/methods/helpers/events';
@@ -37,7 +36,6 @@ const styles = StyleSheet.create({
interface IMessageVideo {
file: IAttachment;
showAttachment?: (file: IAttachment) => void;
- getCustomEmoji: TGetCustomEmoji;
author?: IUserMessage;
msg?: string;
}
@@ -70,7 +68,7 @@ const Thumbnail = ({ status, encrypted = false }: { status: TDownloadState; encr
);
};
-const Video = ({ file, showAttachment, getCustomEmoji, author, msg }: IMessageVideo): ReactElement | null => {
+const Video = ({ file, showAttachment, author, msg }: IMessageVideo): ReactElement | null => {
'use memo';
const { user } = useContext(MessageContext);
@@ -101,7 +99,7 @@ const Video = ({ file, showAttachment, getCustomEmoji, author, msg }: IMessageVi
return (
- {msg ? : null}
+ {msg ? : null}
diff --git a/app/containers/message/Content.test.tsx b/app/containers/message/Content.test.tsx
index 3013e84f872..d9175bee6f2 100644
--- a/app/containers/message/Content.test.tsx
+++ b/app/containers/message/Content.test.tsx
@@ -28,7 +28,6 @@ const baseProps: Partial = {
isTranslated: false,
isHeader: false,
hasError: false,
- getCustomEmoji: jest.fn(),
navToRoomInfo: jest.fn()
};
diff --git a/app/containers/message/Content.tsx b/app/containers/message/Content.tsx
index c6f132ff7be..8e6ce6387be 100644
--- a/app/containers/message/Content.tsx
+++ b/app/containers/message/Content.tsx
@@ -64,7 +64,6 @@ const Content = memo(
{
+ ({ content, standardEmojiStyle, customEmojiStyle }: IMessageEmoji) => {
'use memo';
+ const getCustomEmoji = useCustomEmoji();
const parsedContent = content.replace(/^:|:$/g, '');
const emoji = getCustomEmoji(parsedContent);
const { formatShortnameToUnicode } = useShortnameToUnicode();
diff --git a/app/containers/message/Message.stories.tsx b/app/containers/message/Message.stories.tsx
index 0320d52459f..bca767224db 100644
--- a/app/containers/message/Message.stories.tsx
+++ b/app/containers/message/Message.stories.tsx
@@ -14,6 +14,7 @@ import {
} from '../../lib/hooks/useResponsiveLayout/useResponsiveLayout';
import { mockedStore as store } from '../../reducers/mockedStore';
import { updateSettings } from '../../actions/settings';
+import { setCustomEmojis } from '../../actions/customEmojis';
const _theme = 'light';
@@ -51,6 +52,13 @@ const longText =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
store.dispatch(updateSettings('API_Embed', true));
+store.dispatch(
+ setCustomEmojis({
+ marioparty: { name: 'marioparty', extension: 'gif' },
+ react_rocket: { name: 'react_rocket', extension: 'png' },
+ nyan_rocket: { name: 'nyan_rocket', extension: 'png' }
+ })
+);
const responsiveLayoutProviderLargeFontValue = (fontScale: number) => ({
fontScale,
@@ -62,15 +70,6 @@ const responsiveLayoutProviderLargeFontValue = (fontScale: number) => ({
height: 800
});
-const getCustomEmoji = (content: string) => {
- const customEmoji = {
- marioparty: { name: content, extension: 'gif' },
- react_rocket: { name: content, extension: 'png' },
- nyan_rocket: { name: content, extension: 'png' }
- }[content];
- return customEmoji;
-};
-
export default {
title: 'Message',
decorators: [
@@ -93,7 +92,6 @@ export const Message = (props: any) => (
ts={date}
timeFormat='LT'
isHeader
- getCustomEmoji={getCustomEmoji}
theme={_theme}
{...props}
/>
@@ -110,7 +108,6 @@ const MessageLargeFont = (props: any) => (
ts={date}
timeFormat='LT'
isHeader
- getCustomEmoji={getCustomEmoji}
theme={_theme}
{...props}
/>
diff --git a/app/containers/message/MessageAvatar.tsx b/app/containers/message/MessageAvatar.tsx
index 3727b2c4729..95a824197ae 100644
--- a/app/containers/message/MessageAvatar.tsx
+++ b/app/containers/message/MessageAvatar.tsx
@@ -16,7 +16,7 @@ export const AvatarContainer = ({ children }: { children?: ReactElement | null }
return {children};
};
-const MessageAvatar = memo(({ isHeader, avatar, author, small, navToRoomInfo, emoji, getCustomEmoji }: IMessageAvatar) => {
+const MessageAvatar = memo(({ isHeader, avatar, author, small, navToRoomInfo, emoji }: IMessageAvatar) => {
'use memo';
const { user } = useContext(MessageContext);
@@ -41,7 +41,6 @@ const MessageAvatar = memo(({ isHeader, avatar, author, small, navToRoomInfo, em
size={size}
borderRadius={4}
onPress={onPress}
- getCustomEmoji={getCustomEmoji}
avatar={avatar}
emoji={emoji}
/>
diff --git a/app/containers/message/Preview.tsx b/app/containers/message/Preview.tsx
index c8705b32fab..5bcd6045994 100644
--- a/app/containers/message/Preview.tsx
+++ b/app/containers/message/Preview.tsx
@@ -1,30 +1,24 @@
import Message from './index';
import { useAppSelector } from '../../lib/hooks/useAppSelector';
import { getUserSelector } from '../../selectors/login';
-import { type TAnyMessageModel, type TGetCustomEmoji } from '../../definitions';
+import { type TAnyMessageModel } from '../../definitions';
const MessagePreview = ({ message }: { message: TAnyMessageModel }) => {
'use memo';
- const { user, baseUrl, Message_TimeFormat, customEmojis, useRealName } = useAppSelector(state => ({
+ const { user, baseUrl, Message_TimeFormat, useRealName } = useAppSelector(state => ({
user: getUserSelector(state),
baseUrl: state.server.server,
Message_TimeFormat: state.settings.Message_TimeFormat as string,
- customEmojis: state.customEmojis,
useRealName: state.settings.UI_Use_Real_Name as boolean
}));
- const getCustomEmoji: TGetCustomEmoji = name => {
- const emoji = customEmojis[name];
- return emoji ?? null;
- };
return (
onReactionPress: handleReactionPress,
onReactionLongPress: jest.fn()
}}>
-
+
);
};
-const getCustomEmoji = jest.fn();
-
it('renders all reactions and AddReaction button', () => {
const reactions: IReaction[] = [
{ _id: '1', emoji: '👍', usernames: ['john', 'alice'], names: [] },
diff --git a/app/containers/message/Reactions.tsx b/app/containers/message/Reactions.tsx
index aaadbe5b369..08013aabb49 100644
--- a/app/containers/message/Reactions.tsx
+++ b/app/containers/message/Reactions.tsx
@@ -10,7 +10,6 @@ import { BUTTON_HIT_SLOP } from './utils';
import { themes } from '../../lib/constants/colors';
import { type TSupportedThemes, useTheme } from '../../theme';
import MessageContext from './Context';
-import { type TGetCustomEmoji } from '../../definitions/IEmoji';
interface IReaction {
_id: string;
@@ -20,13 +19,11 @@ interface IReaction {
interface IMessageReaction {
reaction: IReaction;
- getCustomEmoji: TGetCustomEmoji;
theme: TSupportedThemes;
}
interface IMessageReactions {
reactions?: IReaction[];
- getCustomEmoji: TGetCustomEmoji;
}
const AddReaction = memo(({ theme }: { theme: TSupportedThemes }) => {
@@ -52,7 +49,7 @@ const AddReaction = memo(({ theme }: { theme: TSupportedThemes }) => {
);
});
-const Reaction = memo(({ reaction, getCustomEmoji, theme }: IMessageReaction) => {
+const Reaction = memo(({ reaction, theme }: IMessageReaction) => {
'use memo';
const { onReactionPress, onReactionLongPress, user } = useContext(MessageContext);
@@ -76,19 +73,14 @@ const Reaction = memo(({ reaction, getCustomEmoji, theme }: IMessageReaction) =>
styles.reactionContainer,
{ borderColor: reacted ? themes[theme].badgeBackgroundLevel2 : themes[theme].strokeLight, height }
]}>
-
+
{reaction.usernames.length}
);
});
-const Reactions = memo(({ reactions, getCustomEmoji }: IMessageReactions) => {
+const Reactions = memo(({ reactions }: IMessageReactions) => {
'use memo';
const { theme } = useTheme();
@@ -99,7 +91,7 @@ const Reactions = memo(({ reactions, getCustomEmoji }: IMessageReactions) => {
return (
{reactions.map(reaction => (
-
+
))}
diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx
index df0e3ee8a57..9f99526dfcb 100644
--- a/app/containers/message/index.tsx
+++ b/app/containers/message/index.tsx
@@ -7,7 +7,7 @@ import { debounce } from '../../lib/methods/helpers';
import { getMessageTranslation } from './utils';
import { type TSupportedThemes, withTheme } from '../../theme';
import openLink from '../../lib/methods/helpers/openLink';
-import { type IAttachment, type TAnyMessageModel, type TGetCustomEmoji } from '../../definitions';
+import { type IAttachment, type TAnyMessageModel } from '../../definitions';
import { type IRoomInfoParam } from '../../views/SearchMessagesView';
import { E2E_MESSAGE_TYPE, E2E_STATUS } from '../../lib/constants/keys';
import { messagesStatus } from '../../lib/constants/messagesStatus';
@@ -37,7 +37,6 @@ interface IMessageContainerProps {
status?: number;
isIgnored?: boolean;
highlighted?: boolean;
- getCustomEmoji: TGetCustomEmoji;
onLongPress?: (item: TAnyMessageModel) => void;
onReactionPress?: (emoji: string, id: string) => void;
onEncryptedPress?: () => void;
@@ -71,7 +70,6 @@ interface IMessageContainerState {
class MessageContainer extends Component {
static defaultProps = {
- getCustomEmoji: () => null,
onLongPress: () => {},
blockAction: () => {},
archived: false,
@@ -367,7 +365,6 @@ class MessageContainer extends Component {},
- getCustomEmoji,
isThreadRoom,
handleEnterCall,
blockAction,
@@ -496,7 +493,6 @@ class MessageContainer extends Component void;
- getCustomEmoji: TGetCustomEmoji;
author?: IUserMessage;
}
@@ -30,7 +29,6 @@ export interface IMessageAvatar {
author?: IUserMessage;
small?: boolean;
navToRoomInfo: (navParam: IRoomInfoParam) => void;
- getCustomEmoji: TGetCustomEmoji;
}
export interface IMessageBlocks {
@@ -59,7 +57,6 @@ export interface IMessageContent {
md?: Root;
isEdited: boolean;
isEncrypted: boolean;
- getCustomEmoji: TGetCustomEmoji;
channels?: IUserChannel[];
mentions?: IUserMention[];
navToRoomInfo: (navParam: IRoomInfoParam) => void;
@@ -79,7 +76,6 @@ export interface IMessageEmoji {
content: string;
standardEmojiStyle: { fontSize: number };
customEmojiStyle: StyleProp;
- getCustomEmoji: TGetCustomEmoji;
}
export interface IMessageThread extends Pick {
@@ -119,6 +115,7 @@ export interface IMessageInner
blocks: [];
urls?: IUrl[];
isPreview?: boolean;
+ reactions?: IReaction[];
}
export interface IMessage extends IMessageRepliedThread, IMessageInner, IMessageAvatar {
diff --git a/app/lib/hooks/useCustomEmoji.test.ts b/app/lib/hooks/useCustomEmoji.test.ts
new file mode 100644
index 00000000000..ff938f57b3b
--- /dev/null
+++ b/app/lib/hooks/useCustomEmoji.test.ts
@@ -0,0 +1,28 @@
+import { renderHook } from '@testing-library/react-native';
+
+import { resolveCustomEmoji, useCustomEmoji } from './useCustomEmoji';
+
+const customEmojis = { nyan_rocket: { name: 'nyan_rocket', extension: 'png' } };
+
+jest.mock('./useAppSelector', () => ({
+ useAppSelector: (selector: (state: any) => any) => selector({ customEmojis })
+}));
+
+describe('resolveCustomEmoji', () => {
+ it('returns the emoji when the name is registered', () => {
+ expect(resolveCustomEmoji(customEmojis, 'nyan_rocket')).toBe(customEmojis.nyan_rocket);
+ });
+
+ it('returns null when the name is not registered', () => {
+ expect(resolveCustomEmoji(customEmojis, 'unknown')).toBeNull();
+ });
+});
+
+describe('useCustomEmoji', () => {
+ it('returns a getter resolving against state.customEmojis', () => {
+ const { result } = renderHook(() => useCustomEmoji());
+
+ expect(result.current('nyan_rocket')).toBe(customEmojis.nyan_rocket);
+ expect(result.current('unknown')).toBeNull();
+ });
+});
diff --git a/app/lib/hooks/useCustomEmoji.ts b/app/lib/hooks/useCustomEmoji.ts
new file mode 100644
index 00000000000..65ac1402495
--- /dev/null
+++ b/app/lib/hooks/useCustomEmoji.ts
@@ -0,0 +1,11 @@
+import { type ICustomEmojis, type TGetCustomEmoji } from '../../definitions';
+import { useAppSelector } from './useAppSelector';
+
+export const resolveCustomEmoji = (customEmojis: ICustomEmojis, name: string) => customEmojis[name] ?? null;
+
+export const useCustomEmoji = (): TGetCustomEmoji => {
+ 'use memo';
+
+ const customEmojis = useAppSelector(state => state.customEmojis);
+ return name => resolveCustomEmoji(customEmojis, name);
+};
diff --git a/app/views/MessagesView/index.tsx b/app/views/MessagesView/index.tsx
index 442bf5b41de..a9ca795be42 100644
--- a/app/views/MessagesView/index.tsx
+++ b/app/views/MessagesView/index.tsx
@@ -28,9 +28,7 @@ import {
type IAttachment,
type IMessage,
type TAnyMessageModel,
- type IUrl,
- type TGetCustomEmoji,
- type ICustomEmoji
+ type IUrl
} from '../../definitions';
import { getFiles, getMessages, getPinnedMessages, togglePinMessage, toggleStarMessage } from '../../lib/services/restApi';
import { type TNavigation } from '../../stacks/stackType';
@@ -51,7 +49,6 @@ interface IMessagesViewProps {
NativeStackNavigationProp
>;
route: RouteProp;
- customEmojis: { [key: string]: ICustomEmoji };
theme: TSupportedThemes;
showActionSheet: (params: { options: string[]; hasCancel: boolean }) => void;
useRealName: boolean;
@@ -176,7 +173,6 @@ class MessagesView extends Component {
attachments: item.attachments || [],
useRealName,
showAttachment: this.showAttachment,
- getCustomEmoji: this.getCustomEmoji,
navToRoomInfo: this.navToRoomInfo,
onPress: () => this.jumpToMessage({ item }),
rid: this.rid
@@ -303,15 +299,6 @@ class MessagesView extends Component {
}
};
- getCustomEmoji: TGetCustomEmoji = name => {
- const { customEmojis } = this.props;
- const emoji = customEmojis[name];
- if (emoji) {
- return emoji;
- }
- return null;
- };
-
showAttachment = (attachment: IAttachment) => {
const { navigation } = this.props;
navigation.navigate('AttachmentView', { attachment });
@@ -385,7 +372,6 @@ class MessagesView extends Component {
const mapStateToProps = (state: IApplicationState) => ({
baseUrl: state.server.server,
user: getUserSelector(state),
- customEmojis: state.customEmojis,
useRealName: state.settings.UI_Use_Real_Name
});
diff --git a/app/views/RoomView/definitions.ts b/app/views/RoomView/definitions.ts
index e583db6a387..5bce9a25709 100644
--- a/app/views/RoomView/definitions.ts
+++ b/app/views/RoomView/definitions.ts
@@ -6,7 +6,6 @@ import {
type ILastMessage,
type ILoggedUser,
type TSubscriptionModel,
- type ICustomEmojis,
type TMessageAction
} from '../../definitions';
import { type IActionSheetProvider } from '../../containers/ActionSheet';
@@ -21,7 +20,6 @@ export interface IRoomViewProps extends IActionSheetProvider, IBaseScreen {
onReactionLongPress = (message: TAnyMessageModel) => {
const { showActionSheet } = this.props;
this.handleCloseEmoji(showActionSheet, {
- children: ,
+ children: ,
snaps: ['50%'],
enableContentPanningGesture: false,
fullContainer: true
@@ -1129,15 +1128,6 @@ class RoomView extends Component {
this.resetAction();
};
- getCustomEmoji: TGetCustomEmoji = name => {
- const { customEmojis } = this.props;
- const emoji = customEmojis[name];
- if (emoji) {
- return emoji;
- }
- return null;
- };
-
setLastOpen = (lastOpen: Date | null) => this.setState({ lastOpen });
onJoin = () => {
@@ -1505,7 +1495,6 @@ class RoomView extends Component {
autoTranslateRoom={canAutoTranslate && 'id' in room && room.autoTranslate}
autoTranslateLanguage={'id' in room ? room.autoTranslateLanguage : undefined}
navToRoomInfo={this.navToRoomInfo}
- getCustomEmoji={this.getCustomEmoji}
handleEnterCall={this.handleEnterCall}
blockAction={this.blockAction}
threadBadgeColor={this.getBadgeColor(item?.id)}
@@ -1741,7 +1730,6 @@ const mapStateToProps = (state: IApplicationState) => ({
isAuthenticated: state.login.isAuthenticated,
Message_GroupingPeriod: state.settings.Message_GroupingPeriod as number,
Message_TimeFormat: state.settings.Message_TimeFormat as string,
- customEmojis: state.customEmojis,
baseUrl: state.server.server,
serverVersion: state.server.version,
Message_Read_Receipt_Enabled: state.settings.Message_Read_Receipt_Enabled as boolean,
diff --git a/app/views/SearchMessagesView/index.tsx b/app/views/SearchMessagesView/index.tsx
index 4f58b84e1df..c637a689634 100644
--- a/app/views/SearchMessagesView/index.tsx
+++ b/app/views/SearchMessagesView/index.tsx
@@ -36,9 +36,7 @@ import {
type IAttachment,
type ISubscription,
SubscriptionType,
- type TSubscriptionModel,
- type TGetCustomEmoji,
- type ICustomEmoji
+ type TSubscriptionModel
} from '../../definitions';
import { searchMessages } from '../../lib/services/restApi';
import { type TNavigation } from '../../stacks/stackType';
@@ -74,9 +72,6 @@ interface ISearchMessagesViewProps extends INavigationOption {
user: IUser;
baseUrl: string;
serverVersion: string;
- customEmojis: {
- [key: string]: ICustomEmoji;
- };
theme: TSupportedThemes;
useRealName: boolean;
isMasterDetail: boolean;
@@ -210,15 +205,6 @@ class SearchMessagesView extends Component {
- const { customEmojis } = this.props;
- const emoji = customEmojis[name];
- if (emoji) {
- return emoji;
- }
- return null;
- };
-
showAttachment = (attachment: IAttachment) => {
const { navigation } = this.props;
navigation.navigate('AttachmentView', { attachment });
@@ -297,7 +283,6 @@ class SearchMessagesView extends Component ({
serverVersion: state.server.version,
baseUrl: state.server.server,
user: getUserSelector(state),
- useRealName: state.settings.UI_Use_Real_Name,
- customEmojis: state.customEmojis
+ useRealName: state.settings.UI_Use_Real_Name
});
export default connect(mapStateToProps)(withTheme(withMasterDetail(withSafeAreaInsets(SearchMessagesView))));