Skip to content

Commit 0e5a3ef

Browse files
authored
fix: remove deprecated code from v6 branch (#2702)
* fix: remove deprecated code from v6 branch * fix: remove deprecated code from v6 branch * docs: add deprecated docs * docs: add deprecated docs * chore: resolve conflicts from base branch * docs: improve deprecated docs
1 parent 61fa097 commit 0e5a3ef

File tree

36 files changed

+30
-864
lines changed

36 files changed

+30
-864
lines changed

docusaurus/docs/reactnative/basics/migrating-from-5.x-to-6.x.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ registerNativeHandlers({
186186

187187
The type of `quotedMessage` is changed from `MessageType | boolean` to `MessageType | undefined` for better in the `MessageInputContext`.
188188

189+
#### Remove the deprecated code
190+
191+
- We have removed `loadChannelAtMessage` from channel context because it was no more used.
192+
- We have removed the `handleDeleteMessage`, `handleEditMessage`, `handleQuotedReplyMessage`, `handleResendMessage`, `handleToggleBanUser` and `handleToggleMuteUser` from the message context because it was no more used. To customize the message actions follow the [customization documentation](../guides/custom-message-actions.mdx).
193+
- Remove the `onMessageNew` prop from the [`ChannelList`](../core-components/channel-list.mdx) component. Use the [`onNewMessage`](../core-components/channel-list.mdx#onnewmessage) prop instead.
194+
- Remove the `handleBlock` prop from the `Channel` component. Use [`handleBan`](../core-components/channel.mdx#handleban) instead.
195+
189196
## Other changes
190197

191198
- The `useMessageActions` hook doesn't take `setOverlay` anymore but takes in `dismissOverlay`.

docusaurus/docs/reactnative/contexts/channel-context.mdx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,6 @@ loadChannelAroundMessage({
141141
| -------- |
142142
| function |
143143

144-
### loadChannelAtMessage
145-
146-
Function to reload channel at particular message in history.
147-
148-
:::caution
149-
150-
This function is deprecated. Use [loadChannelAroundMessage](#loadchannelaroundmessage) instead.
151-
152-
:::
153-
154-
```tsx
155-
loadChannelAtMessage({
156-
before: 10, // Number of messages to load before messageId
157-
after: 10, // Number of messages to load after messageId
158-
messageId,
159-
});
160-
```
161-
162-
| Type |
163-
| -------- |
164-
| function |
165-
166144
### loading
167145

168146
True if channel is loading messages during first load.

docusaurus/docs/reactnative/contexts/message-context.mdx

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -90,54 +90,6 @@ True if one of the following condition is true:
9090

9191
<HandleAction />
9292

93-
### handleDeleteMessage
94-
95-
Callback function for "Delete Message" action.
96-
97-
| Type |
98-
| -------- |
99-
| function |
100-
101-
### handleEditMessage
102-
103-
Callback function for "Edit Message" action.
104-
105-
| Type |
106-
| -------- |
107-
| function |
108-
109-
### handleQuotedReplyMessage
110-
111-
Callback function for "Quoted Reply" action.
112-
113-
| Type |
114-
| -------- |
115-
| function |
116-
117-
### handleResendMessage
118-
119-
Callback function for "Resend Message" (for failed message) action.
120-
121-
| Type |
122-
| -------- |
123-
| function |
124-
125-
### handleToggleBanUser
126-
127-
Callback function for "Ban/Unban User" action.
128-
129-
| Type |
130-
| -------- |
131-
| function |
132-
133-
### handleToggleMuteUser
134-
135-
Callback function for "Mute/Unmute User" action.
136-
137-
| Type |
138-
| -------- |
139-
| function |
140-
14193
### handleToggleReaction
14294

14395
Callback function for toggling reaction from reaction selector.

docusaurus/docs/reactnative/contexts/messages-context.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import Gallery from '../common-content/ui-components/channel/props/gallery.mdx';
2626
import Giphy from '../common-content/ui-components/channel/props/giphy.mdx';
2727
import GiphyVersion from '../common-content/ui-components/channel/props/giphy_version.mdx';
2828
import HandleBan from '../common-content/ui-components/channel/props/handle_ban.mdx';
29-
import HandleBlock from '../common-content/ui-components/channel/props/handle_block.mdx';
3029
import HandleCopy from '../common-content/ui-components/channel/props/handle_copy.mdx';
3130
import HandleDelete from '../common-content/ui-components/channel/props/handle_delete.mdx';
3231
import HandleEdit from '../common-content/ui-components/channel/props/handle_edit.mdx';
@@ -122,10 +121,6 @@ Id of current channel.
122121

123122
<HandleBan />
124123

125-
### <div class="label description">_forwarded from [Channel](../../core-components/channel#handleblock)_ props</div> `handleBlock` {#handleblock}
126-
127-
<HandleBlock />
128-
129124
### <div class="label description">_forwarded from [Channel](../../core-components/channel#handlecopy)_ props</div> `handleCopy` {#handlecopy}
130125

131126
<HandleCopy />

docusaurus/docs/reactnative/contexts/overlay-context.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Detailed information on theming can be found in the [customization documentation
5252
:::note
5353

5454
Themes are inherited from parent providers.
55-
A [theme provided to the `OverlayProvider`](./overlay-provider.mdx#value) will be the base theme `style` is merged into.
55+
A [theme provided to the `OverlayProvider`](../core-components/overlay-provider.mdx#value) will be the base theme `style` is merged into.
5656
Themes are not hoisted though, therefore a theme provided to `Chat` will not change overlay components such as the attachment picker.
5757

5858
:::

docusaurus/docs/reactnative/core-components/channel-list.mdx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,6 @@ Override for the default Event Listener behavior when a channel is updated. Th
218218
| setChannels | Setter function for the internal channels state |
219219
| event | [Event Object](https://getstream.io/chat/docs/react/event_object/#event-object) corresponding to channel.deleted |
220220

221-
### `onMessageNew`
222-
223-
Override for the default Event Listener behavior when a message is received on a channel that is not being watched. The default behavior adds the channel to the list.
224-
225-
> Warning: This function is deprecated. Use **[`onNewMessageNotification`](#onNewMessageNotification)** instead.
226-
227-
| Type |
228-
| -------- |
229-
| Function |
230-
231-
| Parameter | Description |
232-
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
233-
| setChannels | Setter function for the internal channels state |
234-
| event | [Event Object](https://getstream.io/chat/docs/react/event_object/#event-object) corresponding to channel.deleted |
235-
236221
### **`onNewMessageNotification`**
237222

238223
Override for the default Event Listener behavior when a message is received on a channel that is not being watched. The default behavior adds the channel to the list.

docusaurus/docs/reactnative/core-components/channel.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ import GiphyEnabled from '../common-content/ui-components/channel/props/giphy_en
6565
import GiphyVersion from '../common-content/ui-components/channel/props/giphy_version.mdx';
6666
import HandleAttachButtonPress from '../common-content/ui-components/channel/props/handle_attach_button_press.mdx';
6767
import HandleBan from '../common-content/ui-components/channel/props/handle_ban.mdx';
68-
import HandleBlock from '../common-content/ui-components/channel/props/handle_block.mdx';
6968
import HandleCopy from '../common-content/ui-components/channel/props/handle_copy.mdx';
7069
import HandleDelete from '../common-content/ui-components/channel/props/handle_delete.mdx';
7170
import HandleEdit from '../common-content/ui-components/channel/props/handle_edit.mdx';
@@ -499,10 +498,6 @@ The max allowable is 255, which when reached displays as `255+`.
499498

500499
<HandleBan />
501500

502-
### `handleBlock`
503-
504-
<HandleBlock />
505-
506501
### `handleCopy`
507502

508503
<HandleCopy />

docusaurus/docs/reactnative/guides/custom-message-actions.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can customize each one of the default actions using props on the [`Channel c
3232

3333
The channel component accepts a prop called `messageActions`. You can use this prop as a callback function to render message actions selectively.
3434

35-
The arguments to this function is an object with all the default message actions as [`MessageActionType`](#messageaction) objects. The function should return an array of MessageAction objects to render in a [MessageActionList](../common-content/ui-components/channel/props/message_action_list.mdx) within the message menu, that is shown when a user long presses a message in a MessageList.
35+
The arguments to this function is an object with all the default message actions as [`MessageActionType`](#messageaction) objects. The function should return an array of MessageAction objects to render in a [MessageActionList](../common-content/ui-components/channel/props/message-action-list.mdx) within the message menu, that is shown when a user long presses a message in a MessageList.
3636

3737
You can also customize each one of the default actions using the `messageActions` prop passed to the Channel component as shown in the example below.
3838

@@ -373,7 +373,6 @@ Please note that these intercepts will neither change the standard functions nor
373373
:::
374374
375375
- `handleBan`
376-
- `handleBlock`(deprecated)
377376
- `handleCopy`
378377
- `handleDelete`
379378
- `handleEdit`

package/src/components/Channel/Channel.tsx

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ export type ChannelPropsWithContext<
288288
| 'Giphy'
289289
| 'giphyVersion'
290290
| 'handleBan'
291-
| 'handleBlock'
292291
| 'handleCopy'
293292
| 'handleDelete'
294293
| 'handleEdit'
@@ -506,7 +505,6 @@ const ChannelWithContext = <
506505
giphyVersion = 'fixed_height',
507506
handleAttachButtonPress,
508507
handleBan,
509-
handleBlock,
510508
handleCopy,
511509
handleDelete,
512510
handleEdit,
@@ -1102,28 +1100,6 @@ const ChannelWithContext = <
11021100
// eslint-disable-next-line react-hooks/exhaustive-deps
11031101
}, [targetedMessage]);
11041102

1105-
/**
1106-
* @deprecated use loadChannelAroundMessage instead
1107-
*
1108-
* Loads channel at specific message
1109-
*
1110-
* @param messageId If undefined, channel will be loaded at most recent message.
1111-
* @param before Number of message to query before messageId
1112-
* @param after Number of message to query after messageId
1113-
*/
1114-
const loadChannelAtMessage: ChannelContextValue<StreamChatGenerics>['loadChannelAtMessage'] = ({
1115-
after = 2,
1116-
before = 30,
1117-
messageId,
1118-
}) =>
1119-
channelQueryCallRef.current(async () => {
1120-
await queryAtMessage({ after, before, messageId });
1121-
1122-
if (messageId) {
1123-
setTargetedMessage(messageId);
1124-
}
1125-
});
1126-
11271103
/**
11281104
* Utility method to mark that current set if latest into two.
11291105
* With an empty latest set
@@ -1419,95 +1395,6 @@ const ChannelWithContext = <
14191395
setHasNoMoreRecentMessagesToLoad(true);
14201396
});
14211397

1422-
/**
1423-
* @deprecated
1424-
* Makes a query to load messages at particular message id.
1425-
*
1426-
* @param messageId Targeted message id
1427-
* @param before Number of messages to load before messageId
1428-
* @param after Number of messages to load after messageId
1429-
*/
1430-
const queryAtMessage = async ({
1431-
after = 10,
1432-
before = 10,
1433-
messageId,
1434-
}: Parameters<ChannelContextValue<StreamChatGenerics>['loadChannelAtMessage']>[0]) => {
1435-
if (!channel) return;
1436-
channel.state.setIsUpToDate(false);
1437-
hasOverlappingRecentMessagesRef.current = false;
1438-
clearInterval(mergeSetsIntervalRef.current);
1439-
channel.state.clearMessages();
1440-
setMessages([]);
1441-
if (!messageId) {
1442-
await channel.query({
1443-
messages: {
1444-
limit: before,
1445-
},
1446-
watch: true,
1447-
});
1448-
1449-
channel.state.setIsUpToDate(true);
1450-
return;
1451-
}
1452-
1453-
await queryBeforeMessage(messageId, before);
1454-
await queryAfterMessage(messageId, after);
1455-
};
1456-
1457-
/**
1458-
* @deprecated
1459-
* Makes a query to load messages before particular message id.
1460-
*
1461-
* @param messageId Targeted message id
1462-
* @param limit Number of messages to load
1463-
*/
1464-
const queryBeforeMessage = async (messageId: string, limit = 5) => {
1465-
if (!channel) return;
1466-
1467-
await channel.query({
1468-
messages: {
1469-
id_lt: messageId,
1470-
limit,
1471-
},
1472-
watch: true,
1473-
});
1474-
1475-
channel.state.setIsUpToDate(false);
1476-
};
1477-
1478-
/**
1479-
* @deprecated
1480-
* Makes a query to load messages later than particular message id.
1481-
*
1482-
* @param messageId Targeted message id
1483-
* @param limit Number of messages to load.
1484-
*/
1485-
const queryAfterMessage = async (messageId: string, limit = 5) => {
1486-
if (!channel) return;
1487-
const state = await channel.query({
1488-
messages: {
1489-
id_gte: messageId,
1490-
limit,
1491-
},
1492-
watch: true,
1493-
});
1494-
1495-
if (state.messages.length < limit) {
1496-
// make current set as the latest
1497-
const currentSet = channel.state.messageSets.find((set) => set.isCurrent);
1498-
if (currentSet && !currentSet.isLatest) {
1499-
channel.state.messageSets = channel.state.messageSets.filter((set) => !set.isLatest);
1500-
currentSet.isLatest = true;
1501-
}
1502-
channel.state.setIsUpToDate(true);
1503-
setHasNoMoreRecentMessagesToLoad(true);
1504-
} else {
1505-
splitLatestCurrentMessageSetRef.current();
1506-
channel.state.setIsUpToDate(false);
1507-
setHasNoMoreRecentMessagesToLoad(false);
1508-
}
1509-
};
1510-
15111398
// In case the channel is disconnected which may happen when channel is deleted,
15121399
// underlying js client throws an error. Following function ensures that Channel component
15131400
// won't result in error in such a case.
@@ -2229,7 +2116,6 @@ const ChannelWithContext = <
22292116
isOwner,
22302117
lastRead,
22312118
loadChannelAroundMessage,
2232-
loadChannelAtMessage,
22332119
loading,
22342120
LoadingIndicator,
22352121
markRead,
@@ -2360,7 +2246,6 @@ const ChannelWithContext = <
23602246
Giphy,
23612247
giphyVersion,
23622248
handleBan,
2363-
handleBlock,
23642249
handleCopy,
23652250
handleDelete,
23662251
handleEdit,

package/src/components/Channel/hooks/useCreateChannelContext.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const useCreateChannelContext = <
2121
isOwner,
2222
lastRead,
2323
loadChannelAroundMessage,
24-
loadChannelAtMessage,
2524
loading,
2625
LoadingIndicator,
2726
markRead,
@@ -65,7 +64,6 @@ export const useCreateChannelContext = <
6564
isOwner,
6665
lastRead,
6766
loadChannelAroundMessage,
68-
loadChannelAtMessage,
6967
loading,
7068
LoadingIndicator,
7169
markRead,

0 commit comments

Comments
 (0)