Created
March 24, 2023 03:19
-
-
Save Ashoat/02b230b25772395d1e0769ce073468fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js | |
index ebbd0887f..f12bc470f 100644 | |
--- a/lib/selectors/chat-selectors.js | |
+++ b/lib/selectors/chat-selectors.js | |
@@ -279,20 +279,22 @@ export type RobotextChatMessageInfoItem = { | |
+threadCreatedFromMessage: ?ThreadInfo, | |
+reactions: ReactionInfo, | |
}; | |
+export type ComposableChatMessageInfoItem = { | |
+ +itemType: 'message', | |
+ +messageInfoType: 'composable', | |
+ +messageInfo: ComposableMessageInfo, | |
+ +localMessageInfo: ?LocalMessageInfo, | |
+ +startsConversation: boolean, | |
+ +startsCluster: boolean, | |
+ endsCluster: boolean, | |
+ +threadCreatedFromMessage: ?ThreadInfo, | |
+ +reactions: ReactionInfo, | |
+}; | |
+export type ChatMessageLoader = { +itemType: 'loader' }; | |
export type ChatMessageInfoItem = | |
| RobotextChatMessageInfoItem | |
- | { | |
- +itemType: 'message', | |
- +messageInfoType: 'composable', | |
- +messageInfo: ComposableMessageInfo, | |
- +localMessageInfo: ?LocalMessageInfo, | |
- +startsConversation: boolean, | |
- +startsCluster: boolean, | |
- endsCluster: boolean, | |
- +threadCreatedFromMessage: ?ThreadInfo, | |
- +reactions: ReactionInfo, | |
- }; | |
-export type ChatMessageItem = { itemType: 'loader' } | ChatMessageInfoItem; | |
+ | ComposableChatMessageInfoItem; | |
+export type ChatMessageItem = ChatMessageLoader | ChatMessageInfoItem; | |
export type ReactionInfo = { +[reaction: string]: MessageReactionInfo }; | |
type MessageReactionInfo = { | |
diff --git a/native/chat/chat-item-height-measurer.react.js b/native/chat/chat-item-height-measurer.react.js | |
index 53f13a5f6..d4ffe6156 100644 | |
--- a/native/chat/chat-item-height-measurer.react.js | |
+++ b/native/chat/chat-item-height-measurer.react.js | |
@@ -101,6 +101,7 @@ function ChatItemHeightMeasurer(props: Props) { | |
threadCreatedFromMessage: item.threadCreatedFromMessage, | |
pendingUploads, | |
reactions: item.reactions, | |
+ test: item.test, | |
...sizes, | |
}; | |
} | |
@@ -126,6 +127,7 @@ function ChatItemHeightMeasurer(props: Props) { | |
threadCreatedFromMessage: item.threadCreatedFromMessage, | |
contentHeight: height, | |
reactions: item.reactions, | |
+ test: item.test, | |
}; | |
} | |
invariant( | |
@@ -150,6 +152,7 @@ function ChatItemHeightMeasurer(props: Props) { | |
robotext: item.robotext, | |
contentHeight: height, | |
reactions: item.reactions, | |
+ test: item.test, | |
}; | |
}, | |
[composedMessageMaxWidth, inputStatePendingUploads, threadInfo], | |
diff --git a/native/chat/message-data.react.js b/native/chat/message-data.react.js | |
index 1f26b9ec7..05229b15d 100644 | |
--- a/native/chat/message-data.react.js | |
+++ b/native/chat/message-data.react.js | |
@@ -1,19 +1,48 @@ | |
// @flow | |
import { | |
- type ChatMessageItem, | |
type UseMessageListDataArgs, | |
+ type RobotextChatMessageInfoItem, | |
+ type ComposableChatMessageInfoItem, | |
+ type ChatMessageLoader, | |
useMessageListData, | |
} from 'lib/selectors/chat-selectors.js'; | |
-export type NativeChatMessageItem = ChatMessageItem; | |
+export type NativeRobotextChatMessageInfoItem = { | |
+ ...RobotextChatMessageInfoItem, | |
+ +test: boolean, | |
+}; | |
+export type NativeComposableChatMessageInfoItem = { | |
+ ...ComposableChatMessageInfoItem, | |
+ +test: boolean, | |
+}; | |
+export type NativeChatMessageInfoItem = | |
+ | NativeRobotextChatMessageInfoItem | |
+ | NativeComposableChatMessageInfoItem; | |
+export type NativeChatMessageItem = | |
+ | ChatMessageLoader | |
+ | NativeChatMessageInfoItem; | |
type MessageListData = ?(NativeChatMessageItem[]); | |
function useNativeMessageListData( | |
args: UseMessageListDataArgs, | |
): MessageListData { | |
- return useMessageListData(args); | |
+ const messageListData = useMessageListData(args); | |
+ if (!messageListData) { | |
+ return messageListData; | |
+ } | |
+ return messageListData.map(t => { | |
+ if (t.itemType !== 'message') { | |
+ return t; | |
+ } else if (t.messageInfoType === 'composable') { | |
+ return { ...t, test: true }; | |
+ } else if (t.messageInfoType === 'robotext') { | |
+ return { ...t, test: true }; | |
+ } else { | |
+ return t; | |
+ } | |
+ }); | |
} | |
export { useNativeMessageListData }; | |
diff --git a/native/types/chat-types.js b/native/types/chat-types.js | |
index 9ee7ec414..f93ab90a6 100644 | |
--- a/native/types/chat-types.js | |
+++ b/native/types/chat-types.js | |
@@ -1,6 +1,9 @@ | |
// @flow | |
-import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; | |
+import type { | |
+ ReactionInfo, | |
+ ChatMessageLoader, | |
+} from 'lib/selectors/chat-selectors.js'; | |
import type { | |
LocalMessageInfo, | |
MultimediaMessageInfo, | |
@@ -24,6 +27,7 @@ export type ChatRobotextMessageInfoItemWithHeight = { | |
+threadCreatedFromMessage: ?ThreadInfo, | |
+contentHeight: number, | |
+reactions: ReactionInfo, | |
+ +test: boolean, | |
}; | |
export type ChatTextMessageInfoItemWithHeight = { | |
@@ -38,6 +42,7 @@ export type ChatTextMessageInfoItemWithHeight = { | |
+contentHeight: number, | |
+threadCreatedFromMessage: ?ThreadInfo, | |
+reactions: ReactionInfo, | |
+ +test: boolean, | |
}; | |
export type MultimediaContentSizes = { | |
@@ -58,6 +63,7 @@ export type ChatMultimediaMessageInfoItem = { | |
+threadCreatedFromMessage: ?ThreadInfo, | |
+pendingUploads: ?MessagePendingUploads, | |
+reactions: ReactionInfo, | |
+ +test: boolean, | |
}; | |
export type ChatMessageInfoItemWithHeight = | |
@@ -66,5 +72,5 @@ export type ChatMessageInfoItemWithHeight = | |
| ChatMultimediaMessageInfoItem; | |
export type ChatMessageItemWithHeight = | |
- | { itemType: 'loader' } | |
+ | ChatMessageLoader | |
| ChatMessageInfoItemWithHeight; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment