Skip to content

Commit e844ee1

Browse files
authored
Merge pull request #2823 from GetStream/develop
Next Release
2 parents 5765b6a + 4fbc2f4 commit e844ee1

Some content is hidden

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

49 files changed

+681
-113
lines changed

examples/ExpoMessaging/yarn.lock

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7310,10 +7310,10 @@ stream-buffers@2.2.x, stream-buffers@~2.2.0:
73107310
version "0.0.0"
73117311
uid ""
73127312

7313-
stream-chat-react-native-core@5.42.2:
7314-
version "5.42.2"
7315-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.42.2.tgz#edb92b490d4beb894ba549c7deefc770f501360c"
7316-
integrity sha512-eA2fK3eYdhr2RSbB22s1ha29y4EPbj9yPAskWxGo1aJK+KXwXDlAYqGtJa/8saRSSU4DdV89yG5ihvTFgP+Huw==
7313+
stream-chat-react-native-core@5.43.1:
7314+
version "5.43.1"
7315+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.1.tgz#ec0d5a06e329c8991c46cff5bd0211bc94d2b26f"
7316+
integrity sha512-qj/WfjFeCCP2wcp1YZGFJgRYGdSWXd0maG3hn3oURgFR6p/BmO6lDL2g3jnLq0SEkD8x+KZeNBS9cs1gW5Gblw==
73177317
dependencies:
73187318
"@gorhom/bottom-sheet" "^4.6.4"
73197319
dayjs "1.10.5"
@@ -7326,27 +7326,12 @@ stream-chat-react-native-core@5.42.2:
73267326
path "0.12.7"
73277327
react-native-markdown-package "1.8.2"
73287328
react-native-url-polyfill "^1.3.0"
7329-
stream-chat "8.44.0"
7329+
stream-chat "8.45.1"
73307330

73317331
"stream-chat-react-native-core@link:../../package":
73327332
version "0.0.0"
73337333
uid ""
73347334

7335-
stream-chat@8.44.0:
7336-
version "8.44.0"
7337-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.44.0.tgz#e48446cf91db786e80a2e7358ac4f1601e5e97f0"
7338-
integrity sha512-7HNtimD8sT/51rsFibGcD6uBgKj+vlKyYCZMDzjYQEaEsrLqyAg48dOyNM4L2FTF5aXgo9SlxZr21SPleeA2BA==
7339-
dependencies:
7340-
"@babel/runtime" "^7.16.3"
7341-
"@types/jsonwebtoken" "~9.0.0"
7342-
"@types/ws" "^7.4.0"
7343-
axios "^1.6.0"
7344-
base64-js "^1.5.1"
7345-
form-data "^4.0.0"
7346-
isomorphic-ws "^4.0.1"
7347-
jsonwebtoken "~9.0.0"
7348-
ws "^7.5.10"
7349-
73507335
stream-chat@8.45.1:
73517336
version "8.45.1"
73527337
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.1.tgz#001f452520602ebffe45f1634b5f5dd1ff036ec5"

examples/SampleApp/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ SPEC CHECKSUMS:
15561556
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
15571557
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
15581558
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
1559-
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
1559+
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
15601560
GoogleAppMeasurement: f3abf08495ef2cba7829f15318c373b8d9226491
15611561
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
15621562
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15

examples/SampleApp/src/hooks/useStreamChatTheme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const getChatStyle = (colorScheme: ColorSchemeName): DeepPartial<Theme> => ({
1717
border: '#141924',
1818
button_background: '#FFFFFF',
1919
button_text: '#005FFF',
20+
code_block: '#222222',
2021
grey: '#7A7A7A',
2122
grey_gainsboro: '#2D2F2F',
2223
grey_whisper: '#1C1E22',

examples/SampleApp/src/screens/ChannelScreen.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
useChatContext,
1313
useTheme,
1414
useTypingString,
15+
AITypingIndicatorView,
1516
} from 'stream-chat-react-native';
1617
import { Platform, StyleSheet, View } from 'react-native';
1718
import type { StackNavigationProp } from '@react-navigation/stack';
@@ -168,6 +169,7 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({
168169
});
169170
}}
170171
/>
172+
<AITypingIndicatorView channel={channel} />
171173
<MessageInput />
172174
</Channel>
173175
</View>

examples/SampleApp/yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6837,10 +6837,10 @@ statuses@~1.5.0:
68376837
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
68386838
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
68396839

