stream-chat-react-native-core 5.22.0-beta.9 → 5.22.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/AudioAttachment.js +12 -12
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +65 -46
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +19 -19
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +13 -13
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +61 -40
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/fr.json +48 -48
- package/lib/commonjs/i18n/hi.json +48 -48
- package/lib/commonjs/i18n/it.json +48 -48
- package/lib/commonjs/i18n/nl.json +48 -48
- package/lib/commonjs/i18n/ru.json +48 -48
- package/lib/commonjs/i18n/tr.json +48 -48
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/compressImage.js +37 -0
- package/lib/commonjs/utils/compressImage.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +12 -12
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +65 -46
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +19 -19
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +13 -13
- package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +61 -40
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/fr.json +48 -48
- package/lib/module/i18n/hi.json +48 -48
- package/lib/module/i18n/it.json +48 -48
- package/lib/module/i18n/nl.json +48 -48
- package/lib/module/i18n/ru.json +48 -48
- package/lib/module/i18n/tr.json +48 -48
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/compressImage.js +37 -0
- package/lib/module/utils/compressImage.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +5 -0
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -23
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +2 -2
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -2
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/fr.json +48 -48
- package/lib/typescript/i18n/hi.json +48 -48
- package/lib/typescript/i18n/it.json +48 -48
- package/lib/typescript/i18n/nl.json +48 -48
- package/lib/typescript/i18n/ru.json +48 -48
- package/lib/typescript/i18n/tr.json +48 -48
- package/lib/typescript/types/types.d.ts +20 -0
- package/lib/typescript/utils/compressImage.d.ts +8 -0
- package/package.json +2 -2
- package/src/components/Attachment/AudioAttachment.tsx +2 -1
- package/src/components/Channel/Channel.tsx +32 -8
- package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -9
- package/src/components/MessageInput/FileUploadPreview.tsx +1 -2
- package/src/components/MessageInput/ImageUploadPreview.tsx +1 -2
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +1 -1
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +1 -1
- package/src/contexts/channelContext/ChannelContext.tsx +5 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +80 -68
- package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -2
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
- package/src/contexts/messagesContext/MessagesContext.tsx +2 -2
- package/src/i18n/en.json +1 -1
- package/src/i18n/fr.json +48 -48
- package/src/i18n/hi.json +48 -48
- package/src/i18n/it.json +48 -48
- package/src/i18n/nl.json +48 -48
- package/src/i18n/ru.json +48 -48
- package/src/i18n/tr.json +48 -48
- package/src/types/types.ts +23 -0
- package/src/utils/compressImage.ts +32 -0
- package/src/version.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"1 Reply": "
|
|
3
|
-
"1 Thread Reply": "
|
|
4
|
-
"Allow access to your Gallery": "
|
|
5
|
-
"Allow camera access in device settings": "
|
|
2
|
+
"1 Reply": "",
|
|
3
|
+
"1 Thread Reply": "",
|
|
4
|
+
"Allow access to your Gallery": "",
|
|
5
|
+
"Allow camera access in device settings": "",
|
|
6
6
|
"Also send to channel": "",
|
|
7
|
-
"Are you sure you want to permanently delete this message?": "",
|
|
8
|
-
"Block User": "",
|
|
9
|
-
"Cancel": "",
|
|
10
|
-
"Cannot Flag Message": "",
|
|
11
|
-
"Copy Message": "",
|
|
12
|
-
"Delete": "",
|
|
13
|
-
"Delete Message": "",
|
|
14
|
-
"Device camera is used to take photos or videos.": "
|
|
15
|
-
"Do you want to send a copy of this message to a moderator for further investigation?": "",
|
|
16
|
-
"Edit Message": "",
|
|
7
|
+
"Are you sure you want to permanently delete this message?": "Вы действительно хотите удалить это сообщение без возможности восстановления?",
|
|
8
|
+
"Block User": "Заблокировать пользователя",
|
|
9
|
+
"Cancel": "Отмена",
|
|
10
|
+
"Cannot Flag Message": "Невозможно пожаловаться на сообщение",
|
|
11
|
+
"Copy Message": "Копировать сообщение",
|
|
12
|
+
"Delete": "удалять",
|
|
13
|
+
"Delete Message": "Удалить сообщение",
|
|
14
|
+
"Device camera is used to take photos or videos.": "",
|
|
15
|
+
"Do you want to send a copy of this message to a moderator for further investigation?": "Вы хотите отправить копию этого сообщения модератору для дальнейшего изучения?",
|
|
16
|
+
"Edit Message": "Редактировать сообщение",
|
|
17
17
|
"Editing Message": "",
|
|
18
18
|
"Emoji matching": "Соответствие эмодзи",
|
|
19
19
|
"Empty message...": "",
|
|
@@ -22,55 +22,55 @@
|
|
|
22
22
|
"Error loading messages for this channel...": "",
|
|
23
23
|
"Error while loading, please reload/refresh": "",
|
|
24
24
|
"File type not supported": "",
|
|
25
|
-
"Flag": "",
|
|
26
|
-
"Flag Message": "",
|
|
27
|
-
"Flag action failed either due to a network issue or the message is already flagged": "",
|
|
25
|
+
"Flag": "Пометить",
|
|
26
|
+
"Flag Message": "Пометить сообщение",
|
|
27
|
+
"Flag action failed either due to a network issue or the message is already flagged": "Не удалось отправить жалобу. Возможные причины: проблема с подключением к интернету или ваша жалоба уже была принята.",
|
|
28
28
|
"How about sending your first message to a friend?": "",
|
|
29
29
|
"Instant Commands": "Мгновенные Команды",
|
|
30
30
|
"Let's start chatting!": "",
|
|
31
|
-
"Links are disabled": "
|
|
31
|
+
"Links are disabled": "",
|
|
32
32
|
"Loading channels...": "",
|
|
33
33
|
"Loading messages...": "",
|
|
34
34
|
"Loading...": "",
|
|
35
|
-
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "
|
|
35
|
+
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
|
|
36
36
|
"Message Reactions": "",
|
|
37
37
|
"Message deleted": "",
|
|
38
|
-
"Message flagged": "",
|
|
39
|
-
"Mute User": "",
|
|
38
|
+
"Message flagged": "Сообщение отмечено",
|
|
39
|
+
"Mute User": "Отключить пользователя",
|
|
40
40
|
"Not supported": "",
|
|
41
41
|
"Nothing yet...": "",
|
|
42
|
-
"Ok": "",
|
|
42
|
+
"Ok": "Oк",
|
|
43
43
|
"Only visible to you": "",
|
|
44
|
-
"Open Settings": "
|
|
45
|
-
"Photo": "
|
|
46
|
-
"Photos and Videos": "
|
|
47
|
-
"Pin to Conversation": "",
|
|
44
|
+
"Open Settings": "",
|
|
45
|
+
"Photo": "",
|
|
46
|
+
"Photos and Videos": "",
|
|
47
|
+
"Pin to Conversation": "Закрепить к беседе",
|
|
48
48
|
"Pinned by": "",
|
|
49
|
-
"Please enable access to your photos and videos so you can share them.": "
|
|
50
|
-
"Please select a channel first": "
|
|
49
|
+
"Please enable access to your photos and videos so you can share them.": "",
|
|
50
|
+
"Please select a channel first": "",
|
|
51
51
|
"Reconnecting...": "",
|
|
52
|
-
"Reply": "",
|
|
52
|
+
"Reply": "Ответить",
|
|
53
53
|
"Reply to Message": "",
|
|
54
|
-
"Resend": "",
|
|
55
|
-
"Search GIFs": "",
|
|
56
|
-
"Select More Photos": "
|
|
57
|
-
"Send a message": "",
|
|
58
|
-
"Sending links is not allowed in this conversation": "
|
|
59
|
-
"Slow mode ON": "",
|
|
60
|
-
"The message has been reported to a moderator.": "",
|
|
61
|
-
"Thread Reply": "",
|
|
62
|
-
"Unblock User": "",
|
|
63
|
-
"Unknown User": "
|
|
64
|
-
"Unmute User": "",
|
|
65
|
-
"Unpin from Conversation": "",
|
|
66
|
-
"Unread Messages": "
|
|
67
|
-
"Video": "
|
|
54
|
+
"Resend": "Отправить",
|
|
55
|
+
"Search GIFs": "Поиск GIF",
|
|
56
|
+
"Select More Photos": "",
|
|
57
|
+
"Send a message": "Отправить сообщение",
|
|
58
|
+
"Sending links is not allowed in this conversation": "",
|
|
59
|
+
"Slow mode ON": "Медленный режим включен",
|
|
60
|
+
"The message has been reported to a moderator.": "Сообщение отправлено модератору.",
|
|
61
|
+
"Thread Reply": "Тема Ответить",
|
|
62
|
+
"Unblock User": "Разблокировать пользователя",
|
|
63
|
+
"Unknown User": "",
|
|
64
|
+
"Unmute User": "Включить микрофон",
|
|
65
|
+
"Unpin from Conversation": "Открепить от беседы",
|
|
66
|
+
"Unread Messages": "",
|
|
67
|
+
"Video": "",
|
|
68
68
|
"You": "",
|
|
69
69
|
"You can't send messages in this channel": "",
|
|
70
|
-
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "
|
|
71
|
-
"{{ index }} of {{ photoLength }}": "
|
|
72
|
-
"{{ replyCount }} Replies": "
|
|
73
|
-
"{{ replyCount }} Thread Replies": "
|
|
74
|
-
"{{ user }} is typing": "
|
|
70
|
+
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
|
|
71
|
+
"{{ index }} of {{ photoLength }}": "",
|
|
72
|
+
"{{ replyCount }} Replies": "",
|
|
73
|
+
"{{ replyCount }} Thread Replies": "",
|
|
74
|
+
"{{ user }} is typing": "",
|
|
75
75
|
"🏙 Attachment...": ""
|
|
76
76
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"1 Reply": "
|
|
3
|
-
"1 Thread Reply": "
|
|
4
|
-
"Allow access to your Gallery": "
|
|
5
|
-
"Allow camera access in device settings": "
|
|
2
|
+
"1 Reply": "",
|
|
3
|
+
"1 Thread Reply": "",
|
|
4
|
+
"Allow access to your Gallery": "",
|
|
5
|
+
"Allow camera access in device settings": "",
|
|
6
6
|
"Also send to channel": "",
|
|
7
|
-
"Are you sure you want to permanently delete this message?": "",
|
|
8
|
-
"Block User": "",
|
|
9
|
-
"Cancel": "",
|
|
10
|
-
"Cannot Flag Message": "",
|
|
11
|
-
"Copy Message": "",
|
|
12
|
-
"Delete": "",
|
|
13
|
-
"Delete Message": "",
|
|
14
|
-
"Device camera is used to take photos or videos.": "
|
|
15
|
-
"Do you want to send a copy of this message to a moderator for further investigation?": "",
|
|
16
|
-
"Edit Message": "",
|
|
7
|
+
"Are you sure you want to permanently delete this message?": "Bu mesajı kalıcı olarak silmek istediğinizden emin misiniz?",
|
|
8
|
+
"Block User": "Kullanıcıyı engelle",
|
|
9
|
+
"Cancel": "İptal",
|
|
10
|
+
"Cannot Flag Message": "Raporlama Başarısız",
|
|
11
|
+
"Copy Message": "Mesajı Kopyala",
|
|
12
|
+
"Delete": "Sil",
|
|
13
|
+
"Delete Message": "Mesajı Sil",
|
|
14
|
+
"Device camera is used to take photos or videos.": "",
|
|
15
|
+
"Do you want to send a copy of this message to a moderator for further investigation?": "Detaylı inceleme için bu mesajın kopyasını moderatöre göndermek istiyor musunuz?",
|
|
16
|
+
"Edit Message": "Mesajı Düzenle",
|
|
17
17
|
"Editing Message": "",
|
|
18
18
|
"Emoji matching": "Emoji eşleştirme",
|
|
19
19
|
"Empty message...": "",
|
|
@@ -22,55 +22,55 @@
|
|
|
22
22
|
"Error loading messages for this channel...": "",
|
|
23
23
|
"Error while loading, please reload/refresh": "",
|
|
24
24
|
"File type not supported": "",
|
|
25
|
-
"Flag": "",
|
|
26
|
-
"Flag Message": "",
|
|
27
|
-
"Flag action failed either due to a network issue or the message is already flagged": "",
|
|
25
|
+
"Flag": "Raporla",
|
|
26
|
+
"Flag Message": "Mesajı Raporla",
|
|
27
|
+
"Flag action failed either due to a network issue or the message is already flagged": "Mesajın daha önce raporlanmış olması veya bir ağ bağlantısı sorunu nedeniyle raporlama işlemi başarısız oldu.",
|
|
28
28
|
"How about sending your first message to a friend?": "",
|
|
29
29
|
"Instant Commands": "Anlık Komutlar",
|
|
30
30
|
"Let's start chatting!": "",
|
|
31
|
-
"Links are disabled": "
|
|
31
|
+
"Links are disabled": "",
|
|
32
32
|
"Loading channels...": "",
|
|
33
33
|
"Loading messages...": "",
|
|
34
34
|
"Loading...": "",
|
|
35
|
-
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "
|
|
35
|
+
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
|
|
36
36
|
"Message Reactions": "",
|
|
37
37
|
"Message deleted": "",
|
|
38
|
-
"Message flagged": "",
|
|
39
|
-
"Mute User": "",
|
|
38
|
+
"Message flagged": "Mesaj işaretlendi",
|
|
39
|
+
"Mute User": "Kullanıcıyı sessize al",
|
|
40
40
|
"Not supported": "",
|
|
41
41
|
"Nothing yet...": "",
|
|
42
|
-
"Ok": "",
|
|
42
|
+
"Ok": "Tamam",
|
|
43
43
|
"Only visible to you": "",
|
|
44
|
-
"Open Settings": "
|
|
45
|
-
"Photo": "
|
|
46
|
-
"Photos and Videos": "
|
|
47
|
-
"Pin to Conversation": "",
|
|
44
|
+
"Open Settings": "",
|
|
45
|
+
"Photo": "",
|
|
46
|
+
"Photos and Videos": "",
|
|
47
|
+
"Pin to Conversation": "Konuşmaya sabitle",
|
|
48
48
|
"Pinned by": "",
|
|
49
|
-
"Please enable access to your photos and videos so you can share them.": "
|
|
50
|
-
"Please select a channel first": "
|
|
49
|
+
"Please enable access to your photos and videos so you can share them.": "",
|
|
50
|
+
"Please select a channel first": "",
|
|
51
51
|
"Reconnecting...": "",
|
|
52
|
-
"Reply": "",
|
|
52
|
+
"Reply": "Yanıtla",
|
|
53
53
|
"Reply to Message": "",
|
|
54
|
-
"Resend": "",
|
|
55
|
-
"Search GIFs": "",
|
|
56
|
-
"Select More Photos": "
|
|
57
|
-
"Send a message": "",
|
|
58
|
-
"Sending links is not allowed in this conversation": "
|
|
59
|
-
"Slow mode ON": "",
|
|
60
|
-
"The message has been reported to a moderator.": "",
|
|
61
|
-
"Thread Reply": "",
|
|
62
|
-
"Unblock User": "",
|
|
63
|
-
"Unknown User": "
|
|
64
|
-
"Unmute User": "",
|
|
65
|
-
"Unpin from Conversation": "",
|
|
66
|
-
"Unread Messages": "
|
|
67
|
-
"Video": "
|
|
54
|
+
"Resend": "Yeniden gönder",
|
|
55
|
+
"Search GIFs": "GIF Ara",
|
|
56
|
+
"Select More Photos": "",
|
|
57
|
+
"Send a message": "Mesaj gönder",
|
|
58
|
+
"Sending links is not allowed in this conversation": "",
|
|
59
|
+
"Slow mode ON": "Yavaş Mod Açık",
|
|
60
|
+
"The message has been reported to a moderator.": "Mesaj moderatöre bildirildi.",
|
|
61
|
+
"Thread Reply": "Konu Yanıtı",
|
|
62
|
+
"Unblock User": "Kullanıcının engelini kaldır",
|
|
63
|
+
"Unknown User": "",
|
|
64
|
+
"Unmute User": "Kullanıcının sesini aç",
|
|
65
|
+
"Unpin from Conversation": "Sabitlemeyi kaldır",
|
|
66
|
+
"Unread Messages": "",
|
|
67
|
+
"Video": "",
|
|
68
68
|
"You": "",
|
|
69
69
|
"You can't send messages in this channel": "",
|
|
70
|
-
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "
|
|
71
|
-
"{{ index }} of {{ photoLength }}": "
|
|
72
|
-
"{{ replyCount }} Replies": "
|
|
73
|
-
"{{ replyCount }} Thread Replies": "
|
|
74
|
-
"{{ user }} is typing": "
|
|
70
|
+
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
|
|
71
|
+
"{{ index }} of {{ photoLength }}": "",
|
|
72
|
+
"{{ replyCount }} Replies": "",
|
|
73
|
+
"{{ replyCount }} Thread Replies": "",
|
|
74
|
+
"{{ user }} is typing": "",
|
|
75
75
|
"🏙 Attachment...": ""
|
|
76
76
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExtendableGenerics, LiteralStringForUnion } from 'stream-chat';
|
|
2
|
+
import type { FileStateValue } from '../utils/utils';
|
|
2
3
|
export declare type Asset = {
|
|
3
4
|
duration: number;
|
|
4
5
|
height: number;
|
|
@@ -18,10 +19,29 @@ export declare type File = {
|
|
|
18
19
|
size?: number;
|
|
19
20
|
uri?: string;
|
|
20
21
|
};
|
|
22
|
+
export declare type FileUpload = {
|
|
23
|
+
file: File;
|
|
24
|
+
id: string;
|
|
25
|
+
state: FileStateValue;
|
|
26
|
+
duration?: number;
|
|
27
|
+
paused?: boolean;
|
|
28
|
+
progress?: number;
|
|
29
|
+
thumb_url?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare type ImageUpload = {
|
|
33
|
+
file: Partial<Asset>;
|
|
34
|
+
id: string;
|
|
35
|
+
state: FileStateValue;
|
|
36
|
+
height?: number;
|
|
37
|
+
url?: string;
|
|
38
|
+
width?: number;
|
|
39
|
+
};
|
|
21
40
|
export declare type DefaultAttachmentType = UnknownType & {
|
|
22
41
|
file_size?: number;
|
|
23
42
|
mime_type?: string;
|
|
24
43
|
originalFile?: File;
|
|
44
|
+
originalImage?: Partial<Asset>;
|
|
25
45
|
};
|
|
26
46
|
interface DefaultUserType extends UnknownType {
|
|
27
47
|
image?: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Asset } from '../types/types';
|
|
2
|
+
/**
|
|
3
|
+
* Function to compress and Image and return the compressed Image URI
|
|
4
|
+
* @param image
|
|
5
|
+
* @param compressImageQuality
|
|
6
|
+
* @returns string
|
|
7
|
+
*/
|
|
8
|
+
export declare const compressedImageURI: (image: Partial<Asset>, compressImageQuality?: number | undefined) => Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.22.
|
|
4
|
+
"version": "5.22.1-beta.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"path": "0.12.7",
|
|
80
80
|
"react-native-markdown-package": "1.8.2",
|
|
81
81
|
"react-native-url-polyfill": "^1.3.0",
|
|
82
|
-
"stream-chat": "
|
|
82
|
+
"stream-chat": "8.14.4"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"react-native-quick-sqlite": ">=5.1.0",
|
|
@@ -4,7 +4,7 @@ import { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-nat
|
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import duration from 'dayjs/plugin/duration';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useTheme } from '../../contexts';
|
|
8
8
|
import { Pause, Play } from '../../icons';
|
|
9
9
|
import {
|
|
10
10
|
PlaybackStatus,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
VideoPayloadData,
|
|
14
14
|
VideoProgressData,
|
|
15
15
|
} from '../../native';
|
|
16
|
+
import type { FileUpload } from '../../types/types';
|
|
16
17
|
import { ProgressControl } from '../ProgressControl/ProgressControl';
|
|
17
18
|
|
|
18
19
|
dayjs.extend(duration);
|
|
@@ -78,6 +78,7 @@ import { FlatList as FlatListDefault, pickDocument } from '../../native';
|
|
|
78
78
|
import * as dbApi from '../../store/apis';
|
|
79
79
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
80
80
|
import { addReactionToLocalState } from '../../utils/addReactionToLocalState';
|
|
81
|
+
import { compressedImageURI } from '../../utils/compressImage';
|
|
81
82
|
import { DBSyncManager } from '../../utils/DBSyncManager';
|
|
82
83
|
import { patchMessageTextCommand } from '../../utils/patchMessageTextCommand';
|
|
83
84
|
import { removeReactionFromLocalState } from '../../utils/removeReactionFromLocalState';
|
|
@@ -589,6 +590,13 @@ const ChannelWithContext = <
|
|
|
589
590
|
|
|
590
591
|
const { setTargetedMessage, targetedMessage } = useTargetedMessage();
|
|
591
592
|
|
|
593
|
+
/**
|
|
594
|
+
* This ref will hold the abort controllers for
|
|
595
|
+
* requests made for uploading images/files in the messageInputContext
|
|
596
|
+
* Its a map of filename to AbortController
|
|
597
|
+
*/
|
|
598
|
+
const uploadAbortControllerRef = useRef<Map<string, AbortController>>(new Map());
|
|
599
|
+
|
|
592
600
|
const channelId = channel?.id || '';
|
|
593
601
|
useEffect(() => {
|
|
594
602
|
const initChannel = () => {
|
|
@@ -1290,20 +1298,28 @@ const ChannelWithContext = <
|
|
|
1290
1298
|
if (updatedMessage.attachments?.length) {
|
|
1291
1299
|
for (let i = 0; i < updatedMessage.attachments?.length; i++) {
|
|
1292
1300
|
const attachment = updatedMessage.attachments[i];
|
|
1301
|
+
const image = attachment.originalImage;
|
|
1293
1302
|
const file = attachment.originalFile;
|
|
1294
1303
|
// check if image_url is not a remote url
|
|
1295
1304
|
if (
|
|
1296
1305
|
attachment.type === 'image' &&
|
|
1297
|
-
|
|
1306
|
+
image?.uri &&
|
|
1298
1307
|
attachment.image_url &&
|
|
1299
1308
|
isLocalUrl(attachment.image_url)
|
|
1300
1309
|
) {
|
|
1301
|
-
const filename =
|
|
1310
|
+
const filename = image.name ?? image.uri.replace(/^(file:\/\/|content:\/\/)/, '');
|
|
1311
|
+
// if any upload is in progress, cancel it
|
|
1312
|
+
const controller = uploadAbortControllerRef.current.get(filename);
|
|
1313
|
+
if (controller) {
|
|
1314
|
+
controller.abort();
|
|
1315
|
+
uploadAbortControllerRef.current.delete(filename);
|
|
1316
|
+
}
|
|
1317
|
+
const compressedUri = await compressedImageURI(image, compressImageQuality);
|
|
1302
1318
|
const contentType = lookup(filename) || 'multipart/form-data';
|
|
1303
1319
|
|
|
1304
1320
|
const uploadResponse = doImageUploadRequest
|
|
1305
|
-
? await doImageUploadRequest(
|
|
1306
|
-
: await channel.sendImage(
|
|
1321
|
+
? await doImageUploadRequest(image, channel)
|
|
1322
|
+
: await channel.sendImage(compressedUri, filename, contentType);
|
|
1307
1323
|
|
|
1308
1324
|
attachment.image_url = uploadResponse.file;
|
|
1309
1325
|
delete attachment.originalFile;
|
|
@@ -1321,6 +1337,12 @@ const ChannelWithContext = <
|
|
|
1321
1337
|
isLocalUrl(attachment.asset_url) &&
|
|
1322
1338
|
file?.uri
|
|
1323
1339
|
) {
|
|
1340
|
+
// if any upload is in progress, cancel it
|
|
1341
|
+
const controller = uploadAbortControllerRef.current.get(file.name);
|
|
1342
|
+
if (controller) {
|
|
1343
|
+
controller.abort();
|
|
1344
|
+
uploadAbortControllerRef.current.delete(file.name);
|
|
1345
|
+
}
|
|
1324
1346
|
const response = doDocUploadRequest
|
|
1325
1347
|
? await doDocUploadRequest(file, channel)
|
|
1326
1348
|
: await channel.sendFile(file.uri, file.name, file.mimeType);
|
|
@@ -1587,15 +1609,16 @@ const ChannelWithContext = <
|
|
|
1587
1609
|
: client.updateMessage(updatedMessage);
|
|
1588
1610
|
|
|
1589
1611
|
const setEditingState: MessagesContextValue<StreamChatGenerics>['setEditingState'] = (
|
|
1590
|
-
|
|
1612
|
+
messageOrBoolean,
|
|
1591
1613
|
) => {
|
|
1592
|
-
|
|
1614
|
+
clearQuotedMessageState();
|
|
1615
|
+
setEditing(messageOrBoolean);
|
|
1593
1616
|
};
|
|
1594
1617
|
|
|
1595
1618
|
const setQuotedMessageState: MessagesContextValue<StreamChatGenerics>['setQuotedMessageState'] = (
|
|
1596
|
-
|
|
1619
|
+
messageOrBoolean,
|
|
1597
1620
|
) => {
|
|
1598
|
-
setQuotedMessage(
|
|
1621
|
+
setQuotedMessage(messageOrBoolean);
|
|
1599
1622
|
};
|
|
1600
1623
|
|
|
1601
1624
|
const clearEditingState: InputMessageInputContextValue<StreamChatGenerics>['clearEditingState'] =
|
|
@@ -1851,6 +1874,7 @@ const ChannelWithContext = <
|
|
|
1851
1874
|
StickyHeader,
|
|
1852
1875
|
targetedMessage,
|
|
1853
1876
|
threadList,
|
|
1877
|
+
uploadAbortControllerRef,
|
|
1854
1878
|
watcherCount,
|
|
1855
1879
|
watchers,
|
|
1856
1880
|
});
|
|
@@ -36,6 +36,7 @@ export const useCreateChannelContext = <
|
|
|
36
36
|
StickyHeader,
|
|
37
37
|
targetedMessage,
|
|
38
38
|
threadList,
|
|
39
|
+
uploadAbortControllerRef,
|
|
39
40
|
watcherCount,
|
|
40
41
|
watchers,
|
|
41
42
|
}: ChannelContextValue<StreamChatGenerics>) => {
|
|
@@ -79,6 +80,7 @@ export const useCreateChannelContext = <
|
|
|
79
80
|
StickyHeader,
|
|
80
81
|
targetedMessage,
|
|
81
82
|
threadList,
|
|
83
|
+
uploadAbortControllerRef,
|
|
82
84
|
watcherCount,
|
|
83
85
|
watchers,
|
|
84
86
|
}),
|
|
@@ -53,7 +53,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
53
53
|
*/
|
|
54
54
|
channelId?: string;
|
|
55
55
|
}) => {
|
|
56
|
-
const
|
|
56
|
+
const editingDep = typeof editing === 'boolean' ? editing : editing?.id;
|
|
57
57
|
const quotedMessageId = quotedMessage
|
|
58
58
|
? typeof quotedMessage === 'boolean'
|
|
59
59
|
? ''
|
|
@@ -103,14 +103,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
103
103
|
ShowThreadMessageInChannelButton,
|
|
104
104
|
UploadProgressIndicator,
|
|
105
105
|
}),
|
|
106
|
-
[
|
|
107
|
-
compressImageQuality,
|
|
108
|
-
channelId,
|
|
109
|
-
editingExists,
|
|
110
|
-
initialValue,
|
|
111
|
-
maxMessageLength,
|
|
112
|
-
quotedMessageId,
|
|
113
|
-
],
|
|
106
|
+
[compressImageQuality, channelId, editingDep, initialValue, maxMessageLength, quotedMessageId],
|
|
114
107
|
);
|
|
115
108
|
|
|
116
109
|
return inputMessageInputContext;
|
|
@@ -7,7 +7,6 @@ import { UploadProgressIndicator } from './UploadProgressIndicator';
|
|
|
7
7
|
|
|
8
8
|
import { ChatContextValue, useChatContext } from '../../contexts';
|
|
9
9
|
import {
|
|
10
|
-
FileUpload,
|
|
11
10
|
MessageInputContextValue,
|
|
12
11
|
useMessageInputContext,
|
|
13
12
|
} from '../../contexts/messageInputContext/MessageInputContext';
|
|
@@ -20,7 +19,7 @@ import { useTranslationContext } from '../../contexts/translationContext/Transla
|
|
|
20
19
|
import { Close } from '../../icons/Close';
|
|
21
20
|
import { Warning } from '../../icons/Warning';
|
|
22
21
|
import { isAudioPackageAvailable } from '../../native';
|
|
23
|
-
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
22
|
+
import type { DefaultStreamChatGenerics, FileUpload } from '../../types/types';
|
|
24
23
|
import { FileState, getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
|
|
25
24
|
import { getFileSizeDisplayText } from '../Attachment/FileAttachment';
|
|
26
25
|
import { WritingDirectionAwareText } from '../RTLComponents/WritingDirectionAwareText';
|
|
@@ -13,7 +13,6 @@ import { UploadProgressIndicator } from './UploadProgressIndicator';
|
|
|
13
13
|
|
|
14
14
|
import { ChatContextValue, useChatContext } from '../../contexts';
|
|
15
15
|
import {
|
|
16
|
-
ImageUpload,
|
|
17
16
|
MessageInputContextValue,
|
|
18
17
|
useMessageInputContext,
|
|
19
18
|
} from '../../contexts/messageInputContext/MessageInputContext';
|
|
@@ -21,7 +20,7 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
|
21
20
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
22
21
|
import { Close } from '../../icons/Close';
|
|
23
22
|
import { Warning } from '../../icons/Warning';
|
|
24
|
-
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
23
|
+
import type { DefaultStreamChatGenerics, ImageUpload } from '../../types/types';
|
|
25
24
|
import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
|
|
26
25
|
|
|
27
26
|
const IMAGE_PREVIEW_SIZE = 100;
|
|
@@ -5,7 +5,6 @@ import { act } from 'react-test-renderer';
|
|
|
5
5
|
import { fireEvent, render } from '@testing-library/react-native';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
FileUpload,
|
|
9
8
|
MessageInputContext,
|
|
10
9
|
MessageInputContextValue,
|
|
11
10
|
} from '../../../contexts/messageInputContext/MessageInputContext';
|
|
@@ -13,6 +12,7 @@ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
|
|
|
13
12
|
import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
|
|
14
13
|
|
|
15
14
|
import { generateFileUploadPreview } from '../../../mock-builders/generator/attachment';
|
|
15
|
+
import type { FileUpload } from '../../../types/types';
|
|
16
16
|
import { AudioAttachment, AudioAttachmentProps } from '../../Attachment/AudioAttachment';
|
|
17
17
|
|
|
18
18
|
jest.mock('../../../native.ts', () => ({
|
|
@@ -5,7 +5,6 @@ import { act } from 'react-test-renderer';
|
|
|
5
5
|
import { fireEvent, render } from '@testing-library/react-native';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
FileUpload,
|
|
9
8
|
MessageInputContext,
|
|
10
9
|
MessageInputContextValue,
|
|
11
10
|
} from '../../../contexts/messageInputContext/MessageInputContext';
|
|
@@ -13,6 +12,7 @@ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
|
|
|
13
12
|
import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
|
|
14
13
|
|
|
15
14
|
import { generateFileUploadPreview } from '../../../mock-builders/generator/attachment';
|
|
15
|
+
import type { FileUpload } from '../../../types/types';
|
|
16
16
|
import { AudioAttachment, AudioAttachmentProps } from '../../Attachment/AudioAttachment';
|
|
17
17
|
|
|
18
18
|
jest.mock('../../../native.ts', () => {
|
|
@@ -137,6 +137,11 @@ export type ChannelContextValue<
|
|
|
137
137
|
scrollToFirstUnreadThreshold: number;
|
|
138
138
|
setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;
|
|
139
139
|
setTargetedMessage: (messageId: string) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Abort controller for cancelling async requests made for uploading images/files
|
|
142
|
+
* Its a map of filename and AbortController
|
|
143
|
+
*/
|
|
144
|
+
uploadAbortControllerRef: React.MutableRefObject<Map<string, AbortController>>;
|
|
140
145
|
/**
|
|
141
146
|
*
|
|
142
147
|
* ```json
|