Skip to content

Commit df2e996

Browse files
feat: draft message (#3114)
* chore: modify gh workflows * feat: removal of StreamChatGenerics (#2993) * feat: remove StreamChatGenerics and introduce interface merging * fix: some of the outstanding todos * chore: add default interfaces * chore: remove SCG from sample app * fix: remove redundant types * fix: remove type module * fix: change the way interface declaration is consumed * fix: ignore ts complaints for interface declaration * chore: migrate TypescriptMessagingApp away from SCG * chore: migrate the Expo sample app away from SCG * fix: commit missing files * fix: revert mistaken change * fix: add resolutions for symlinked libs * chore: remove support for react-native-document-picker (#3000) * BREAKING CHANGE: V7 release candidate * chore: add rc channel * fix: typo in branch name * feat: trigger breaking change for v7 (#3005) BREAKING CHANGE: Release V7 * chore: remove dryRun * chore: bump stream-chat version to latest rc * chore: bump stream-chat to latest * feat: introduce expo-video support (#3010) * feat: introduce support for expo-video * fix: remove redundant test * fix: add check for audio component * fix: lint issues * fix: different types inference with latest stream-chat changes * chore(deps): update sample apps too * fix: remove generics from new hook * fix: remove remnants from SCG and fix missing types * fix: lint issues * fix: replace TouchableOpacity with Pressable * fix: move to RN TouchableOpacity instead * chore(deps): update peer deps * chore: remove unused hooks * chore: remove deps scope * fix: all instances of FormatMessageResponse in respect to the new llc changes * chore: ref branch specifically * fix: try clearing cache * fix: remove cache clean * fix: remove console.log * fix: use latest commit * fix: use latest rc of llc * chore: use specific commit again * fix: SCG remnants from merge * fix: lint issues * fix: lint issues * fix: unify file and image types (#3050) * fix: unify file and image types * fix: refine types * fix: remove props from auto complete input * chore: update deps * fix: failing tests and AutoCompleteInput type * chore: update custom data module interfaces * fix: change RNFile to FileReference as per latest client changes (#3061) * fix: merge conflicts * fix: remove MessageType type from the SDK * fix: resolve conflicts from V7 branch * fix: broken tests * fix: useMessageActions remove reserved fields logic * revert: useMessageActions change * fix: confine readBy data to Message Status component * fix: change date separator and group styles to ref * fix: add app changes * feat: use new text composer for RN SDK * fix: bump stream-chat to latest rc * chore: bump stream-chat version to latest rc again * fix: thread messages state not updating properly * chore: change type to inferred one * fix: set correct core lib versions * chore: bump stream-chat to latest rc again * chore: update sample app yarn.locks as well * fix: refine the implementation * fix: add useCallback * fix: keyboard taking full screen issue when the prefer cross-fade transition setting is enabled (#3073) * fix: respect the hasCommand channel prop as well * fix: keybaord taking full screen issue when the prefer cross-fade transition setting is enabled (#3072) * fix: keybaord taking full screen issue when the prefer cross-fade transition setting is enabled * chore: bump stream-chat-js rc again * chore: full reinstall after merge from develop * fix: add back mistakenly removed mime dep * feat: add poll composer * feat: add emoji middleware and make text input better * fix: add channel command middleware * fix: add channel command middleware * fix: remove unused values from message input context * fix: remove unused values from message input context * fix: code clean up * fix: point out a bug with the ban user command * fix: added option reordering fix * fix: improve the emoji and command middleware and cleanup * fix: quoted message state using the message composer * fix: improve poll composer integration * fix: reduce prop surface area from auto complete input * fix: tests * feat: add integration for attachment manager * fix: yarn.lock update * fix: poll composer crash bug * fix: change emoji middleware name * chore: remove workflow changes * feat: move attachment picker context to Channel wrapper and handle only bottom sheet stuff in it * fix: add app refactor * fix: add app refactor * fix: auto complete input changes * refactor: add improvements * refactor: add poll changes * fix: add back react memo * fix: input buttons hasText optimization * fix: improve upload preview components * fix: improve upload preview components * fix: audio attachment issues * chore: resolve conflicts * fix: sync up changes * fix: sync up changes * fix: commands button hastext optimization * fix: create poll options useEffect * fix: comment * fix: default values * fix: try out picker in channel * fix: attachment picker component usage * fix: cleanup for the attachment manager * fix: input button hasText bug * fix: file unsupported types * fix: style for upload unsupported indicator * fix: improve upload new file * fix: send button and audiorecordingbutton re-renders * fix: send button and audiorecordingbutton re-renders * revert: the memo change * fix: remove profiler code * fix: optimize send button performance * fix: type export from audio recording button * fix: iLocalUri utility * fix: update yarn lock * fix: attachment send while offline support is enabled * fix: make sending flow faster and bug free and fix bug with cooldown * fix: edited message usage * fix: attachments draft middleware * fix: make command control middleware better * fix: use text composer for command handling * feat: add support for draft message * fix: draft config * feat: add offline support for draft messages * fix: getDraft bug and add draft support for thread list * fix: set draft config from app * fix: thread list listen to messagecomposer events * fix: drafts issue * fix: add test id * tests: add tests * tests: add tests * tests: add tests * fix: remove thread from MessageInput * perf: messages rerendering on every composer change * perf: remove editing state from channel ctx and add composer ctx * fix: double editing issue * fix: introduce hasText * fix: quoted message edited update bug * fix: quoted message edited update bug * fix: close poll modal before send to avoid reset on the UI * fix: selected picker bug * fix: memoize the photos * fix: performance issue with quoted message checks * fix: further optimize memo checks * feat: add draftscreen to sample app * perf: separate composer ctxs and optimize usage (#3112) * perf: abstract away composer api and usage * fix: remove props inport and remove comments --------- Co-authored-by: Khushal Agarwal <[email protected]> * fix: usage of global config * fix: usage of global config * fix: change how message composer config is set * fix: application of global config in sample app * perf: make attachbutton better * fix: editing usage * fix: drafts messages in channel without parent id * fix: unify the message preview component to channel preview and thread list item * fix: add message preview to draft list * fix: poll option animation breaking (#3115) * fix: poll option animation breaking * fix: add container animation * chore: remove console.log * fix: revert not needed prop drilling * fix: improve draft manager * fix: improve draft manager * fix: remove parent_id prop * fix: use draft attachments middlware * fix: image upload preview loading indicator * tests: add tests setup * tests: add tests setup * tests: add more tests * perf: improve the input buttons and command input perf * fix: sample app channel header component perf * fix: remove isCommandUIEnabled from channel context * chore: update yarn lock and pod file * fix: improve uselatestmessagepreview * fix: adjust theme changes * refactor: introduce selectDraftMessageFromDraft * fix: getDraft endpoint return value * fix: register subscriptions when the thread var change * chore: update yarn lock files * revert: thread dep change * fix: handle only draft events in channel preview and thread list item * fix: delete draft message when new created * fix: guard from parent id * fix: get drafts with parent message and cid * fix: remove console logs * fix: drafts state and offline support quirks * fix: offline mode drafts and jsi quirks * fix: thread draft bugs, thread draft pending tasks, schema and mapping * fix: rename type to threadId for clarity --------- Co-authored-by: Ivan Sekovanikj <[email protected]> Co-authored-by: Ivan Sekovanikj <[email protected]>
1 parent 7b32f34 commit df2e996

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1838
-260
lines changed

examples/ExpoMessaging/yarn.lock

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,6 +2937,11 @@
29372937
dependencies:
29382938
"@types/yargs-parser" "*"
29392939

2940+
"@ungap/structured-clone@^1.3.0":
2941+
version "1.3.0"
2942+
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8"
2943+
integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==
2944+
29402945
"@urql/core@^5.0.0", "@urql/core@^5.0.6":
29412946
version "5.0.8"
29422947
resolved "https://registry.yarnpkg.com/@urql/core/-/core-5.0.8.tgz#eba39eaa2bf9a0a963383e87a65cba7a9ca794bd"
@@ -4065,11 +4070,6 @@ electron-to-chromium@^1.5.41:
40654070
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.69.tgz#7268a4251e82fc83a7cdc9ab51e7154bb2813038"
40664071
integrity sha512-zz4e7EbJqqtdQtwt61ZYKrfEYlV0HpGbIGRVFGOO9YBZIhg0BDXtBcWxpqyAm6oyPl2Zp8tc5FrPpCZQH/Yazg==
40674072

4068-
emoji-regex@^10.3.0:
4069-
version "10.3.0"
4070-
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.3.0.tgz#76998b9268409eb3dae3de989254d456e70cfe23"
4071-
integrity sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==
4072-
40734073
emoji-regex@^10.4.0:
40744074
version "10.4.0"
40754075
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.4.0.tgz#03553afea80b3975749cfcb36f776ca268e413d4"
@@ -7408,48 +7408,14 @@ [email protected], stream-buffers@~2.2.0:
74087408
version "0.0.0"
74097409
uid ""
74107410

7411-
7412-
version "7.1.0"
7413-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-7.1.0.tgz#b5002ec967467a2ac4be54700e5e4e60bbd5fd97"
7414-
integrity sha512-Rfecu6kH2zBW0ufhVz076NlpOg6QxNgShGnK4js/ypjSZ4rGZIKMFHNuArLVr/uSuTWiVPNO1zMI/LyvljtwdQ==
7415-
dependencies:
7416-
"@gorhom/bottom-sheet" "^5.1.1"
7417-
dayjs "1.10.5"
7418-
emoji-regex "^10.3.0"
7419-
i18next "^21.6.14"
7420-
intl-pluralrules "^2.0.1"
7421-
linkifyjs "^4.1.1"
7422-
lodash-es "4.17.21"
7423-
mime-types "^2.1.34"
7424-
path "0.12.7"
7425-
react-native-markdown-package "1.8.2"
7426-
react-native-url-polyfill "^1.3.0"
7427-
stream-chat "^9.2.0"
7428-
use-sync-external-store "^1.4.0"
7429-
74307411
"stream-chat-react-native-core@link:../../package":
74317412
version "0.0.0"
74327413
uid ""
74337414

7434-
stream-chat@^9.2.0:
7435-
version "9.2.0"
7436-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.2.0.tgz#f3109891ca27f17b6fd0aa6ebcf66be12df1f88c"
7437-
integrity sha512-inz3CA5tuqqSrla7qjRTCKs+coRKOYROWf0wEWYgbCu0tAUuiBTRtu1PJL1isEXIaPLiWi00BuRrBEIFon9Kng==
7438-
dependencies:
7439-
"@types/jsonwebtoken" "^9.0.8"
7440-
"@types/ws" "^8.5.14"
7441-
axios "^1.6.0"
7442-
base64-js "^1.5.1"
7443-
form-data "^4.0.0"
7444-
isomorphic-ws "^5.0.0"
7445-
jsonwebtoken "^9.0.2"
7446-
linkifyjs "^4.2.0"
7447-
ws "^8.18.1"
7448-
7449-
stream-chat@^9.3.0:
7450-
version "9.3.0"
7451-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.3.0.tgz#35ca4db9e841eb92d07413ae156de0500ad77b23"
7452-
integrity sha512-S73B3HrvmQvJjq58Zjo50vh74juhsWsVRpT+OBjGAxSGxlA+ITkZ3vKs8Y/r2eDK7mBTMmX5QCruFaDJH5dRuw==
7415+
stream-chat@^9.5.1:
7416+
version "9.5.1"
7417+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.5.1.tgz#b8260bc1d1470ae3c91d8c40d22f41e9c4523d7b"
7418+
integrity sha512-X9w22JfEp2cTggAwyt0gyvwe8VBy1qvJENliNen/2FJDpS3k6PCaeSO6MHNXz3c0Qy21hqxuu8/b32jCSe4LSA==
74537419
dependencies:
74547420
"@types/jsonwebtoken" "^9.0.8"
74557421
"@types/ws" "^8.5.14"
@@ -7461,21 +7427,6 @@ stream-chat@^9.3.0:
74617427
linkifyjs "^4.2.0"
74627428
ws "^8.18.1"
74637429

7464-
stream-chat@^8.57.6:
7465-
version "8.60.0"
7466-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
7467-
integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
7468-
dependencies:
7469-
"@babel/runtime" "^7.27.0"
7470-
"@types/jsonwebtoken" "~9.0.0"
7471-
"@types/ws" "^7.4.0"
7472-
axios "^1.6.0"
7473-
base64-js "^1.5.1"
7474-
form-data "^4.0.0"
7475-
isomorphic-ws "^4.0.1"
7476-
jsonwebtoken "~9.0.0"
7477-
ws "^7.5.10"
7478-
74797430
stream-slice@^0.1.2:
74807431
version "0.1.2"
74817432
resolved "https://registry.yarnpkg.com/stream-slice/-/stream-slice-0.1.2.tgz#2dc4f4e1b936fb13f3eb39a2def1932798d07a4b"

examples/SampleApp/App.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createStackNavigator } from '@react-navigation/stack';
66
import { SafeAreaProvider } from 'react-native-safe-area-context';
77
import {
88
Chat,
9+
createTextComposerEmojiMiddleware,
910
OverlayProvider,
1011
SqliteClient,
1112
ThemeProvider,
@@ -34,8 +35,12 @@ import { OneOnOneChannelDetailScreen } from './src/screens/OneOnOneChannelDetail
3435
import { SharedGroupsScreen } from './src/screens/SharedGroupsScreen';
3536
import { ThreadScreen } from './src/screens/ThreadScreen';
3637
import { UserSelectorScreen } from './src/screens/UserSelectorScreen';
38+
import { init, SearchIndex } from 'emoji-mart';
39+
import data from '@emoji-mart/data';
3740

38-
import type { LocalMessage, StreamChat } from 'stream-chat';
41+
import type { LocalMessage, StreamChat, TextComposerMiddleware } from 'stream-chat';
42+
43+
init({ data });
3944

4045
if (__DEV__) {
4146
DevSettings.addMenuItem('Reset local DB (offline storage)', () => {
@@ -118,6 +123,25 @@ const App = () => {
118123
};
119124
}, []);
120125

126+
useEffect(() => {
127+
if (!chatClient) {
128+
return;
129+
}
130+
chatClient.setMessageComposerSetupFunction(({ composer }) => {
131+
composer.updateConfig({
132+
drafts: {
133+
enabled: true,
134+
},
135+
});
136+
137+
composer.textComposer.middlewareExecutor.insert({
138+
middleware: [createTextComposerEmojiMiddleware(SearchIndex) as TextComposerMiddleware],
139+
position: { after: 'stream-io/text-composer/mentions-middleware' },
140+
unique: true,
141+
});
142+
});
143+
}, [chatClient]);
144+
121145
return (
122146
<SafeAreaProvider
123147
style={{

examples/SampleApp/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ PODS:
22342234
- libwebp (~> 1.0)
22352235
- SDWebImage/Core (~> 5.10)
22362236
- SocketRocket (0.7.1)
2237-
- stream-chat-react-native (7.1.0):
2237+
- stream-chat-react-native (7.1.1):
22382238
- DoubleConversion
22392239
- glog
22402240
- hermes-engine
@@ -2662,9 +2662,9 @@ SPEC CHECKSUMS:
26622662
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
26632663
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
26642664
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
2665-
stream-chat-react-native: b6555353e3f8726478abdf8614d9303cf8d8de42
2665+
stream-chat-react-native: 3d6ea43d3097dfc813d9e99fd0d6d113d3faac78
26662666
Yoga: be02ca501b03c79d7027a6bbbd0a8db985034f11
26672667

26682668
PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
26692669

2670-
COCOAPODS: 1.16.2
2670+
COCOAPODS: 1.14.3

examples/SampleApp/src/components/BottomTabs.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MentionsTab } from '../icons/MentionsTab';
1111

1212
import type { BottomTabBarProps } from '@react-navigation/bottom-tabs';
1313
import type { Route } from '@react-navigation/native';
14+
import { DraftsTab } from '../icons/DraftsTab';
1415

1516
const styles = StyleSheet.create({
1617
notification: {
@@ -44,6 +45,13 @@ const getTab = (key: string) => {
4445
notification: <ChannelsUnreadCountBadge />,
4546
title: 'Chats',
4647
};
48+
case 'DraftsScreen':
49+
return {
50+
icon: <DraftsTab />,
51+
iconActive: <DraftsTab active />,
52+
title: 'Drafts',
53+
notification: <ChannelsUnreadCountBadge />,
54+
};
4755
case 'ThreadsScreen':
4856
return {
4957
icon: <ThreadsTab />,

examples/SampleApp/src/components/ChannelPreview.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ const CustomChannelPreviewStatus = (
7171
);
7272
};
7373

74-
export const ChannelPreview: React.FC<ChannelPreviewMessengerProps> = (
75-
props,
76-
) => {
74+
export const ChannelPreview: React.FC<ChannelPreviewMessengerProps> = (props) => {
7775
const { channel } = props;
7876

7977
const { setOverlay } = useAppOverlayContext();

0 commit comments

Comments
 (0)