Skip to content

Commit 2f336f3

Browse files
committed
fix: all instances of FormatMessageResponse in respect to the new llc changes
1 parent f509a27 commit 2f336f3

File tree

19 files changed

+69
-55
lines changed

19 files changed

+69
-55
lines changed

examples/SampleApp/yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -4075,7 +4075,7 @@ es6-iterator@^2.0.3:
40754075
es5-ext "^0.10.35"
40764076
es6-symbol "^3.1.1"
40774077

4078-
es6-symbol@^3.1.1, es6-symbol@^3.1.3:
4078+
es6-symbol@^3.1.1, es6-symbol@^3.1.3, es6-symbol@^3.1.4:
40794079
version "3.1.4"
40804080
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.4.tgz#f4e7d28013770b4208ecbf3e0bf14d3bcb557b8c"
40814081
integrity sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==
@@ -5854,7 +5854,7 @@ lines-and-columns@^1.1.6:
58545854
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
58555855
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
58565856

5857-
linkifyjs@^4.1.1:
5857+
linkifyjs@^4.1.1, linkifyjs@^4.2.0:
58585858
version "4.2.0"
58595859
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
58605860
integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
@@ -7538,10 +7538,9 @@ statuses@~1.5.0:
75387538
version "0.0.0"
75397539
uid ""
75407540

7541-
stream-chat@9.0.0-rc.8:
7542-
version "9.0.0-rc.8"
7543-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0-rc.8.tgz#e188e481841493584691ae491916843d0ef5f9cd"
7544-
integrity sha512-P+Ksnu1cQQfL1t2/QTJ5rr/z2Jehvd2ap41xZgtfbJssHSD7ahe14TCF/1L7q4jjaNlZcTtLcKXCWbbOdKjDcg==
7541+
"stream-chat@https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917":
7542+
version "0.0.0-development"
7543+
resolved "https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917"
75457544
dependencies:
75467545
"@types/jsonwebtoken" "^9.0.8"
75477546
"@types/ws" "^8.5.14"
@@ -7550,6 +7549,7 @@ stream-chat@9.0.0-rc.8:
75507549
form-data "^4.0.0"
75517550
isomorphic-ws "^5.0.0"
75527551
jsonwebtoken "^9.0.2"
7552+
linkifyjs "^4.2.0"
75537553
ws "^8.18.1"
75547554

75557555
strict-uri-encode@^2.0.0:

package/expo-package/yarn.lock

+9-4
Original file line numberDiff line numberDiff line change
@@ -3589,6 +3589,11 @@ linkifyjs@^4.1.1:
35893589
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.1.1.tgz#73d427e3bbaaf4ca8e71c589ad4ffda11a9a5fde"
35903590
integrity sha512-zFN/CTVmbcVef+WaDXT63dNzzkfRBKT1j464NJQkV7iSgJU0sLBus9W0HBwnXK13/hf168pbrx/V/bjEHOXNHA==
35913591

3592+
linkifyjs@^4.2.0:
3593+
version "4.2.0"
3594+
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
3595+
integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
3596+
35923597
locate-path@^3.0.0:
35933598
version "3.0.0"
35943599
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
@@ -4772,10 +4777,9 @@ stream-buffers@2.2.x, stream-buffers@~2.2.0:
47724777
version "0.0.0"
47734778
uid ""
47744779

4775-
stream-chat@9.0.0-rc.8:
4776-
version "9.0.0-rc.8"
4777-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0-rc.8.tgz#e188e481841493584691ae491916843d0ef5f9cd"
4778-
integrity sha512-P+Ksnu1cQQfL1t2/QTJ5rr/z2Jehvd2ap41xZgtfbJssHSD7ahe14TCF/1L7q4jjaNlZcTtLcKXCWbbOdKjDcg==
4780+
"stream-chat@https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917":
4781+
version "0.0.0-development"
4782+
resolved "https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917"
47794783
dependencies:
47804784
"@types/jsonwebtoken" "^9.0.8"
47814785
"@types/ws" "^8.5.14"
@@ -4784,6 +4788,7 @@ stream-chat@9.0.0-rc.8:
47844788
form-data "^4.0.0"
47854789
isomorphic-ws "^5.0.0"
47864790
jsonwebtoken "^9.0.2"
4791+
linkifyjs "^4.2.0"
47874792
ws "^8.18.1"
47884793

47894794
"string-width-cjs@npm:string-width@^4.2.0":

package/native-package/yarn.lock

