stream-chat-react-native-core 6.0.2-beta.1 → 6.1.0-beta.1
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/Channel/Channel.js +371 -279
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useChannelDataState.js +8 -0
- package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +10 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +161 -69
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useTargetedMessage.js +10 -0
- package/lib/commonjs/components/Channel/hooks/useTargetedMessage.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js +81 -54
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +6 -0
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js +117 -79
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +32 -14
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js +4 -0
- package/lib/commonjs/components/Message/utils/messageActions.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +19 -55
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +249 -211
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js +148 -0
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js.map +1 -0
- package/lib/commonjs/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +7 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +2 -0
- package/lib/commonjs/i18n/es.json +2 -0
- package/lib/commonjs/i18n/fr.json +2 -0
- package/lib/commonjs/i18n/he.json +2 -0
- package/lib/commonjs/i18n/hi.json +2 -0
- package/lib/commonjs/i18n/it.json +2 -0
- package/lib/commonjs/i18n/ja.json +2 -0
- package/lib/commonjs/i18n/ko.json +2 -0
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/pt-br.json +2 -0
- package/lib/commonjs/i18n/ru.json +2 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/icons/UnreadIndicator.js +30 -0
- package/lib/commonjs/icons/UnreadIndicator.js.map +1 -0
- package/lib/commonjs/icons/index.js +11 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/store/SqliteClient.js +1 -1
- package/lib/commonjs/store/schema.js +1 -0
- package/lib/commonjs/store/schema.js.map +1 -1
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/utils.js +35 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +371 -279
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useChannelDataState.js +8 -0
- package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +10 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useMessageListPagination.js +161 -69
- package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/module/components/Channel/hooks/useTargetedMessage.js +10 -0
- package/lib/module/components/Channel/hooks/useTargetedMessage.js.map +1 -1
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js +81 -54
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/module/components/Message/Message.js +6 -0
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js +117 -79
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +32 -14
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/module/components/Message/utils/messageActions.js +4 -0
- package/lib/module/components/Message/utils/messageActions.js.map +1 -1
- package/lib/module/components/MessageList/InlineUnreadIndicator.js +19 -55
- package/lib/module/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +249 -211
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/UnreadMessagesNotification.js +148 -0
- package/lib/module/components/MessageList/UnreadMessagesNotification.js.map +1 -0
- package/lib/module/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +7 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +2 -0
- package/lib/module/i18n/es.json +2 -0
- package/lib/module/i18n/fr.json +2 -0
- package/lib/module/i18n/he.json +2 -0
- package/lib/module/i18n/hi.json +2 -0
- package/lib/module/i18n/it.json +2 -0
- package/lib/module/i18n/ja.json +2 -0
- package/lib/module/i18n/ko.json +2 -0
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/pt-br.json +2 -0
- package/lib/module/i18n/ru.json +2 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/icons/UnreadIndicator.js +30 -0
- package/lib/module/icons/UnreadIndicator.js.map +1 -0
- package/lib/module/icons/index.js +11 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/store/SqliteClient.js +1 -1
- package/lib/module/store/schema.js +1 -0
- package/lib/module/store/schema.js.map +1 -1
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/utils.js +35 -1
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +15 -3
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +1 -0
- package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +4 -2
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +4 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useTargetedMessage.d.ts +2 -1
- package/lib/typescript/components/Channel/hooks/useTargetedMessage.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/handleEventToSyncDB.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +2 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +2 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +3 -2
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageData.d.ts +1 -1
- package/lib/typescript/components/Message/utils/messageActions.d.ts +2 -1
- package/lib/typescript/components/Message/utils/messageActions.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/InlineUnreadIndicator.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/UnreadMessagesNotification.d.ts +13 -0
- package/lib/typescript/components/MessageList/UnreadMessagesNotification.d.ts.map +1 -0
- package/lib/typescript/components/MessageMenu/MessageActionListItem.d.ts +2 -2
- package/lib/typescript/components/MessageMenu/MessageActionListItem.d.ts.map +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +25 -8
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +5 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +6 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +2 -0
- package/lib/typescript/i18n/es.json +2 -0
- package/lib/typescript/i18n/fr.json +2 -0
- package/lib/typescript/i18n/he.json +2 -0
- package/lib/typescript/i18n/hi.json +2 -0
- package/lib/typescript/i18n/it.json +2 -0
- package/lib/typescript/i18n/ja.json +2 -0
- package/lib/typescript/i18n/ko.json +2 -0
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/pt-br.json +2 -0
- package/lib/typescript/i18n/ru.json +2 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/icons/UnreadIndicator.d.ts +8 -0
- package/lib/typescript/icons/UnreadIndicator.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
- package/lib/typescript/store/schema.d.ts +1 -0
- package/lib/typescript/store/schema.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +2 -1
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +2 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/utils.d.ts +21 -1
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Channel/Channel.tsx +101 -24
- package/src/components/Channel/__tests__/Channel.test.js +109 -58
- package/src/components/Channel/__tests__/ownCapabilities.test.js +26 -0
- package/src/components/Channel/__tests__/useMessageListPagination.test.js +234 -37
- package/src/components/Channel/hooks/useChannelDataState.ts +8 -0
- package/src/components/Channel/hooks/useCreateChannelContext.ts +11 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
- package/src/components/Channel/hooks/useMessageListPagination.tsx +134 -64
- package/src/components/Channel/hooks/useTargetedMessage.ts +9 -2
- package/src/components/Chat/hooks/handleEventToSyncDB.ts +23 -1
- package/src/components/Message/Message.tsx +8 -0
- package/src/components/Message/hooks/useMessageActionHandlers.ts +54 -40
- package/src/components/Message/hooks/useMessageActions.tsx +31 -14
- package/src/components/Message/utils/messageActions.ts +6 -0
- package/src/components/MessageList/InlineUnreadIndicator.tsx +17 -26
- package/src/components/MessageList/MessageList.tsx +197 -231
- package/src/components/MessageList/UnreadMessagesNotification.tsx +107 -0
- package/src/components/MessageList/__tests__/MessageList.test.js +213 -0
- package/src/components/MessageMenu/MessageActionListItem.tsx +2 -1
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +669 -679
- package/src/contexts/channelContext/ChannelContext.tsx +35 -9
- package/src/contexts/messagesContext/MessagesContext.tsx +7 -2
- package/src/contexts/themeContext/utils/theme.ts +12 -0
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/he.json +2 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/ko.json +2 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pt-br.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/icons/UnreadIndicator.tsx +18 -0
- package/src/icons/index.ts +1 -0
- package/src/store/SqliteClient.ts +1 -1
- package/src/store/schema.ts +2 -0
- package/src/types/types.ts +5 -2
- package/src/utils/utils.ts +61 -1
- package/src/version.json +1 -1
|
@@ -2,10 +2,11 @@ import React, { PropsWithChildren, useContext } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { Channel, ChannelState } from 'stream-chat';
|
|
4
4
|
|
|
5
|
+
import { MarkReadFunctionOptions } from '../../components/Channel/Channel';
|
|
5
6
|
import type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator';
|
|
6
7
|
import type { LoadingProps } from '../../components/Indicators/LoadingIndicator';
|
|
7
8
|
import { StickyHeaderProps } from '../../components/MessageList/StickyHeader';
|
|
8
|
-
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
9
|
+
import type { ChannelUnreadState, DefaultStreamChatGenerics } from '../../types/types';
|
|
9
10
|
import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
|
|
10
11
|
|
|
11
12
|
import { isTestEnvironment } from '../utils/isTestEnvironment';
|
|
@@ -61,8 +62,9 @@ export type ChannelContextValue<
|
|
|
61
62
|
hideStickyDateHeader: boolean;
|
|
62
63
|
/**
|
|
63
64
|
* Loads channel around a specific message
|
|
64
|
-
*
|
|
65
|
-
* @param messageId
|
|
65
|
+
* @param limit - The number of messages to load around the message
|
|
66
|
+
* @param messageId - The message around which to load messages
|
|
67
|
+
* @param setTargetedMessage - Callback to set the targeted message
|
|
66
68
|
*/
|
|
67
69
|
loadChannelAroundMessage: ({
|
|
68
70
|
limit,
|
|
@@ -74,11 +76,30 @@ export type ChannelContextValue<
|
|
|
74
76
|
setTargetedMessage?: (messageId: string) => void;
|
|
75
77
|
}) => Promise<void>;
|
|
76
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Loads channel at first unread message.
|
|
81
|
+
* @param channelUnreadState - The unread state of the channel
|
|
82
|
+
* @param limit - The number of messages to load around the first unread message
|
|
83
|
+
* @param setChannelUnreadState - Callback to set the channel unread state
|
|
84
|
+
*/
|
|
85
|
+
loadChannelAtFirstUnreadMessage: ({
|
|
86
|
+
channelUnreadState,
|
|
87
|
+
limit,
|
|
88
|
+
setTargetedMessage,
|
|
89
|
+
}: {
|
|
90
|
+
channelUnreadState?: ChannelUnreadState<StreamChatGenerics>;
|
|
91
|
+
limit?: number;
|
|
92
|
+
setChannelUnreadState?: React.Dispatch<
|
|
93
|
+
React.SetStateAction<ChannelUnreadState<StreamChatGenerics> | undefined>
|
|
94
|
+
>;
|
|
95
|
+
setTargetedMessage?: (messageId: string) => void;
|
|
96
|
+
}) => Promise<void>;
|
|
97
|
+
|
|
77
98
|
/**
|
|
78
99
|
* Custom loading indicator to override the Stream default
|
|
79
100
|
*/
|
|
80
101
|
LoadingIndicator: React.ComponentType<LoadingProps>;
|
|
81
|
-
markRead: () => void;
|
|
102
|
+
markRead: (options?: MarkReadFunctionOptions) => void;
|
|
82
103
|
/**
|
|
83
104
|
*
|
|
84
105
|
* ```json
|
|
@@ -109,22 +130,27 @@ export type ChannelContextValue<
|
|
|
109
130
|
NetworkDownIndicator: React.ComponentType;
|
|
110
131
|
read: ChannelState<StreamChatGenerics>['read'];
|
|
111
132
|
reloadChannel: () => Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* When true, messagelist will be scrolled to first unread message, when opened.
|
|
114
|
-
*/
|
|
115
133
|
scrollToFirstUnreadThreshold: number;
|
|
134
|
+
setChannelUnreadState: React.Dispatch<
|
|
135
|
+
React.SetStateAction<ChannelUnreadState<StreamChatGenerics> | undefined>
|
|
136
|
+
>;
|
|
116
137
|
setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;
|
|
117
|
-
setTargetedMessage: (messageId
|
|
138
|
+
setTargetedMessage: (messageId?: string) => void;
|
|
118
139
|
/**
|
|
119
140
|
* Abort controller for cancelling async requests made for uploading images/files
|
|
120
141
|
* Its a map of filename and AbortController
|
|
121
142
|
*/
|
|
122
143
|
uploadAbortControllerRef: React.MutableRefObject<Map<string, AbortController>>;
|
|
144
|
+
channelUnreadState?: ChannelUnreadState<StreamChatGenerics>;
|
|
123
145
|
disabled?: boolean;
|
|
124
146
|
enableMessageGroupingByUser?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Id of message, which is highlighted in the channel.
|
|
149
|
+
*/
|
|
150
|
+
highlightedMessageId?: string;
|
|
125
151
|
isChannelActive?: boolean;
|
|
126
|
-
lastRead?: Date;
|
|
127
152
|
|
|
153
|
+
lastRead?: Date;
|
|
128
154
|
loading?: boolean;
|
|
129
155
|
/**
|
|
130
156
|
* Maximum time in milliseconds that should occur between messages
|
|
@@ -46,6 +46,7 @@ import type { MessageListProps } from '../../components/MessageList/MessageList'
|
|
|
46
46
|
import type { MessageSystemProps } from '../../components/MessageList/MessageSystem';
|
|
47
47
|
import type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';
|
|
48
48
|
import { TypingIndicatorContainerProps } from '../../components/MessageList/TypingIndicatorContainer';
|
|
49
|
+
import { UnreadMessagesNotificationProps } from '../../components/MessageList/UnreadMessagesNotification';
|
|
49
50
|
import type { getGroupStyles } from '../../components/MessageList/utils/getGroupStyles';
|
|
50
51
|
import { MessageActionListProps } from '../../components/MessageMenu/MessageActionList';
|
|
51
52
|
import type {
|
|
@@ -309,6 +310,7 @@ export type MessagesContextValue<
|
|
|
309
310
|
* Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)
|
|
310
311
|
*/
|
|
311
312
|
TypingIndicatorContainer: React.ComponentType<TypingIndicatorContainerProps>;
|
|
313
|
+
UnreadMessagesNotification: React.ComponentType<UnreadMessagesNotificationProps>;
|
|
312
314
|
updateMessage: (
|
|
313
315
|
updatedMessage: MessageResponse<StreamChatGenerics>,
|
|
314
316
|
extraState?: {
|
|
@@ -340,6 +342,7 @@ export type MessagesContextValue<
|
|
|
340
342
|
* Accepts the same props as Card component.
|
|
341
343
|
*/
|
|
342
344
|
CardFooter?: React.ComponentType<CardProps<StreamChatGenerics>>;
|
|
345
|
+
|
|
343
346
|
/**
|
|
344
347
|
* Custom UI component to override default header of Card component.
|
|
345
348
|
* Accepts the same props as Card component.
|
|
@@ -351,18 +354,17 @@ export type MessagesContextValue<
|
|
|
351
354
|
*
|
|
352
355
|
* Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.
|
|
353
356
|
*/
|
|
354
|
-
|
|
355
357
|
/** Control if the deleted message is visible to both the send and reciever, either of them or none */
|
|
356
358
|
deletedMessagesVisibilityType?: DeletedMessagesVisibilityType;
|
|
357
359
|
|
|
358
360
|
disableTypingIndicator?: boolean;
|
|
359
|
-
|
|
360
361
|
/**
|
|
361
362
|
* Whether messages should be aligned to right or left part of screen.
|
|
362
363
|
* By default, messages will be received messages will be aligned to left and
|
|
363
364
|
* sent messages will be aligned to right.
|
|
364
365
|
*/
|
|
365
366
|
forceAlignMessages?: Alignment | boolean;
|
|
367
|
+
|
|
366
368
|
getMessagesGroupStyles?: typeof getGroupStyles;
|
|
367
369
|
/**
|
|
368
370
|
* Handler to access when a ban user action is invoked.
|
|
@@ -377,6 +379,8 @@ export type MessagesContextValue<
|
|
|
377
379
|
handleEdit?: (message: MessageType<StreamChatGenerics>) => void;
|
|
378
380
|
/** Handler to access when a flag message action is invoked */
|
|
379
381
|
handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
382
|
+
/** Handler to access when a mark unread action is invoked */
|
|
383
|
+
handleMarkUnread?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
380
384
|
/** Handler to access when a mute user action is invoked */
|
|
381
385
|
handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;
|
|
382
386
|
/** Handler to access when a pin/unpin user action is invoked*/
|
|
@@ -440,6 +444,7 @@ export type MessagesContextValue<
|
|
|
440
444
|
* deleteMessage,
|
|
441
445
|
* editMessage,
|
|
442
446
|
* flagMessage,
|
|
447
|
+
* markUnread,
|
|
443
448
|
* muteUser,
|
|
444
449
|
* quotedReply,
|
|
445
450
|
* retry,
|
|
@@ -428,6 +428,12 @@ export type Theme = {
|
|
|
428
428
|
chevronColor?: ColorValue;
|
|
429
429
|
};
|
|
430
430
|
typingIndicatorContainer: ViewStyle;
|
|
431
|
+
unreadMessagesNotification: {
|
|
432
|
+
closeButtonContainer: ViewStyle;
|
|
433
|
+
closeIcon: IconProps;
|
|
434
|
+
container: ViewStyle;
|
|
435
|
+
text: TextStyle;
|
|
436
|
+
};
|
|
431
437
|
};
|
|
432
438
|
messageMenu: {
|
|
433
439
|
actionList: {
|
|
@@ -1168,6 +1174,12 @@ export const defaultTheme: Theme = {
|
|
|
1168
1174
|
wrapper: {},
|
|
1169
1175
|
},
|
|
1170
1176
|
typingIndicatorContainer: {},
|
|
1177
|
+
unreadMessagesNotification: {
|
|
1178
|
+
closeButtonContainer: {},
|
|
1179
|
+
closeIcon: {},
|
|
1180
|
+
container: {},
|
|
1181
|
+
text: {},
|
|
1182
|
+
},
|
|
1171
1183
|
},
|
|
1172
1184
|
messageMenu: {
|
|
1173
1185
|
actionList: {
|
package/src/i18n/en.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Error loading",
|
|
33
33
|
"Error loading channel list...": "Error loading channel list...",
|
|
34
34
|
"Error loading messages for this channel...": "Error loading messages for this channel...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Error while loading, please reload/refresh",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "File is too large: {{ size }}, maximum upload size is {{ limit }}",
|
|
37
38
|
"File type not supported": "File type not supported",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Loading messages...",
|
|
49
50
|
"Loading threads...": "Loading threads...",
|
|
50
51
|
"Loading...": "Loading...",
|
|
52
|
+
"Mark as Unread": "Mark as Unread",
|
|
51
53
|
"Maximum number of files reached": "Maximum number of files reached",
|
|
52
54
|
"Maximum votes per person": "Maximum votes per person",
|
|
53
55
|
"Message Reactions": "Message Reactions",
|
package/src/i18n/es.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Error al cargar",
|
|
33
33
|
"Error loading channel list...": "Error al cargar la lista de canales...",
|
|
34
34
|
"Error loading messages for this channel...": "Error al cargar los mensajes de este canal...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Error al marcar el mensaje como no leído. No se pueden marcar mensajes no leídos más antiguos que los 100 mensajes más recientes del canal.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Error al cargar, por favor recarga/actualiza",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "El archivo es demasiado grande: {{ size }}, el tamaño máximo de carga es de {{ limit }}",
|
|
37
38
|
"File type not supported": "Tipo de archivo no admitido",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Cargando mensajes...",
|
|
49
50
|
"Loading threads...": "Cargando hilos...",
|
|
50
51
|
"Loading...": "Cargando...",
|
|
52
|
+
"Mark as Unread": "Marcar como no leído",
|
|
51
53
|
"Maximum number of files reached": "Número máximo de archivos alcanzado",
|
|
52
54
|
"Maximum votes per person": "Máximo de votos por persona",
|
|
53
55
|
"Message Reactions": "Reacciones al mensaje",
|
package/src/i18n/fr.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Erreur lors du chargement",
|
|
33
33
|
"Error loading channel list...": "Erreur lors du chargement de la liste de canaux...",
|
|
34
34
|
"Error loading messages for this channel...": "Erreur lors du chargement des messages de ce canal...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Erreur lors du marquage du message comme non lu. Impossible de marquer les messages non lus plus anciens que les 100 derniers messages du canal.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Erreur lors du chargement, veuillez recharger/rafraîchir",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "Le fichier est trop volumineux : {{ size }}, la taille de téléchargement maximale est de {{ limit }}",
|
|
37
38
|
"File type not supported": "Le type de fichier n'est pas pris en charge",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Chargement des messages...",
|
|
49
50
|
"Loading threads...": "Chargement des fils...",
|
|
50
51
|
"Loading...": "Chargement...",
|
|
52
|
+
"Mark as Unread": "Marquer comme non lu",
|
|
51
53
|
"Maximum number of files reached": "Nombre maximal de fichiers atteint",
|
|
52
54
|
"Maximum votes per person": "Maximum de votes par personne",
|
|
53
55
|
"Message Reactions": "Réactions aux messages",
|
package/src/i18n/he.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "שגיאה ארעה בעת הטעינה",
|
|
33
33
|
"Error loading channel list...": "שגיאה ארעה בטעינת השיחות...",
|
|
34
34
|
"Error loading messages for this channel...": "שגיאה ארעה בטעינת הודעות עבור שיחה זאת...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "שגיאה ארעה בסימון ההודעה כלא נקרא. אין אפשרות לסמן הודעות כלא נקראות שהן ישנות מה-100 ההודעות האחרונות בשיחה.",
|
|
35
36
|
"Error while loading, please reload/refresh": "שגיאה ארעה בזמן הטעינה, אנא טען מחדש/רענן",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "הקובץ גדול מדי: {{ size }}, גודל העלאה מקסימלי הוא {{ limit }}",
|
|
37
38
|
"File type not supported": "סוג הקובץ אינו נתמך",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "ההודעות בטעינה..",
|
|
49
50
|
"Loading threads...": "טוען שרשורים...",
|
|
50
51
|
"Loading...": "טוען...",
|
|
52
|
+
"Mark as Unread": "סמן כלא נקרא",
|
|
51
53
|
"Maximum number of files reached": "הגעת למספר המרבי של קבצים",
|
|
52
54
|
"Maximum votes per person": "מקסימום הצבעות לאדם",
|
|
53
55
|
"Message Reactions": "תגובות להודעה",
|
package/src/i18n/hi.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "लोड होने मे त्रुटि",
|
|
33
33
|
"Error loading channel list...": "चैनल सूची लोड करने में त्रुटि...",
|
|
34
34
|
"Error loading messages for this channel...": "इस चैनल के लिए मेसेजेस लोड करने में त्रुटि हुई...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "संदेश को अनरीड चिह्नित करने में त्रुटि। चैनल के नवीनतम 100 संदेशों से पुराने संदेशों को अनरीड चिह्नित नहीं किया जा सकता।",
|
|
35
36
|
"Error while loading, please reload/refresh": "एरर, रिफ्रेश करे",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "फ़ाइल बहुत बड़ी है: {{ size }}, अधिकतम अपलोड साइज़ {{ limit }} है",
|
|
37
38
|
"File type not supported": "फ़ाइल प्रकार समर्थित नहीं है",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "मेसेजस लोड हो रहे हैं...",
|
|
49
50
|
"Loading threads...": "थ्रेड्स लोड हो रहे हैं...",
|
|
50
51
|
"Loading...": "लोड हो रहा है...",
|
|
52
|
+
"Mark as Unread": "अपठित मार्क करें",
|
|
51
53
|
"Maximum number of files reached": "फ़ाइलों की अधिकतम संख्या पहुँच गई",
|
|
52
54
|
"Maximum votes per person": "प्रति व्यक्ति अधिकतम वोट",
|
|
53
55
|
"Message Reactions": "संदेश प्रतिक्रियाएँ",
|
package/src/i18n/it.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Errore di caricamento",
|
|
33
33
|
"Error loading channel list...": "Errore durante il caricamento della lista dei canali...",
|
|
34
34
|
"Error loading messages for this channel...": "Errore durante il caricamento dei messaggi per questo canale...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Errore durante il contrassegno del messaggio come non letto. Non è possibile contrassegnare i messaggi non letti più vecchi dei 100 messaggi più recenti del canale.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Errore durante il caricamento, per favore ricarica la pagina",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "Il file è troppo grande: {{ size }}, la dimensione massima di caricamento è {{ limit }}",
|
|
37
38
|
"File type not supported": "Tipo di file non supportato",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Caricamento messaggi...",
|
|
49
50
|
"Loading threads...": "Caricamento dei thread...",
|
|
50
51
|
"Loading...": "Caricamento...",
|
|
52
|
+
"Mark as Unread": "Segna come non letto",
|
|
51
53
|
"Maximum number of files reached": "Numero massimo di file raggiunto",
|
|
52
54
|
"Maximum votes per person": "Massimo voti per persona",
|
|
53
55
|
"Message Reactions": "Reazioni ai Messaggi",
|
package/src/i18n/ja.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "読み込みエラー",
|
|
33
33
|
"Error loading channel list...": "チャネルリストの読み込み中にエラーが発生しました。。。",
|
|
34
34
|
"Error loading messages for this channel...": "このチャネルのメッセージの読み込み中にエラーが発生しました。。。",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "メッセージを未読にする際にエラーが発生しました。最新の100件のチャネルメッセージより古い未読メッセージはマークできません。",
|
|
35
36
|
"Error while loading, please reload/refresh": "ロード中にエラーが発生しました。更新してください",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "ファイルが大きすぎます:{{ size }}、最大アップロードサイズは{{ limit }}です",
|
|
37
38
|
"File type not supported": "サポートされていないファイルです",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "メッセージを読み込み中。。。",
|
|
49
50
|
"Loading threads...": "スレッドを読み込み中...",
|
|
50
51
|
"Loading...": "読み込み中。。。",
|
|
52
|
+
"Mark as Unread": "未読としてマーク",
|
|
51
53
|
"Maximum number of files reached": "ファイルの最大数に達しました",
|
|
52
54
|
"Maximum votes per person": "1人あたりの最大投票数",
|
|
53
55
|
"Message Reactions": "メッセージのリアクション",
|
package/src/i18n/ko.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "로드 오류",
|
|
33
33
|
"Error loading channel list...": "채널리스트 을로드하는 동안 오류가 발생했습니다...",
|
|
34
34
|
"Error loading messages for this channel...": "이 채널의 메시지를로드하는 동안 오류가 발생했습니다...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "메시지를 읽지 않음으로 표시하는 중 오류가 발생했습니다. 최신 100개의 채널 메시지보다 오래된 읽지 않은 메시지는 표시할 수 없습니다.",
|
|
35
36
|
"Error while loading, please reload/refresh": "로드하는 동안 오류가 발생했습니다. 다시로드하십시오",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "파일이 너무 큽니다: {{ size }}, 최대 업로드 크기는 {{ limit }}입니다",
|
|
37
38
|
"File type not supported": "지원하지 않는 파일입니다.",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "메시지를 로딩 중...",
|
|
49
50
|
"Loading threads...": "스레드 로딩 중...",
|
|
50
51
|
"Loading...": "로딩 중...",
|
|
52
|
+
"Mark as Unread": "읽지 않음으로 표시",
|
|
51
53
|
"Maximum number of files reached": "최대 파일 수에 도달했습니다",
|
|
52
54
|
"Maximum votes per person": "사람당 최대 투표 수",
|
|
53
55
|
"Message Reactions": "메시지의 리액션",
|
package/src/i18n/nl.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Probleem bij het laden",
|
|
33
33
|
"Error loading channel list...": "Probleem bij het laden van de kanalen...",
|
|
34
34
|
"Error loading messages for this channel...": "Probleem bij het laden van de berichten in dit kanaal...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Fout bij markeren als ongelezen. Kan ongelezen berichten ouder dan de nieuwste 100 kanaalberichten niet markeren.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Probleem bij het laden, probeer opnieuw",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "Bestand is te groot: {{ size }}, maximale uploadgrootte is {{ limit }}",
|
|
37
38
|
"File type not supported": "Bestandstype niet ondersteund",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Berichten aan het laden...",
|
|
49
50
|
"Loading threads...": "Threads laden...",
|
|
50
51
|
"Loading...": "Aan het laden...",
|
|
52
|
+
"Mark as Unread": "Markeer als ongelezen",
|
|
51
53
|
"Maximum number of files reached": "Maximaal aantal bestanden bereikt",
|
|
52
54
|
"Maximum votes per person": "Maximaal aantal stemmen per persoon",
|
|
53
55
|
"Message Reactions": "Bericht Reacties",
|
package/src/i18n/pt-br.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Erro ao carregar",
|
|
33
33
|
"Error loading channel list...": "Erro ao carregar lista de canais...",
|
|
34
34
|
"Error loading messages for this channel...": "Erro ao carregar mensagens para este canal...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Erro ao marcar mensagem como não lida. Não é possível marcar mensagens não lidas mais antigas que as 100 mensagens mais recentes do canal.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Erro ao carregar, por favor recarregue/atualize",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "O arquivo é muito grande: {{ size }}, o tamanho máximo de upload é {{ limit }}",
|
|
37
38
|
"File type not supported": "Tipo de arquivo não suportado",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Carregando mensagens...",
|
|
49
50
|
"Loading threads...": "Carregando tópicos...",
|
|
50
51
|
"Loading...": "Carregando...",
|
|
52
|
+
"Mark as Unread": "Marcar como não lido",
|
|
51
53
|
"Maximum number of files reached": "Número máximo de arquivos atingido",
|
|
52
54
|
"Maximum votes per person": "Máximo de votos por pessoa",
|
|
53
55
|
"Message Reactions": "Reações à Mensagem",
|
package/src/i18n/ru.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Ошибка при загрузке",
|
|
33
33
|
"Error loading channel list...": "Ошибка загрузки списка каналов...",
|
|
34
34
|
"Error loading messages for this channel...": "Ошибка загрузки сообщений для этого канала...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Ошибка при отметке сообщения как непрочитанного. Невозможно отметить непрочитанные сообщения старше новейших 100 сообщений канала.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Ошибка загрузки, пожалуйста перезагрузите или обновите",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "Файл слишком большой: {{ size }}, максимальный размер загрузки составляет {{ limit }}",
|
|
37
38
|
"File type not supported": "Тип файла не поддерживается",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Загружаю сообщения...",
|
|
49
50
|
"Loading threads...": "Загрузка потоков...",
|
|
50
51
|
"Loading...": "Загружаю...",
|
|
52
|
+
"Mark as Unread": "Отметить как непрочитанное",
|
|
51
53
|
"Maximum number of files reached": "Достигнуто максимальное количество файлов",
|
|
52
54
|
"Maximum votes per person": "Максимальное количество голосов на человека",
|
|
53
55
|
"Message Reactions": "Сообщения Реакции",
|
package/src/i18n/tr.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"Error loading": "Yükleme hatası",
|
|
33
33
|
"Error loading channel list...": "Kanal listesi yüklenirken hata oluştu...",
|
|
34
34
|
"Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
|
|
35
|
+
"Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.": "Okunmamış olarak işaretlenen mesajda hata oluştu. En yeni 100 kanal mesajından daha eski okunmamış mesajları işaretleyemezsiniz.",
|
|
35
36
|
"Error while loading, please reload/refresh": "Yüklenirken hata oluştu, lütfen tekrar deneyiniz",
|
|
36
37
|
"File is too large: {{ size }}, maximum upload size is {{ limit }}": "Dosya çok büyük: {{ size }}, maksimum yükleme boyutu {{ limit }}",
|
|
37
38
|
"File type not supported": "Dosya türü desteklenmiyor",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"Loading messages...": "Mesajlar yükleniyor...",
|
|
49
50
|
"Loading threads...": "Akışlar yükleniyor...",
|
|
50
51
|
"Loading...": "Yükleniyor...",
|
|
52
|
+
"Mark as Unread": "Okunmamış olarak işaretle",
|
|
51
53
|
"Maximum number of files reached": "Maksimum dosya sayısına ulaşıldı",
|
|
52
54
|
"Maximum votes per person": "Kişi başına maksimum oy",
|
|
53
55
|
"Message Reactions": "Mesaj Tepkileri",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Svg, { Path } from 'react-native-svg';
|
|
4
|
+
|
|
5
|
+
import { IconProps } from './utils/base';
|
|
6
|
+
|
|
7
|
+
type Props = IconProps & {
|
|
8
|
+
size: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const UnreadIndicator = ({ size, ...rest }: Props) => (
|
|
12
|
+
<Svg height={size} viewBox={`0 0 ${size} ${size}`} width={size} {...rest}>
|
|
13
|
+
<Path
|
|
14
|
+
d='M22 7.98V17C22 18.1 21.1 19 20 19H6L2 23V5C2 3.9 2.9 3 4 3H14.1C14.04 3.32 14 3.66 14 4C14 4.34 14.04 4.68 14.1 5H4V17H20V8.9C20.74 8.75 21.42 8.42 22 7.98ZM16 4C16 5.66 17.34 7 19 7C20.66 7 22 5.66 22 4C22 2.34 20.66 1 19 1C17.34 1 16 2.34 16 4Z'
|
|
15
|
+
{...rest}
|
|
16
|
+
/>
|
|
17
|
+
</Svg>
|
|
18
|
+
);
|
package/src/icons/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ import type { PreparedQueries, Table } from './types';
|
|
|
28
28
|
* This way usage @op-engineering/op-sqlite package is scoped to a single class/file.
|
|
29
29
|
*/
|
|
30
30
|
export class SqliteClient {
|
|
31
|
-
static dbVersion =
|
|
31
|
+
static dbVersion = 8;
|
|
32
32
|
|
|
33
33
|
static dbName = DB_NAME;
|
|
34
34
|
static dbLocation = DB_LOCATION;
|
package/src/store/schema.ts
CHANGED
|
@@ -194,6 +194,7 @@ export const tables: Tables = {
|
|
|
194
194
|
columns: {
|
|
195
195
|
cid: 'TEXT NOT NULL',
|
|
196
196
|
lastRead: 'TEXT NOT NULL',
|
|
197
|
+
lastReadMessageId: 'TEXT',
|
|
197
198
|
unreadMessages: 'INTEGER DEFAULT 0',
|
|
198
199
|
userId: 'TEXT',
|
|
199
200
|
},
|
|
@@ -340,6 +341,7 @@ export type Schema = {
|
|
|
340
341
|
reads: {
|
|
341
342
|
cid: string;
|
|
342
343
|
lastRead: string;
|
|
344
|
+
lastReadMessageId?: string;
|
|
343
345
|
unreadMessages?: number;
|
|
344
346
|
userId?: string;
|
|
345
347
|
};
|
package/src/types/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtendableGenerics, LiteralStringForUnion } from 'stream-chat';
|
|
1
|
+
import type { ChannelState, ExtendableGenerics, LiteralStringForUnion } from 'stream-chat';
|
|
2
2
|
|
|
3
3
|
import type { FileStateValue } from '../utils/utils';
|
|
4
4
|
|
|
@@ -101,8 +101,11 @@ export type UnknownType = Record<string, unknown>;
|
|
|
101
101
|
|
|
102
102
|
export type ValueOf<T> = T[keyof T];
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
export type ChannelUnreadState<
|
|
105
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
106
|
+
> = Omit<ValueOf<ChannelState<StreamChatGenerics>['read']>, 'user'>;
|
|
105
107
|
|
|
108
|
+
// ASYNC AUDIO EXPO:
|
|
106
109
|
export enum AndroidOutputFormat {
|
|
107
110
|
DEFAULT = 0,
|
|
108
111
|
THREE_GPP = 1,
|
package/src/utils/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import EmojiRegex from 'emoji-regex';
|
|
5
|
-
import type { FormatMessageResponse, MessageResponse } from 'stream-chat';
|
|
5
|
+
import type { ChannelState, FormatMessageResponse, MessageResponse } from 'stream-chat';
|
|
6
6
|
|
|
7
7
|
import { IconProps } from '../../src/icons/utils/base';
|
|
8
8
|
import { MessageType } from '../components/MessageList/hooks/useMessageList';
|
|
@@ -275,3 +275,63 @@ export const getDurationLabelFromDuration = (duration: number) => {
|
|
|
275
275
|
export function escapeRegExp(text: string) {
|
|
276
276
|
return text.replace(/[-[\]{}()*+?.,/\\^$|#]/g, '\\$&');
|
|
277
277
|
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Utility to find the index of a message in the messages array by id.
|
|
281
|
+
* @param messages
|
|
282
|
+
* @param targetId
|
|
283
|
+
* @returns number
|
|
284
|
+
*/
|
|
285
|
+
export const findInMessagesById = <
|
|
286
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
287
|
+
>(
|
|
288
|
+
messages: ChannelState<StreamChatGenerics>['messages'],
|
|
289
|
+
targetId: string,
|
|
290
|
+
) => {
|
|
291
|
+
const idx = messages.findIndex((message) => message.id === targetId);
|
|
292
|
+
return idx;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Utility to find the index of a message in the messages array by date.
|
|
297
|
+
* @param messages
|
|
298
|
+
* @param targetDate
|
|
299
|
+
* @returns an object with the index and the message object
|
|
300
|
+
*/
|
|
301
|
+
export const findInMessagesByDate = <
|
|
302
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
303
|
+
>(
|
|
304
|
+
messages: MessageResponse<StreamChatGenerics>[] | ChannelState<StreamChatGenerics>['messages'],
|
|
305
|
+
targetDate: Date,
|
|
306
|
+
) => {
|
|
307
|
+
// Binary search
|
|
308
|
+
const targetTimestamp = targetDate.getTime();
|
|
309
|
+
let left = 0;
|
|
310
|
+
let right = messages.length - 1;
|
|
311
|
+
let middle = 0;
|
|
312
|
+
while (left <= right) {
|
|
313
|
+
middle = Math.floor(left + (right - left) / 2);
|
|
314
|
+
const middleTimestamp = new Date(messages[middle].created_at as string | Date).getTime();
|
|
315
|
+
const middleLeftTimestamp =
|
|
316
|
+
messages[middle - 1]?.created_at &&
|
|
317
|
+
new Date(messages[middle - 1].created_at as string | Date).getTime();
|
|
318
|
+
const middleRightTimestamp =
|
|
319
|
+
messages[middle + 1]?.created_at &&
|
|
320
|
+
new Date(messages[middle + 1].created_at as string | Date).getTime();
|
|
321
|
+
if (
|
|
322
|
+
middleTimestamp === targetTimestamp ||
|
|
323
|
+
(middleLeftTimestamp &&
|
|
324
|
+
middleRightTimestamp &&
|
|
325
|
+
middleLeftTimestamp < targetTimestamp &&
|
|
326
|
+
middleRightTimestamp > targetTimestamp)
|
|
327
|
+
) {
|
|
328
|
+
return { index: middle, message: messages[middle] };
|
|
329
|
+
} else if (middleTimestamp < targetTimestamp) {
|
|
330
|
+
left = middle + 1;
|
|
331
|
+
} else {
|
|
332
|
+
right = middle - 1;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return { index: -1 };
|
|
337
|
+
};
|
package/src/version.json
CHANGED