Skip to content

Commit ae7c585

Browse files
committed
Merge branch 'develop' into fix/poll-offline-fixes
# Conflicts: # package/expo-package/yarn.lock # package/native-package/package.json # package/native-package/yarn.lock # package/src/components/Message/MessageSimple/MessageContent.tsx # package/src/components/MessageOverlay/MessageOverlay.tsx # package/src/components/Reply/Reply.tsx # package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap # package/src/store/QuickSqliteClient.ts # package/src/store/apis/getChannelMessages.ts # package/src/store/apis/updatePollMessage.ts
2 parents 77980fa + 2603ff1 commit ae7c585

File tree

25 files changed

+330
-55
lines changed

25 files changed

+330
-55
lines changed

examples/SampleApp/CHANGELOG.md

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

3+
### [1.31.5](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.31.5) (2024-11-08)
4+
5+
6+
### Workspaces
7+
8+
* Following linked packages updated: [stream-chat-react-native]
9+
10+
### [1.31.4](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.31.4) (2024-11-07)
11+
12+
13+
### Workspaces
14+
15+
* Following linked packages updated: [stream-chat-react-native]
16+
317
### [1.31.3](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.31.3) (2024-11-04)
418

519

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.31.3",
3+
"version": "1.31.5",
44
"private": true,
55
"repository": {
66
"type": "git",

package/CHANGELOG.md

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

3+
### [5.41.4](https://github.com/GetStream/stream-chat-react-native/compare/v5.41.3...v5.41.4) (2024-11-08)
4+
5+
6+
### Bug Fixes
7+
8+
* poll edge cases ([#2768](https://github.com/GetStream/stream-chat-react-native/issues/2768)) ([b26b98c](https://github.com/GetStream/stream-chat-react-native/commit/b26b98c5cb34e5446c1600026fbaa1f442d8dbcb))
9+
* theme for the message bubble and replies ([#2766](https://github.com/GetStream/stream-chat-react-native/issues/2766)) ([980c383](https://github.com/GetStream/stream-chat-react-native/commit/980c3832a4a59ebab07c67f1d24a50ebe587e8fe))
10+
11+
### [5.41.3](https://github.com/GetStream/stream-chat-react-native/compare/v5.41.2...v5.41.3) (2024-11-07)
12+
13+
14+
### Bug Fixes
15+
16+
* check for channel validity before consuming config ([#2760](https://github.com/GetStream/stream-chat-react-native/issues/2760)) ([ff53399](https://github.com/GetStream/stream-chat-react-native/commit/ff5339982914051b6e8f941a4799fc772ce409aa))
17+
* message disallowed indicator display ([#2754](https://github.com/GetStream/stream-chat-react-native/issues/2754)) ([fe08bd7](https://github.com/GetStream/stream-chat-react-native/commit/fe08bd75ea1d7d3041b86b1e8519f2f04b9c19bc))
18+
* native image picker poll control ([#2762](https://github.com/GetStream/stream-chat-react-native/issues/2762)) ([b9c49be](https://github.com/GetStream/stream-chat-react-native/commit/b9c49be85b8d7927dc64f55d7e9ba01b11737016))
19+
* receiverMessageBackgroundColor hotfix ([#2763](https://github.com/GetStream/stream-chat-react-native/issues/2763)) ([5258a18](https://github.com/GetStream/stream-chat-react-native/commit/5258a18468fe9716918ec9e663ae5e0861b17df5))
20+
321
### [5.41.2](https://github.com/GetStream/stream-chat-react-native/compare/v5.41.1...v5.41.2) (2024-11-04)
422

523

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.41.2",
4+
"version": "5.41.4",
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.41.2"
13+
"stream-chat-react-native-core": "5.41.4"
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.41.2",
4+
"version": "5.41.4",
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.41.2"
23+
"stream-chat-react-native-core": "5.41.4"
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.41.2",
4+
"version": "5.41.4",
55
"author": {
66
"company": "Stream.io Inc",
77
"name": "Stream.io Inc"

package/src/components/Channel/Channel.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -881,13 +881,7 @@ const ChannelWithContext = <
881881
setThreadMessages(updatedThreadMessages);
882882
}
883883

884-
if (
885-
channel &&
886-
thread?.id &&
887-
event.message?.id === thread.id &&
888-
!threadInstance &&
889-
!thread.poll_id
890-
) {
884+
if (channel && thread?.id && event.message?.id === thread.id && !threadInstance) {
891885
const updatedThread = channel.state.formatMessage(event.message);
892886
setThread(updatedThread);
893887
}

package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ export type LatestMessagePreview<
4040
export type LatestMessagePreviewSelectorReturnType = {
4141
createdBy?: UserResponse | null;
4242
latestVotesByOption?: Record<string, PollVote[]>;
43+
name?: string;
4344
};
4445

4546
const selector = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
4647
nextValue: PollState<StreamChatGenerics>,
4748
): LatestMessagePreviewSelectorReturnType => ({
4849
createdBy: nextValue.created_by,
4950
latestVotesByOption: nextValue.latest_votes_by_option,
51+
name: nextValue.name,
5052
});
5153

5254
const getMessageSenderName = <
@@ -145,8 +147,8 @@ const getLatestMessageDisplayText = <
145147
{ bold: false, text: t('🏙 Attachment...') },
146148
];
147149
}
148-
if (message.poll && pollState) {
149-
const { createdBy, latestVotesByOption } = pollState;
150+
if (message.poll_id && pollState) {
151+
const { createdBy, latestVotesByOption, name } = pollState;
150152
let latestVotes;
151153
if (latestVotesByOption) {
152154
latestVotes = Object.values(latestVotesByOption)
@@ -161,7 +163,7 @@ const getLatestMessageDisplayText = <
161163
}
162164
const previewMessage = `${
163165
client.userID === previewUser?.id ? 'You' : previewUser?.name
164-
} ${previewAction}: ${message.poll.name}`;
166+
} ${previewAction}: ${name}`;
165167
return [
166168
{ bold: false, text: '📊 ' },
167169
{ bold: false, text: previewMessage },
@@ -298,7 +300,8 @@ export const useLatestMessagePreview = <
298300

299301
useEffect(() => {
300302
if (channelConfigExists) {
301-
const read_events = channel.getConfig()?.read_events;
303+
const read_events =
304+
!channel.disconnected && !!channel?.id && channel.getConfig()?.read_events;
302305
if (typeof read_events === 'boolean') {
303306
setReadEvents(read_events);
304307
}
@@ -310,7 +313,7 @@ export const useLatestMessagePreview = <
310313
const poll = client.polls.fromState(pollId);
311314
const pollState: LatestMessagePreviewSelectorReturnType =
312315
useStateStore(poll?.state, selector) ?? {};
313-
const { createdBy, latestVotesByOption } = pollState;
316+
const { createdBy, latestVotesByOption, name } = pollState;
314317

315318
useEffect(
316319
() =>
@@ -325,7 +328,15 @@ export const useLatestMessagePreview = <
325328
}),
326329
),
327330
// eslint-disable-next-line react-hooks/exhaustive-deps
328-
[channelLastMessageString, forceUpdate, readEvents, readStatus, latestVotesByOption, createdBy],
331+
[
332+
channelLastMessageString,
333+
forceUpdate,
334+
readEvents,
335+
readStatus,
336+
latestVotesByOption,
337+
createdBy,
338+
name,
339+
],
329340
);
330341

331342
return latestMessagePreview;

package/src/components/Chat/hooks/handleEventToSyncDB.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,14 @@ export const handleEventToSyncDB = async <
235235
'poll.vote_removed',
236236
].includes(type)
237237
) {
238-
const poll = event.poll;
238+
const { poll, poll_vote, type } = event;
239239
if (poll) {
240240
return updatePollMessage({
241+
eventType: type,
241242
flush,
242243
poll,
244+
poll_vote,
245+
userID: client?.userID || '',
243246
});
244247
}
245248
}

package/src/components/Message/MessageSimple/MessageContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const MessageContentWithContext = <
139139

140140
const {
141141
theme: {
142-
colors: { grey_gainsboro, grey_whisper },
142+
colors: { light_gray, grey_whisper },
143143
messageSimple: {
144144
content: {
145145
container: {
@@ -171,7 +171,7 @@ const MessageContentWithContext = <
171171

172172
const { hasThreadReplies, isMessageErrorType, isMessageReceivedOrErrorType } = useMessageData({});
173173

174-
const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : grey_gainsboro;
174+
const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : light_gray;
175175

176176
const getBorderRadius = () => {
177177
// enum('top', 'middle', 'bottom', 'single')

0 commit comments

Comments
 (0)