6840-
stream-chat-react-native-core@5.42.2:
6841-
version "5.42.2"
6842-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.42.2.tgz#edb92b490d4beb894ba549c7deefc770f501360c"
6843-
integrity sha512-eA2fK3eYdhr2RSbB22s1ha29y4EPbj9yPAskWxGo1aJK+KXwXDlAYqGtJa/8saRSSU4DdV89yG5ihvTFgP+Huw==
6840+
stream-chat-react-native-core@5.43.2:
6841+
version "5.43.2"
6842+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.2.tgz#b16add60d231509f864d7301ae281c4b4681ff7a"
6843+
integrity sha512-pdSaqw1aPHtxH0md7nnw/TLWPIqsb5TKFzGoWYd/cKRAw4pVDvxolSlha8vYSCwz7MmlarfsJPB0TlS9WcGsDQ==
68446844
dependencies:
68456845
"@gorhom/bottom-sheet" "^4.6.4"
68466846
dayjs "1.10.5"
@@ -6853,7 +6853,7 @@ stream-chat-react-native-core@5.42.2:
68536853
path "0.12.7"
68546854
react-native-markdown-package "1.8.2"
68556855
react-native-url-polyfill "^1.3.0"
6856-
stream-chat "8.44.0"
6856+
stream-chat "8.45.1"
68576857

68586858
"stream-chat-react-native-core@link:../../package":
68596859
version "0.0.0"
@@ -6863,10 +6863,10 @@ stream-chat-react-native-core@5.42.2:
68636863
version "0.0.0"
68646864
uid ""
68656865

6866-
stream-chat@8.44.0:
6867-
version "8.44.0"
6868-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.44.0.tgz#e48446cf91db786e80a2e7358ac4f1601e5e97f0"
6869-
integrity sha512-7HNtimD8sT/51rsFibGcD6uBgKj+vlKyYCZMDzjYQEaEsrLqyAg48dOyNM4L2FTF5aXgo9SlxZr21SPleeA2BA==
6866+
stream-chat@8.45.1:
6867+
version "8.45.1"
6868+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.1.tgz#001f452520602ebffe45f1634b5f5dd1ff036ec5"
6869+
integrity sha512-7OMpL2RHUd+PXSWzhTUAIjjXlI9Oqc4HhUBRfc5i6dK+Ug9S5ertb7RvyzGL5N4ITpq/6ZUAwXtTqRaN9+UUkw==
68706870
dependencies:
68716871
"@babel/runtime" "^7.16.3"
68726872
"@types/jsonwebtoken" "~9.0.0"
@@ -6878,10 +6878,10 @@ stream-chat@8.44.0:
68786878
jsonwebtoken "~9.0.0"
68796879
ws "^7.5.10"
68806880

6881-
stream-chat@8.45.1:
6882-
version "8.45.1"
6883-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.1.tgz#001f452520602ebffe45f1634b5f5dd1ff036ec5"
6884-
integrity sha512-7OMpL2RHUd+PXSWzhTUAIjjXlI9Oqc4HhUBRfc5i6dK+Ug9S5ertb7RvyzGL5N4ITpq/6ZUAwXtTqRaN9+UUkw==
6881+
stream-chat@8.46.0:
6882+
version "8.46.0"
6883+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.46.0.tgz#416b325e05b144d0937a3527d1e622463113d605"
6884+
integrity sha512-HQVCRVldrfQFAvsBOHiHR0TKYf+wpsg/cAzRojeZY+buy1vG6eoqk09h6Fl4k2eG3zFLoA0G9W6o7o45jyFE1g==
68856885
dependencies:
68866886
"@babel/runtime" "^7.16.3"
68876887
"@types/jsonwebtoken" "~9.0.0"

examples/TypeScriptMessaging/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ EXTERNAL SOURCES:
14291429
SPEC CHECKSUMS:
14301430
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
14311431
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
1432-
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
1432+
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
14331433
FBLazyVector: f64d1e2ea739b4d8f7e4740cde18089cd97fe864
14341434
FBReactNativeSpec: 9f2b8b243131565335437dba74923a8d3015e780
14351435
Flipper: c7a0093234c4bdd456e363f2f19b2e4b27652d44
@@ -1441,7 +1441,7 @@ SPEC CHECKSUMS:
14411441
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
14421442
FlipperKit: 37525a5d056ef9b93d1578e04bc3ea1de940094f
14431443
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
1444-
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
1444+
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
14451445
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
14461446
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
14471447
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c

examples/TypeScriptMessaging/yarn.lock

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6899,10 +6899,10 @@ statuses@~1.5.0:
68996899
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
69006900
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
69016901

