Skip to content

Commit d08082f

Browse files
committed
Merge branch 'attachment-manager-integration' of github.com:GetStream/stream-chat-react-native into attachment-manager-integration
2 parents 9a88c07 + 937931f commit d08082f

File tree

9 files changed

+53
-29
lines changed

9 files changed

+53
-29
lines changed

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"path": "0.12.7",
7979
"react-native-markdown-package": "1.8.2",
8080
"react-native-url-polyfill": "^1.3.0",
81-
"stream-chat": "getstream/stream-chat-js#handle-command-injection",
81+
"stream-chat": "^9.5.1",
8282
"use-sync-external-store": "^1.4.0"
8383
},
8484
"peerDependencies": {

package/src/components/AutoCompleteInput/AutoCompleteInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ type AutoCompleteInputPropsWithContext = TextInputProps &
4242
type AutoCompleteInputProps = Partial<AutoCompleteInputPropsWithContext>;
4343

4444
const textComposerStateSelector = (state: TextComposerState) => ({
45-
command: state.command,
45+
// TODO: Comment out once the commands PR has been merged on the LLC
46+
// command: state.command,
47+
command: null,
4648
text: state.text,
4749
});
4850

package/src/components/MessageInput/InputButtons.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export type InputButtonsWithContextProps = Pick<
3535
Pick<OwnCapabilitiesContextValue, 'uploadFile'>;
3636

3737
const textComposerStateSelector = (state: TextComposerState) => ({
38-
command: state.command,
38+
// TODO: Comment out once the commands PR has been merged on the LLC
39+
// command: state.command,
40+
command: null,
3941
hasText: !!state.text,
4042
});
4143

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ type MessageInputPropsWithContext = Partial<
173173
Pick<MessageComposerAPIContextValue, 'clearEditingState'> & { editing: boolean };
174174

175175
const textComposerStateSelector = (state: TextComposerState) => ({
176-
command: state.command,
176+
// TODO: Comment out once the commands PR has been merged on the LLC
177+
// command: state.command,
178+
command: null,
177179
hasText: !!state.text,
178180
mentionedUsers: state.mentionedUsers,
179181
suggestions: state.suggestions,

package/src/components/MessageInput/SendButton.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ export type SendButtonProps = Partial<Pick<MessageInputContextValue, 'sendMessag
2020
disabled: boolean;
2121
};
2222

23+
// TODO: Comment out once the commands PR has been merged on the LLC
24+
// @ts-ignore
2325
const textComposerStateSelector = (state: TextComposerState) => ({
24-
command: state.command,
26+
// TODO: Comment out once the commands PR has been merged on the LLC
27+
// command: state.command,
28+
command: null,
2529
});
2630

2731
export const SendButton = (props: SendButtonProps) => {

package/src/components/MessageInput/components/CommandInput.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export type CommandInputProps = Partial<
2222
disabled: boolean;
2323
};
2424
const textComposerStateSelector = (state: TextComposerState) => ({
25-
command: state.command,
25+
// TODO: Comment out once the commands PR has been merged on the LLC
26+
// command: state.command,
27+
command: null,
28+
text: state.text,
2629
});
2730

2831
export const CommandInput = ({
@@ -49,15 +52,18 @@ export const CommandInput = ({
4952
} = useTheme();
5053

5154
const onCloseHandler = () => {
52-
textComposer.clearCommand();
55+
// TODO: Comment out once the commands PR has been merged on the LLC
56+
// textComposer.clearCommand();
5357
messageComposer?.restore();
5458
};
5559

5660
if (!command) {
5761
return null;
5862
}
5963

60-
const commandName = (command.name ?? '').toUpperCase();
64+
// TODO: Comment out once the commands PR has been merged on the LLC
65+
// const commandName = (command.name ?? '').toUpperCase();
66+
const commandName = '';
6167

6268
return (
6369
<View style={[styles.autoCompleteInputContainer, autoCompleteInputContainer]}>

package/src/contexts/messageInputContext/MessageInputContext.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ import { Alert, Keyboard, Linking, TextInput, TextInputProps } from 'react-nativ
1111

1212
import { BottomSheetHandleProps } from '@gorhom/bottom-sheet';
1313
import {
14+
// createCommandInjectionMiddleware,
15+
// createCommandStringExtractionMiddleware,
16+
// createDraftCommandInjectionMiddleware,
1417
LocalMessage,
1518
Message,
1619
SendMessageOptions,
1720
StreamChat,
1821
Message as StreamMessage,
22+
// TextComposerMiddleware,
1923
UpdateMessageOptions,
2024
UploadRequestFn,
2125
UserResponse,
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
import {
2-
createCommandInjectionMiddleware,
3-
createCommandStringExtractionMiddleware,
4-
createDraftCommandInjectionMiddleware,
2+
// createCommandInjectionMiddleware,
3+
// createCommandStringExtractionMiddleware,
4+
// createDraftCommandInjectionMiddleware,
55
MessageComposer,
6-
TextComposerMiddleware,
6+
// TextComposerMiddleware,
77
} from 'stream-chat';
88

9+
// TODO: Comment out once the commands PR has been merged on the LLC
10+
// @ts-ignore
911
export const setupCommandUIMiddleware = (messageComposer: MessageComposer) => {
10-
messageComposer.compositionMiddlewareExecutor.insert({
11-
middleware: [createCommandInjectionMiddleware(messageComposer)],
12-
position: { after: 'stream-io/message-composer-middleware/attachments' },
13-
});
14-
15-
messageComposer.draftCompositionMiddlewareExecutor.insert({
16-
middleware: [createDraftCommandInjectionMiddleware(messageComposer)],
17-
position: { after: 'stream-io/message-composer-middleware/draft-attachments' },
18-
});
19-
20-
messageComposer.textComposer.middlewareExecutor.insert({
21-
middleware: [createCommandStringExtractionMiddleware() as TextComposerMiddleware],
22-
position: { after: 'stream-io/text-composer/commands-middleware' },
23-
});
12+
// TODO: Comment out once the commands PR has been merged on the LLC
13+
// messageComposer.compositionMiddlewareExecutor.insert({
14+
// middleware: [createCommandInjectionMiddleware(messageComposer)],
15+
// position: { after: 'stream-io/message-composer-middleware/attachments' },
16+
// });
17+
//
18+
// messageComposer.draftCompositionMiddlewareExecutor.insert({
19+
// middleware: [createDraftCommandInjectionMiddleware(messageComposer)],
20+
// position: { after: 'stream-io/message-composer-middleware/draft-attachments' },
21+
// });
22+
//
23+
// messageComposer.textComposer.middlewareExecutor.insert({
24+
// middleware: [createCommandStringExtractionMiddleware() as TextComposerMiddleware],
25+
// position: { after: 'stream-io/text-composer/commands-middleware' },
26+
// });
2427
};

package/yarn.lock

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7827,9 +7827,10 @@ statuses@~1.5.0:
78277827
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
78287828
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
78297829

7830-
stream-chat@getstream/stream-chat-js#handle-command-injection:
7831-
version "0.0.0-development"
7832-
resolved "https://codeload.github.com/getstream/stream-chat-js/tar.gz/780c52cfc3cd7379273a9b8db34461fb935f568d"
7830+
stream-chat@^9.5.1:
7831+
version "9.5.1"
7832+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.5.1.tgz#b8260bc1d1470ae3c91d8c40d22f41e9c4523d7b"
7833+
integrity sha512-X9w22JfEp2cTggAwyt0gyvwe8VBy1qvJENliNen/2FJDpS3k6PCaeSO6MHNXz3c0Qy21hqxuu8/b32jCSe4LSA==
78337834
dependencies:
78347835
"@types/jsonwebtoken" "^9.0.8"
78357836
"@types/ws" "^8.5.14"

0 commit comments

Comments
 (0)