Page MenuHomePhabricator

D7672.id25874.diff
No OneTemporary

D7672.id25874.diff

diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js
--- a/native/chat/chat.react.js
+++ b/native/chat/chat.react.js
@@ -39,6 +39,7 @@
import HomeChatThreadList from './home-chat-thread-list.react.js';
import MessageListContainer from './message-list-container.react.js';
import MessageListHeaderTitle from './message-list-header-title.react.js';
+import MessageResultsScreen from './message-results-screen.react.js';
import MessageStorePruner from './message-store-pruner.react.js';
import DeleteThread from './settings/delete-thread.react.js';
import EmojiThreadAvatarCreation from './settings/emoji-thread-avatar-creation.react.js';
@@ -59,6 +60,7 @@
ThreadSettingsRouteName,
EmojiThreadAvatarCreationRouteName,
FullScreenThreadMediaGalleryRouteName,
+ MessageResultsScreenRouteName,
MessageListRouteName,
ChatThreadListRouteName,
HomeChatThreadListRouteName,
@@ -266,6 +268,12 @@
headerTitle: 'Delete chat',
headerBackTitleVisible: false,
};
+const messageResultsScreenOptions = ({ route }) => ({
+ headerTitle: route.key.startsWith('PinnedMessages')
+ ? 'Pinned Messages'
+ : 'Search Results',
+ headerBackTitleVisible: false,
+});
export type ChatNavigationProp<
RouteName: $Keys<ChatParamList> = $Keys<ChatParamList>,
@@ -374,6 +382,11 @@
component={DeleteThread}
options={deleteThreadOptions}
/>
+ <Chat.Screen
+ name={MessageResultsScreenRouteName}
+ component={MessageResultsScreen}
+ options={messageResultsScreenOptions}
+ />
</Chat.Navigator>
<MessageStorePruner />
<ThreadScreenPruner />
diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -38,7 +38,10 @@
type OverlayContextType,
} from '../navigation/overlay-context.js';
import type { NavigationRoute } from '../navigation/route-names.js';
-import { ThreadSettingsRouteName } from '../navigation/route-names.js';
+import {
+ ThreadSettingsRouteName,
+ MessageResultsScreenRouteName,
+} from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { type Colors, useColors, useStyles } from '../themes/colors.js';
import type { ChatMessageItemWithHeight } from '../types/chat-types.js';
@@ -362,6 +365,16 @@
state => threadInfoSelector(state)[genesis.id],
);
+ const navigateToMessageResults = React.useCallback(() => {
+ props.navigation.navigate<'MessageResultsScreen'>({
+ name: MessageResultsScreenRouteName,
+ params: {
+ threadInfo,
+ },
+ key: `PinnedMessages${threadInfo.id}`,
+ });
+ }, [props.navigation, threadInfo]);
+
const bannerText = React.useMemo(() => {
if (!threadInfo.pinnedCount || threadInfo.pinnedCount === 0) {
return '';
@@ -378,7 +391,12 @@
return (
<View style={styles.pinnedCountBanner}>
- <Text style={styles.pinnedCountText}>{bannerText}</Text>
+ <Text
+ onPress={navigateToMessageResults}
+ style={styles.pinnedCountText}
+ >
+ {bannerText}
+ </Text>
<Icon
name="chevron-right"
size={12}
@@ -387,6 +405,7 @@
</View>
);
}, [
+ navigateToMessageResults,
bannerText,
styles.pinnedCountBanner,
styles.pinnedCountText,
diff --git a/native/chat/message-results-screen.react.js b/native/chat/message-results-screen.react.js
new file mode 100644
--- /dev/null
+++ b/native/chat/message-results-screen.react.js
@@ -0,0 +1,24 @@
+// @flow
+
+import * as React from 'react';
+
+import type { ThreadInfo } from 'lib/types/thread-types.js';
+
+import type { ChatNavigationProp } from './chat.react';
+import type { NavigationRoute } from '../navigation/route-names';
+
+export type MessageResultsScreenParams = {
+ +threadInfo: ThreadInfo,
+};
+
+type MessageResultsScreenProps = {
+ +navigation: ChatNavigationProp<'MessageResultsScreen'>,
+ +route: NavigationRoute<'MessageResultsScreen'>,
+};
+
+// eslint-disable-next-line no-unused-vars
+function MessageResultsScreen(props: MessageResultsScreenProps): React.Node {
+ return null;
+}
+
+export default MessageResultsScreen;
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -10,6 +10,7 @@
import type { ImagePasteModalParams } from '../chat/image-paste-modal.react.js';
import type { MessageListParams } from '../chat/message-list-types.js';
import type { MessageReactionsModalParams } from '../chat/message-reactions-modal.react.js';
+import type { MessageResultsScreenParams } from '../chat/message-results-screen.react.js';
import type { MultimediaMessageTooltipModalParams } from '../chat/multimedia-message-tooltip-modal.react.js';
import type { RobotextMessageTooltipModalParams } from '../chat/robotext-message-tooltip-modal.react.js';
import type { AddUsersModalParams } from '../chat/settings/add-users-modal.react.js';
@@ -62,6 +63,7 @@
export const LoggedOutModalRouteName = 'LoggedOutModal';
export const MessageListRouteName = 'MessageList';
export const MessageReactionsModalRouteName = 'MessageReactionsModal';
+export const MessageResultsScreenRouteName = 'MessageResultsScreen';
export const MultimediaMessageTooltipModalRouteName =
'MultimediaMessageTooltipModal';
export const PrivacyPreferencesRouteName = 'PrivacyPreferences';
@@ -140,6 +142,7 @@
+EmojiThreadAvatarCreation: EmojiThreadAvatarCreationParams,
+DeleteThread: DeleteThreadParams,
+FullScreenThreadMediaGallery: FullScreenThreadMediaGalleryParams,
+ +MessageResultsScreen: MessageResultsScreenParams,
};
export type ChatTopTabsParamList = {
@@ -203,4 +206,5 @@
DeleteThreadRouteName,
ComposeSubchannelRouteName,
FullScreenThreadMediaGalleryRouteName,
+ MessageResultsScreenRouteName,
];

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 7:58 AM (17 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2493337
Default Alt Text
D7672.id25874.diff (5 KB)

Event Timeline