6902-
stream-chat-react-native-core@5.42.2:
6903-
version "5.42.2"
6904-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.42.2.tgz#edb92b490d4beb894ba549c7deefc770f501360c"
6905-
integrity sha512-eA2fK3eYdhr2RSbB22s1ha29y4EPbj9yPAskWxGo1aJK+KXwXDlAYqGtJa/8saRSSU4DdV89yG5ihvTFgP+Huw==
6902+
stream-chat-react-native-core@5.43.1:
6903+
version "5.43.1"
6904+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.1.tgz#ec0d5a06e329c8991c46cff5bd0211bc94d2b26f"
6905+
integrity sha512-qj/WfjFeCCP2wcp1YZGFJgRYGdSWXd0maG3hn3oURgFR6p/BmO6lDL2g3jnLq0SEkD8x+KZeNBS9cs1gW5Gblw==
69066906
dependencies:
69076907
"@gorhom/bottom-sheet" "^4.6.4"
69086908
dayjs "1.10.5"
@@ -6915,7 +6915,7 @@ stream-chat-react-native-core@5.42.2:
69156915
path "0.12.7"
69166916
react-native-markdown-package "1.8.2"
69176917
react-native-url-polyfill "^1.3.0"
6918-
stream-chat "8.44.0"
6918+
stream-chat "8.45.1"
69196919

69206920
"stream-chat-react-native-core@link:../../package":
69216921
version "0.0.0"
@@ -6930,21 +6930,6 @@ stream-chat-react-native-devtools@^1.1.0:
69306930
version "0.0.0"
69316931
uid ""
69326932

6933-
stream-chat@8.44.0:
6934-
version "8.44.0"
6935-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.44.0.tgz#e48446cf91db786e80a2e7358ac4f1601e5e97f0"
6936-
integrity sha512-7HNtimD8sT/51rsFibGcD6uBgKj+vlKyYCZMDzjYQEaEsrLqyAg48dOyNM4L2FTF5aXgo9SlxZr21SPleeA2BA==
6937-
dependencies:
6938-
"@babel/runtime" "^7.16.3"
6939-
"@types/jsonwebtoken" "~9.0.0"
6940-
"@types/ws" "^7.4.0"
6941-
axios "^1.6.0"
6942-
base64-js "^1.5.1"
6943-
form-data "^4.0.0"
6944-
isomorphic-ws "^4.0.1"
6945-
jsonwebtoken "~9.0.0"
6946-
ws "^7.5.10"
6947-
69486933
stream-chat@8.45.1:
69496934
version "8.45.1"
69506935
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.1.tgz#001f452520602ebffe45f1634b5f5dd1ff036ec5"

package/expo-package/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,10 +2929,10 @@ stream-buffers@2.2.x:
29292929
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
29302930
integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==
29312931

2932-
stream-chat-react-native-core@5.43.1:
2933-
version "5.43.1"
2934-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.1.tgz#ec0d5a06e329c8991c46cff5bd0211bc94d2b26f"
2935-
integrity sha512-qj/WfjFeCCP2wcp1YZGFJgRYGdSWXd0maG3hn3oURgFR6p/BmO6lDL2g3jnLq0SEkD8x+KZeNBS9cs1gW5Gblw==
2932+
stream-chat-react-native-core@5.43.2:
2933+
version "5.43.2"
2934+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.2.tgz#b16add60d231509f864d7301ae281c4b4681ff7a"
2935+
integrity sha512-pdSaqw1aPHtxH0md7nnw/TLWPIqsb5TKFzGoWYd/cKRAw4pVDvxolSlha8vYSCwz7MmlarfsJPB0TlS9WcGsDQ==
29362936
dependencies:
29372937
"@gorhom/bottom-sheet" "^4.6.4"
29382938
dayjs "1.10.5"

package/native-package/yarn.lock

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