+9-4
Original file line numberDiff line numberDiff line change
@@ -2520,6 +2520,11 @@ linkifyjs@^4.1.1:
25202520
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.1.1.tgz#73d427e3bbaaf4ca8e71c589ad4ffda11a9a5fde"
25212521
integrity sha512-zFN/CTVmbcVef+WaDXT63dNzzkfRBKT1j464NJQkV7iSgJU0sLBus9W0HBwnXK13/hf168pbrx/V/bjEHOXNHA==
25222522

2523+
linkifyjs@^4.2.0:
2524+
version "4.2.0"
2525+
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
2526+
integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
2527+
25232528
locate-path@^3.0.0:
25242529
version "3.0.0"
25252530
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
@@ -3488,10 +3493,9 @@ statuses@~1.5.0:
34883493
version "0.0.0"
34893494
uid ""
34903495

3491-
stream-chat@9.0.0-rc.8:
3492-
version "9.0.0-rc.8"
3493-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0-rc.8.tgz#e188e481841493584691ae491916843d0ef5f9cd"
3494-
integrity sha512-P+Ksnu1cQQfL1t2/QTJ5rr/z2Jehvd2ap41xZgtfbJssHSD7ahe14TCF/1L7q4jjaNlZcTtLcKXCWbbOdKjDcg==
3496+
"stream-chat@https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917":
3497+
version "0.0.0-development"
3498+
resolved "https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917"
34953499
dependencies:
34963500
"@types/jsonwebtoken" "^9.0.8"
34973501
"@types/ws" "^8.5.14"
@@ -3500,6 +3504,7 @@ stream-chat@9.0.0-rc.8:
35003504
form-data "^4.0.0"
35013505
isomorphic-ws "^5.0.0"
35023506
jsonwebtoken "^9.0.2"
3507+
linkifyjs "^4.2.0"
35033508
ws "^8.18.1"
35043509

35053510
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:

package/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"path": "0.12.7",
7878
"react-native-markdown-package": "1.8.2",
7979
"react-native-url-polyfill": "^1.3.0",
80-
"stream-chat": "9.0.0-rc.8",
80+
"stream-chat": "https://github.com/GetStream/stream-chat-js.git#9bc79358e9d0a23e0ff7e2a056711289e5bdf917",
8181
"use-sync-external-store": "^1.4.0"
8282
},
8383
"peerDependencies": {

package/src/components/Attachment/Gallery.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ export const Gallery = (props: GalleryProps) => {
605605
const videos = propVideos || contextVideos;
606606
const message = propMessage || contextMessage;
607607

608+
console.log('TEST: ', images, videos);
608609
if (!images.length && !videos.length) {
609610
return null;
610611
}

package/src/components/Channel/Channel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
ChannelState,
1212
Channel as ChannelType,
1313
EventHandler,
14-
FormatMessageResponse,
14+
LocalMessage,
1515
MessageLabel,
1616
MessageResponse,
1717
Reaction,
@@ -1009,7 +1009,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
10091009
});
10101010
}
10111011

