Skip to content

Commit cb0b223

Browse files
committed
Merge branch 'develop' into v6.0.0
# Conflicts: # examples/SampleApp/yarn.lock # package/expo-package/yarn.lock # package/native-package/package.json # package/native-package/yarn.lock # package/src/components/Channel/Channel.tsx # package/src/components/Chat/Chat.tsx # package/src/components/Message/Message.tsx # package/src/components/Message/MessageSimple/MessageContent.tsx # package/src/components/Message/MessageSimple/MessageFooter.tsx # package/src/components/Message/MessageSimple/MessageSimple.tsx # package/src/components/Message/MessageSimple/utils/renderText.tsx # package/src/components/MessageOverlay/MessageOverlay.tsx # package/src/contexts/chatContext/ChatContext.tsx # package/src/contexts/messageInputContext/MessageInputContext.tsx # package/src/contexts/messagesContext/MessagesContext.tsx # package/yarn.lock
2 parents a1090cb + e606b78 commit cb0b223

File tree

24 files changed

+167
-65
lines changed

24 files changed

+167
-65
lines changed

examples/SampleApp/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createStackNavigator } from '@react-navigation/stack';
66
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
77
import {
88
Chat,
9+
MessageType,
910
OverlayProvider,
1011
SqliteClient,
1112
ThemeProvider,
@@ -182,6 +183,7 @@ const DrawerNavigatorWrapper: React.FC<{
182183
enableOfflineSupport
183184
// @ts-expect-error
184185
ImageComponent={FastImage}
186+
isMessageAIGenerated={(message: MessageType) => message.ai_generated}
185187
>
186188
<AppOverlayProvider>
187189
<UserSearchProvider>

examples/SampleApp/CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Change Log
22

3+
### [1.33.1](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.33.1) (2024-12-05)
4+
5+
6+
### Bug Fixes
7+
8+
* add factory fn to determine whether a msg is ai generated ([#2829](https://github.com/GetStream/stream-chat-react-native/issues/2829)) ([79542d8](https://github.com/GetStream/stream-chat-react-native/commit/79542d82e363b7fb5d8596d90e47da2ed391ff8e))
9+
10+
11+
### Workspaces
12+
13+
* Following linked packages updated: [stream-chat-react-native]
14+
15+
## [1.33.0](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.33.0) (2024-12-04)
16+
17+
18+
### Features
19+
20+
* ai chat bot poc ([#2822](https://github.com/GetStream/stream-chat-react-native/issues/2822)) ([4fbc2f4](https://github.com/GetStream/stream-chat-react-native/commit/4fbc2f468a309c9e2fdf5b7145b04a2c03b961b5)), closes [#2819](https://github.com/GetStream/stream-chat-react-native/issues/2819)
21+
22+
23+
### Bug Fixes
24+
25+
* show loading indicator instead of returning null from the Chat component when DB not initialized ([#2820](https://github.com/GetStream/stream-chat-react-native/issues/2820)) ([6d5a51b](https://github.com/GetStream/stream-chat-react-native/commit/6d5a51b01bbf2fee71a1ba28ebb00c568dfc67c6))
26+
27+
28+
### Workspaces
29+
30+
* Following linked packages updated: [stream-chat-react-native]
31+
332
### [1.32.2](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.32.2) (2024-11-28)
433

534
### Workspaces

examples/SampleApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sampleapp",
3-
"version": "1.32.2",
3+
"version": "1.33.1",
44
"private": true,
55
"repository": {
66
"type": "git",

package/CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Change Log
22

3+
### [5.44.1](https://github.com/GetStream/stream-chat-react-native/compare/v5.44.0...v5.44.1) (2024-12-05)
4+
5+
6+
### Bug Fixes
7+
8+
* add factory fn to determine whether a msg is ai generated ([#2829](https://github.com/GetStream/stream-chat-react-native/issues/2829)) ([79542d8](https://github.com/GetStream/stream-chat-react-native/commit/79542d82e363b7fb5d8596d90e47da2ed391ff8e))
9+
10+
## [5.44.0](https://github.com/GetStream/stream-chat-react-native/compare/v5.43.2...v5.44.0) (2024-12-04)
11+
12+
13+
### Features
14+
15+
* ai chat bot poc ([#2822](https://github.com/GetStream/stream-chat-react-native/issues/2822)) ([4fbc2f4](https://github.com/GetStream/stream-chat-react-native/commit/4fbc2f468a309c9e2fdf5b7145b04a2c03b961b5)), closes [#2819](https://github.com/GetStream/stream-chat-react-native/issues/2819)
16+
17+
18+
### Bug Fixes
19+
20+
* audio attachment title overflow issue ([#2821](https://github.com/GetStream/stream-chat-react-native/issues/2821)) ([1651c16](https://github.com/GetStream/stream-chat-react-native/commit/1651c16173ff69a4df172de77cf04d28f6c0851d))
21+
* show loading indicator instead of returning null from the Chat component when DB not initialized ([#2820](https://github.com/GetStream/stream-chat-react-native/issues/2820)) ([6d5a51b](https://github.com/GetStream/stream-chat-react-native/commit/6d5a51b01bbf2fee71a1ba28ebb00c568dfc67c6))
22+
323
### [5.43.2](https://github.com/GetStream/stream-chat-react-native/compare/v5.43.1...v5.43.2) (2024-11-28)
424

525
### Bug Fixes

package/expo-package/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stream-chat-expo",
33
"description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4-
"version": "5.43.2",
4+
"version": "5.44.1",
55
"author": {
66
"company": "Stream.io Inc",
77
"name": "Stream.io Inc"
@@ -10,7 +10,7 @@
1010
"main": "src/index.js",
1111
"types": "types/index.d.ts",
1212
"dependencies": {
13-
"stream-chat-react-native-core": "5.43.2"
13+
"stream-chat-react-native-core": "5.44.1"
1414
},
1515
"peerDependencies": {
1616
"expo": ">=51.0.0",

package/native-package/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stream-chat-react-native",
33
"description": "The official React Native SDK for Stream Chat, a service for building chat applications",
4-
"version": "5.43.2",
4+
"version": "5.44.1",
55
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
66
"author": {
77
"company": "Stream.io Inc",
@@ -20,7 +20,7 @@
2020
"types": "types/index.d.ts",
2121
"dependencies": {
2222
"es6-symbol": "^3.1.3",
23-
"stream-chat-react-native-core": "5.43.2"
23+
"stream-chat-react-native-core": "5.44.1"
2424
},
2525
"peerDependencies": {
2626
"@react-native-camera-roll/camera-roll": ">=7.8.0",

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stream-chat-react-native-core",
33
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4-
"version": "5.43.2",
4+
"version": "5.44.1",
55
"author": {
66
"company": "Stream.io Inc",
77
"name": "Stream.io Inc"

package/src/components/Attachment/AudioAttachment.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type AudioAttachmentProps = {
3636
*/
3737
export const AudioAttachment = (props: AudioAttachmentProps) => {
3838
const [width, setWidth] = useState(0);
39+
const [progressControlTextWidth, setProgressControlTextWidth] = useState(0);
3940
const [currentSpeed, setCurrentSpeed] = useState<number>(1.0);
4041
const soundRef = React.useRef<SoundReturnType | null>(null);
4142
const {
@@ -228,9 +229,6 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
228229
return (
229230
<View
230231
accessibilityLabel='audio-attachment-preview'
231-
onLayout={({ nativeEvent }) => {
232-
setWidth(nativeEvent.layout.width);
233-
}}
234232
style={[
235233
styles.container,
236234
{
@@ -256,19 +254,19 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
256254
<Pause fill={static_black} height={32} width={32} />
257255
)}
258256
</Pressable>
259-
<View style={[styles.leftContainer, leftContainer]}>
257+
<View
258+
onLayout={({ nativeEvent }) => {
259+
setWidth(nativeEvent.layout.width);
260+
}}
261+
style={[styles.leftContainer, leftContainer]}
262+
>
260263
<Text
261264
accessibilityLabel='File Name'
262265
numberOfLines={1}
263266
style={[
264267
styles.filenameText,
265268
{
266269
color: black,
267-
width:
268-
16 - // 16 = horizontal padding
269-
40 - // 40 = file icon size
270-
24 - // 24 = close icon size
271-
24, // 24 = internal padding
272270
},
273271
I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },
274272
filenameText,
@@ -290,7 +288,12 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
290288
uri={item.file.uri}
291289
/>
292290
)}
293-
<Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>
291+
<Text
292+
onLayout={({ nativeEvent }) => {
293+
setProgressControlTextWidth(nativeEvent.layout.width);
294+
}}
295+
style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}
296+
>
294297
{progressDuration}
295298
</Text>
296299
{!hideProgressBar && (
@@ -316,7 +319,7 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
316319
onProgressDrag={handleProgressDrag}
317320
progress={item.progress as number}
318321
testID='progress-control'
319-
width={width / 2}
322+
width={width - progressControlTextWidth}
320323
/>
321324
)}
322325
</View>
@@ -365,50 +368,48 @@ const styles = StyleSheet.create({
365368
fontSize: 14,
366369
fontWeight: 'bold',
367370
paddingBottom: 12,
368-
paddingLeft: 8,
369371
},
370372
leftContainer: {
371373
justifyContent: 'space-around',
374+
marginHorizontal: 16,
375+
width: '60%',
372376
},
373377
playPauseButton: {
374378
alignItems: 'center',
375379
alignSelf: 'center',
376380
borderRadius: 50,
377-
display: 'flex',
378381
elevation: 4,
379382
justifyContent: 'center',
380-
paddingVertical: 2,
383+
padding: 2,
381384
shadowOffset: {
382385
height: 2,
383386
width: 0,
384387
},
385388
shadowOpacity: 0.23,
386389
shadowRadius: 2.62,
387-
width: 36,
388390
},
389391
progressControlContainer: {},
390392
progressDurationText: {
391393
fontSize: 12,
392-
paddingLeft: 10,
393-
paddingRight: 8,
394+
marginRight: 4,
394395
},
395396
rightContainer: {
396-
marginLeft: 10,
397+
marginLeft: 'auto',
397398
},
398399
speedChangeButton: {
399400
alignItems: 'center',
400401
alignSelf: 'center',
401402
borderRadius: 50,
402403
elevation: 4,
403404
justifyContent: 'center',
405+
paddingHorizontal: 10,
404406
paddingVertical: 5,
405407
shadowOffset: {
406408
height: 2,
407409
width: 0,
408410
},
409411
shadowOpacity: 0.23,
410412
shadowRadius: 2.62,
411-
width: 36,
412413
},
413414
speedChangeButtonText: {
414415
fontSize: 12,

package/src/components/Channel/Channel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { useCreateTypingContext } from './hooks/useCreateTypingContext';
3636

3737
import { useTargetedMessage } from './hooks/useTargetedMessage';
3838

39+
import { MessageContextValue } from '../../contexts';
3940
import { ChannelContextValue, ChannelProvider } from '../../contexts/channelContext/ChannelContext';
4041
import type { UseChannelStateValue } from '../../contexts/channelsStateContext/useChannelState';
4142
import { useChannelState } from '../../contexts/channelsStateContext/useChannelState';
@@ -359,6 +360,7 @@ export type ChannelPropsWithContext<
359360
| 'StreamingMessageView'
360361
>
361362
> &
363+
Partial<Pick<MessageContextValue<StreamChatGenerics>, 'isMessageAIGenerated'>> &
362364
Partial<Pick<ThreadContextValue<StreamChatGenerics>, 'allowThreadMessagesInChannel'>> & {
363365
shouldSyncChannel: boolean;
364366
thread: ThreadType<StreamChatGenerics>;
@@ -552,6 +554,7 @@ const ChannelWithContext = <
552554
InputGiphySearch = InputGiphyCommandInputDefault,
553555
InputReplyStateHeader = InputReplyStateHeaderDefault,
554556
isAttachmentEqual,
557+
isMessageAIGenerated = () => false,
555558
keyboardBehavior,
556559
KeyboardCompatibleView = KeyboardCompatibleViewDefault,
557560
keyboardVerticalOffset,
@@ -2328,6 +2331,7 @@ const ChannelWithContext = <
23282331
InlineDateSeparator,
23292332
InlineUnreadIndicator,
23302333
isAttachmentEqual,
2334+
isMessageAIGenerated,
23312335
legacyImageViewerSwipeBehaviour,
23322336
markdownRules,
23332337
Message,
@@ -2472,7 +2476,8 @@ export const Channel = <
24722476
>(
24732477
props: PropsWithChildren<ChannelProps<StreamChatGenerics>>,
24742478
) => {
2475-
const { client, enableOfflineSupport } = useChatContext<StreamChatGenerics>();
2479+
const { client, enableOfflineSupport, isMessageAIGenerated } =
2480+
useChatContext<StreamChatGenerics>();
24762481
const { t } = useTranslationContext();
24772482

24782483
const threadFromProps = props?.thread;
@@ -2518,6 +2523,7 @@ export const Channel = <
25182523
{...props}
25192524
shouldSyncChannel={shouldSyncChannel}
25202525
{...{
2526+
isMessageAIGenerated,
25212527
members,
25222528
messages: props.messages || messages,
25232529
read,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const useCreateMessagesContext = <
4949
InlineDateSeparator,
5050
InlineUnreadIndicator,
5151
isAttachmentEqual,
52+
isMessageAIGenerated,
5253
legacyImageViewerSwipeBehaviour,
5354
markdownRules,
5455
Message,
@@ -159,6 +160,7 @@ export const useCreateMessagesContext = <
159160
InlineDateSeparator,
160161
InlineUnreadIndicator,
161162
isAttachmentEqual,
163+
isMessageAIGenerated,
162164
legacyImageViewerSwipeBehaviour,
163165
markdownRules,
164166
Message,

0 commit comments

Comments
 (0)