4247-
stream-chat-react-native-core@5.43.1:
4248-
version "5.43.1"
4249-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.1.tgz#ec0d5a06e329c8991c46cff5bd0211bc94d2b26f"
4250-
integrity sha512-qj/WfjFeCCP2wcp1YZGFJgRYGdSWXd0maG3hn3oURgFR6p/BmO6lDL2g3jnLq0SEkD8x+KZeNBS9cs1gW5Gblw==
4247+
stream-chat-react-native-core@5.43.2:
4248+
version "5.43.2"
4249+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.43.2.tgz#b16add60d231509f864d7301ae281c4b4681ff7a"
4250+
integrity sha512-pdSaqw1aPHtxH0md7nnw/TLWPIqsb5TKFzGoWYd/cKRAw4pVDvxolSlha8vYSCwz7MmlarfsJPB0TlS9WcGsDQ==
42514251
dependencies:
42524252
"@gorhom/bottom-sheet" "^4.6.4"
42534253
dayjs "1.10.5"

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": "8.45.1"
81+
"stream-chat": "8.46.0"
8282
},
8383
"peerDependencies": {
8484
"react-native-quick-sqlite": ">=5.1.0",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from 'react';
2+
3+
import { StyleSheet, Text, View } from 'react-native';
4+
5+
import { Channel } from 'stream-chat';
6+
7+
import { AIStates, useAIState } from './hooks/useAIState';
8+
9+
import { useChannelContext, useTheme, useTranslationContext } from '../../contexts';
10+
import type { DefaultStreamChatGenerics } from '../../types/types';
11+
12+
export type AITypingIndicatorViewProps<
13+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
14+
> = {
15+
channel?: Channel<StreamChatGenerics>;
16+
};
17+
18+
export const AITypingIndicatorView = <
19+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
20+
>({
21+
channel: channelFromProps,
22+
}: AITypingIndicatorViewProps<StreamChatGenerics>) => {
23+
const { t } = useTranslationContext();
24+
const { channel: channelFromContext } = useChannelContext<StreamChatGenerics>();
25+
const channel = channelFromProps || channelFromContext;
26+
const { aiState } = useAIState(channel);
27+
const allowedStates = {
28+
[AIStates.Thinking]: t('Thinking...'),
29+
[AIStates.Generating]: t('Generating...'),
30+
};
31+
32+
const {
33+
theme: {
34+
aiTypingIndicatorView: { container, text },
35+
colors: { black, grey_gainsboro },
36+
},
37+
} = useTheme();
38+
39+
return aiState in allowedStates ? (
40+
<View style={[styles.container, { backgroundColor: grey_gainsboro }, container]}>
41+
<Text style={[{ color: black }, text]}>{allowedStates[aiState]}</Text>
42+
</View>
43+
) : null;
44+
};
45+
46+
AITypingIndicatorView.displayName = 'AITypingIndicatorView{messageSimple{content}}';
47+
48+
const styles = StyleSheet.create({
49+
container: { paddingHorizontal: 16, paddingVertical: 18 },
50+
});
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { useEffect, useState } from 'react';
2+
3+
import { AIState, Channel, Event } from 'stream-chat';
4+
5+
import { useChatContext } from '../../../contexts';
6+
import type { DefaultStreamChatGenerics } from '../../../types/types';
7+
import { useIsOnline } from '../../Chat/hooks/useIsOnline';
8+
9+
export const AIStates = {
10+
Error: 'AI_STATE_ERROR',
11+
ExternalSources: 'AI_STATE_EXTERNAL_SOURCES',
12+
Generating: 'AI_STATE_GENERATING',
13+
Idle: 'AI_STATE_IDLE',
14+
Thinking: 'AI_STATE_THINKING',
15+
};
16+
17+
/**
18+
* A hook that returns the current state of the AI.
19+
* @param {Channel} channel - The channel for which we want to know the AI state.
20+
* @returns {{ aiState: AIState }} The current AI state for the given channel.
21+
*/
22+
export const useAIState = <
23+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
24+
>(
25+
channel?: Channel<StreamChatGenerics>,
26+
): { aiState: AIState } => {
27+
const { client } = useChatContext<StreamChatGenerics>();
28+
const { isOnline } = useIsOnline<StreamChatGenerics>(client);
29+
30+
const [aiState, setAiState] = useState<AIState>(AIStates.Idle);
31+
32+
useEffect(() => {
33+
if (!isOnline) {
34+
setAiState(AIStates.Idle);
35+
}
36+
}, [isOnline]);
37+
38+
useEffect(() => {
39+
if (!channel) {
40+
return;
41+
}
42+
43+
const indicatorChangedListener = channel.on(
44+
'ai_indicator.update',
45+
(event: Event<StreamChatGenerics>) => {
46+
const { cid } = event;
47+
const state = event.ai_state as AIState;
48+
if (channel.cid === cid) {
49+
setAiState(state);
50+
}
51+
},
52+
);
53+
54+
const indicatorClearedListener = channel.on('ai_indicator.clear', (event) => {
55+
const { cid } = event;
56+
if (channel.cid === cid) {
57+
setAiState(AIStates.Idle);
58+
}
59+
});
60+
61+
return () => {
62+
indicatorChangedListener.unsubscribe();
63+
indicatorClearedListener.unsubscribe();
64+
};
65+
}, [channel]);
66+
67+
return { aiState };
68+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './AITypingIndicatorView';
2+
export * from './hooks/useAIState';

0 commit comments

Comments
 (0)