1012-
const parseMessage = (message: FormatMessageResponse) =>
1012+
const parseMessage = (message: LocalMessage) =>
10131013
({
10141014
...message,
10151015
created_at: message.created_at.toString(),

package/src/components/MessageList/MessageList.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ViewToken,
1111
} from 'react-native';
1212

13-
import type { FormatMessageResponse } from 'stream-chat';
13+
import type { LocalMessage } from 'stream-chat';
1414

1515
import {
1616
isMessageWithStylesReadByAndDateSeparator,
@@ -310,9 +310,9 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
310310
* We need topMessage and channelLastRead values to set the initial scroll position.
311311
* So these values only get used if `initialScrollToFirstUnreadMessage` prop is true.
312312
*/
313-
const topMessageBeforeUpdate = useRef<FormatMessageResponse>(undefined);
314-
const latestNonCurrentMessageBeforeUpdateRef = useRef<FormatMessageResponse>(undefined);
315-
const topMessageAfterUpdate: FormatMessageResponse | undefined = rawMessageList[0];
313+
const topMessageBeforeUpdate = useRef<LocalMessage>(undefined);
314+
const latestNonCurrentMessageBeforeUpdateRef = useRef<LocalMessage>(undefined);
315+
const topMessageAfterUpdate: LocalMessage | undefined = rawMessageList[0];
316316

317317
const shouldScrollToRecentOnNewOwnMessageRef = useShouldScrollToRecentOnNewOwnMessage(
318318
rawMessageList,

package/src/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useEffect, useRef } from 'react';
22

3-
import type { FormatMessageResponse } from 'stream-chat';
3+
import type { LocalMessage } from 'stream-chat';
44

55
export function useShouldScrollToRecentOnNewOwnMessage(
6-
rawMessageList: FormatMessageResponse[],
6+
rawMessageList: LocalMessage[],
77
currentUserId?: string,
88
) {
99
const lastFocusedOwnMessageId = useRef('');

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ exports[`Thread should match thread snapshot 1`] = `
5353
"created_at": 2020-05-05T14:50:00.000Z,
5454
"dateSeparator": undefined,
5555
"deleted_at": null,
56+
"error": null,
5657
"groupStyles": [
5758
"single",
5859
],
@@ -61,6 +62,7 @@ exports[`Thread should match thread snapshot 1`] = `
6162
"message_text_updated_at": "2020-05-05T14:50:00.000Z",
6263
"parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04",
6364
"pinned_at": null,
65+
"quoted_message": null,
6466
"reaction_groups": null,
6567
"readBy": false,
6668
"status": "received",
@@ -83,6 +85,7 @@ exports[`Thread should match thread snapshot 1`] = `
8385
"created_at": 2020-05-05T14:50:00.000Z,
8486
"dateSeparator": undefined,
8587
"deleted_at": null,
88+
"error": null,
8689
"groupStyles": [
8790
"single",
8891
],
@@ -91,6 +94,7 @@ exports[`Thread should match thread snapshot 1`] = `
9194
"message_text_updated_at": "2020-05-05T14:50:00.000Z",
9295
"parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04",
9396
"pinned_at": null,
97+
"quoted_message": null,
9498
"reaction_groups": null,
9599
"readBy": false,
96100
"status": "received",
@@ -113,6 +117,7 @@ exports[`Thread should match thread snapshot 1`] = `
113117
"created_at": 2020-05-05T14:50:00.000Z,
114118
"dateSeparator": 2020-05-05T14:50:00.000Z,
115119
"deleted_at": null,
120+
"error": null,
116121
"groupStyles": [
117122
"single",
118123
],
@@ -121,6 +126,7 @@ exports[`Thread should match thread snapshot 1`] = `
121126
"message_text_updated_at": "2020-05-05T14:50:00.000Z",
122127
"parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04",
123128
"pinned_at": null,
129+
"quoted_message": null,
124130
"reaction_groups": null,
125131
"readBy": false,
126132
"status": "received",

package/src/contexts/messageInputContext/MessageInputContext.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,8 @@ export const MessageInputProvider = ({
998998
const updatedMessage = {
999999
...message,
10001000
attachments,
1001-
mentioned_users: mentionedUsers,
1001+
// FIXME: Temp fix, check the implications of this.
1002+
mentioned_users: mentionedUsers.map((userId) => ({ id: userId })),
10021003
quoted_message: undefined,
10031004
text: prevText,
10041005
...customMessageData,

package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ exports[`MessageInputContext's sendMessage exit sendMessage when edit message is
1818
"html": "<p>regular</p>",
1919
"id": "7a85f744-cc89-4f82-a1d4-5456432cc8bf",
2020
"mentioned_users": [
21-
"dummy1",
22-
"dummy2",
21+
{
22+
"id": "dummy1",
23+
},
24+
{
25+
"id": "dummy2",
26+
},
2327
],
2428
"quoted_message": undefined,
2529
"text": "",

package/src/hooks/useTranslatedMessage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { FormatMessageResponse, MessageResponse, TranslationLanguages } from 'stream-chat';
1+
import type { LocalMessage, MessageResponse, TranslationLanguages } from 'stream-chat';
22

33
import { useTranslationContext } from '../contexts/translationContext/TranslationContext';
44

55
type TranslationKey = `${TranslationLanguages}_text`;
66

7-
export const useTranslatedMessage = (message?: MessageResponse | FormatMessageResponse) => {
7+
export const useTranslatedMessage = (message?: MessageResponse | LocalMessage) => {
88
const { userLanguage } = useTranslationContext();
99

1010
const translationKey: TranslationKey = `${userLanguage}_text`;

package/src/mock-builders/api/channelMocks.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import type {
2-
Attachment,
3-
Channel,
4-
FormatMessageResponse,
5-
MessageResponse,
6-
UserResponse,
7-
} from 'stream-chat';
1+
import type { Attachment, Channel, LocalMessage, MessageResponse, UserResponse } from 'stream-chat';
82

93
import {
104
GROUP_CHANNEL_MEMBERS_MOCK,
@@ -168,7 +162,7 @@ const LATEST_MESSAGE = {
168162
user: { id: 'okechukwu' } as unknown as UserResponse,
169163
} as unknown as MessageResponse;
170164

171-
const FORMATTED_MESSAGE: FormatMessageResponse = {
165+
const FORMATTED_MESSAGE: LocalMessage = {
172166
created_at: new Date('2021-02-12T12:12:35.862282Z'),
173167
id: '',
174168
message: {} as unknown as MessageResponse,

package/src/store/apis/insertReaction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FormatMessageResponse, MessageResponse, ReactionResponse } from 'stream-chat';
1+
import type { LocalMessage, MessageResponse, ReactionResponse } from 'stream-chat';
22

33
import { mapReactionToStorable } from '../mappers/mapReactionToStorable';
44
import { createUpdateQuery } from '../sqlite-utils/createUpdateQuery';
@@ -11,7 +11,7 @@ export const insertReaction = async ({
1111
message,
1212
reaction,
1313
}: {
14-
message: MessageResponse | FormatMessageResponse;
14+
message: MessageResponse | LocalMessage;
1515
reaction: ReactionResponse;
1616
flush?: boolean;
1717
}) => {

package/src/store/apis/updateMessage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FormatMessageResponse, MessageResponse } from 'stream-chat';
1+
import type { LocalMessage, MessageResponse } from 'stream-chat';
22

33
import { mapMessageToStorable } from '../mappers/mapMessageToStorable';
44
import { mapReactionToStorable } from '../mappers/mapReactionToStorable';
@@ -14,7 +14,7 @@ export const updateMessage = async ({
1414
flush = true,
1515
message,
1616
}: {
17-
message: MessageResponse | FormatMessageResponse;
17+
message: MessageResponse | LocalMessage;
1818
flush?: boolean;
1919
}) => {
2020
const queries: PreparedQueries[] = [];

package/src/store/apis/updateReaction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FormatMessageResponse, MessageResponse, ReactionResponse } from 'stream-chat';
1+
import type { LocalMessage, MessageResponse, ReactionResponse } from 'stream-chat';
22

33
import { mapMessageToStorable } from '../mappers/mapMessageToStorable';
44
import { mapReactionToStorable } from '../mappers/mapReactionToStorable';
@@ -13,7 +13,7 @@ export const updateReaction = async ({
1313
message,
1414
reaction,
1515
}: {
16-
message: MessageResponse | FormatMessageResponse;
16+
message: MessageResponse | LocalMessage;
1717
reaction: ReactionResponse;
1818
flush?: boolean;
1919
}) => {

package/src/store/mappers/mapMessageToStorable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { FormatMessageResponse, MessageResponse } from 'stream-chat';
1+
import type { LocalMessage, MessageResponse } from 'stream-chat';
22

33
import { mapDateTimeToStorable } from './mapDateTimeToStorable';
44

55
import type { TableRow } from '../types';
66

77
export const mapMessageToStorable = (
8-
message: MessageResponse | FormatMessageResponse,
8+
message: MessageResponse | LocalMessage,
99
): TableRow<'messages'> => {
1010
const {
1111
attachments,

package/src/utils/utils.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type React from 'react';
22

33
import dayjs from 'dayjs';
44
import EmojiRegex from 'emoji-regex';
5-
import type { ChannelState, FormatMessageResponse, MessageResponse } from 'stream-chat';
5+
import type { ChannelState, LocalMessage, MessageResponse } from 'stream-chat';
66

77
import { IconProps } from '../../src/icons/utils/base';
88
import {
@@ -187,12 +187,10 @@ export const hasOnlyEmojis = (text: string) => {
187187

188188
/**
189189
* Stringifies a message object
190-
* @param {FormatMessageResponse} message - the message object to be stringified
190+
* @param {LocalMessage} message - the message object to be stringified
191191
* @returns {string} The stringified message
192192
*/
193-
export const stringifyMessage = (
194-
message: MessageResponse | FormatMessageResponse | MessageType,
195-
): string => {
193+
export const stringifyMessage = (message: MessageResponse | LocalMessage | MessageType): string => {
196194
const {
197195
deleted_at,
198196
i18n,
@@ -224,7 +222,7 @@ export const stringifyMessage = (
224222
* @param {messages} messages - the array of messages to be compared
225223
* @returns {string} The mapped message string
226224
*/
227-
export const reduceMessagesToString = (messages: FormatMessageResponse[]): string =>
225+
export const reduceMessagesToString = (messages: LocalMessage[]): string =>
228226
messages.map(stringifyMessage).join();
229227

230228
/**

0 commit comments

Comments
 (0)