stream-chat-react-native-core 5.44.2 → 5.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +8 -3
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useLastReadData.js +21 -0
- package/lib/commonjs/components/MessageList/hooks/useLastReadData.js.map +1 -0
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js +6 -2
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getReadStates.js +6 -7
- package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +3 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js +8 -3
- package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useLastReadData.js +21 -0
- package/lib/module/components/MessageList/hooks/useLastReadData.js.map +1 -0
- package/lib/module/components/MessageList/hooks/useMessageList.js +6 -2
- package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/module/components/MessageList/utils/getReadStates.js +6 -7
- package/lib/module/components/MessageList/utils/getReadStates.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +3 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +12 -2
- package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts +13 -0
- package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts.map +1 -0
- package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +2 -2
- package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +3 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ChannelPreview/ChannelAvatar.tsx +18 -4
- package/src/components/MessageInput/__tests__/MessageInput.test.js +116 -2
- package/src/components/MessageList/hooks/useLastReadData.ts +37 -0
- package/src/components/MessageList/hooks/useMessageList.ts +7 -2
- package/src/components/MessageList/utils/getReadStates.ts +8 -8
- package/src/contexts/themeContext/utils/theme.ts +6 -0
- package/src/version.json +1 -1
|
@@ -6,11 +6,11 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
|
6
6
|
export const getReadStates = <
|
|
7
7
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
8
|
>(
|
|
9
|
-
clientUserId: string | undefined,
|
|
10
9
|
messages:
|
|
11
10
|
| PaginatedMessageListContextValue<StreamChatGenerics>['messages']
|
|
12
11
|
| ThreadContextValue<StreamChatGenerics>['threadMessages'],
|
|
13
12
|
read?: ChannelContextValue<StreamChatGenerics>['read'],
|
|
13
|
+
returnAllReadData?: boolean,
|
|
14
14
|
) => {
|
|
15
15
|
const readData: Record<string, number> = {};
|
|
16
16
|
|
|
@@ -32,20 +32,20 @@ export const getReadStates = <
|
|
|
32
32
|
if (msg.created_at && msg.created_at < readState.last_read) {
|
|
33
33
|
userLastReadMsgId = msg.id;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readData[userLastReadMsgId]
|
|
38
|
-
|
|
35
|
+
if (returnAllReadData) {
|
|
36
|
+
// if true, save other user's read data for all messages they've read
|
|
37
|
+
if (!readData[userLastReadMsgId]) {
|
|
38
|
+
readData[userLastReadMsgId] = 0;
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
if (msg.user?.id !== clientUserId) {
|
|
41
|
+
// Only increment read count if the message is not sent by the current user
|
|
42
42
|
readData[userLastReadMsgId] = readData[userLastReadMsgId] + 1;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
// if true, only save read data for other user's last read message
|
|
48
|
-
if (userLastReadMsgId) {
|
|
48
|
+
if (userLastReadMsgId && !returnAllReadData) {
|
|
49
49
|
if (!readData[userLastReadMsgId]) {
|
|
50
50
|
readData[userLastReadMsgId] = 0;
|
|
51
51
|
}
|
|
@@ -152,6 +152,9 @@ export type Theme = {
|
|
|
152
152
|
maskFillColor?: ColorValue;
|
|
153
153
|
};
|
|
154
154
|
channelPreview: {
|
|
155
|
+
avatar: {
|
|
156
|
+
size: number;
|
|
157
|
+
};
|
|
155
158
|
checkAllIcon: IconProps;
|
|
156
159
|
checkIcon: IconProps;
|
|
157
160
|
container: ViewStyle;
|
|
@@ -875,6 +878,9 @@ export const defaultTheme: Theme = {
|
|
|
875
878
|
height: 64,
|
|
876
879
|
},
|
|
877
880
|
channelPreview: {
|
|
881
|
+
avatar: {
|
|
882
|
+
size: 40,
|
|
883
|
+
},
|
|
878
884
|
checkAllIcon: {
|
|
879
885
|
height: DEFAULT_STATUS_ICON_SIZE,
|
|
880
886
|
width: DEFAULT_STATUS_ICON_SIZE,
|
package/src/version.json
CHANGED