stream-chat-react-native-core 5.22.0-beta.8 → 5.22.0

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.
Files changed (104) hide show
  1. package/lib/commonjs/components/Attachment/AudioAttachment.js +12 -12
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  3. package/lib/commonjs/components/Channel/Channel.js +65 -46
  4. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  5. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
  6. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  8. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  9. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +19 -19
  10. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  11. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +13 -13
  12. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  13. package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
  14. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  15. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +61 -40
  16. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  17. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  18. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  19. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  20. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  21. package/lib/commonjs/i18n/en.json +1 -1
  22. package/lib/commonjs/i18n/fr.json +64 -64
  23. package/lib/commonjs/i18n/hi.json +64 -64
  24. package/lib/commonjs/i18n/it.json +64 -64
  25. package/lib/commonjs/i18n/nl.json +64 -64
  26. package/lib/commonjs/i18n/ru.json +64 -64
  27. package/lib/commonjs/i18n/tr.json +64 -64
  28. package/lib/commonjs/types/types.js.map +1 -1
  29. package/lib/commonjs/utils/compressImage.js +37 -0
  30. package/lib/commonjs/utils/compressImage.js.map +1 -0
  31. package/lib/commonjs/version.json +1 -1
  32. package/lib/module/components/Attachment/AudioAttachment.js +12 -12
  33. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  34. package/lib/module/components/Channel/Channel.js +65 -46
  35. package/lib/module/components/Channel/Channel.js.map +1 -1
  36. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
  37. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  38. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  39. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  40. package/lib/module/components/MessageInput/FileUploadPreview.js +19 -19
  41. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  42. package/lib/module/components/MessageInput/ImageUploadPreview.js +13 -13
  43. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  44. package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
  45. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  46. package/lib/module/contexts/messageInputContext/MessageInputContext.js +61 -40
  47. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  48. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  49. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  50. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  51. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  52. package/lib/module/i18n/en.json +1 -1
  53. package/lib/module/i18n/fr.json +64 -64
  54. package/lib/module/i18n/hi.json +64 -64
  55. package/lib/module/i18n/it.json +64 -64
  56. package/lib/module/i18n/nl.json +64 -64
  57. package/lib/module/i18n/ru.json +64 -64
  58. package/lib/module/i18n/tr.json +64 -64
  59. package/lib/module/types/types.js.map +1 -1
  60. package/lib/module/utils/compressImage.js +37 -0
  61. package/lib/module/utils/compressImage.js.map +1 -0
  62. package/lib/module/version.json +1 -1
  63. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +1 -1
  64. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  65. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
  66. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  67. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +5 -0
  68. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -23
  69. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +2 -2
  70. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -2
  71. package/lib/typescript/i18n/en.json +1 -1
  72. package/lib/typescript/i18n/fr.json +64 -64
  73. package/lib/typescript/i18n/hi.json +64 -64
  74. package/lib/typescript/i18n/it.json +64 -64
  75. package/lib/typescript/i18n/nl.json +64 -64
  76. package/lib/typescript/i18n/ru.json +64 -64
  77. package/lib/typescript/i18n/tr.json +64 -64
  78. package/lib/typescript/types/types.d.ts +20 -0
  79. package/lib/typescript/utils/compressImage.d.ts +8 -0
  80. package/package.json +2 -2
  81. package/src/components/Attachment/AudioAttachment.tsx +2 -1
  82. package/src/components/Channel/Channel.tsx +32 -8
  83. package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
  84. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -9
  85. package/src/components/MessageInput/FileUploadPreview.tsx +1 -2
  86. package/src/components/MessageInput/ImageUploadPreview.tsx +1 -2
  87. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +1 -1
  88. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +1 -1
  89. package/src/contexts/channelContext/ChannelContext.tsx +5 -0
  90. package/src/contexts/messageInputContext/MessageInputContext.tsx +80 -68
  91. package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
  92. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -2
  93. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
  94. package/src/contexts/messagesContext/MessagesContext.tsx +2 -2
  95. package/src/i18n/en.json +1 -1
  96. package/src/i18n/fr.json +64 -64
  97. package/src/i18n/hi.json +64 -64
  98. package/src/i18n/it.json +64 -64
  99. package/src/i18n/nl.json +64 -64
  100. package/src/i18n/ru.json +64 -64
  101. package/src/i18n/tr.json +64 -64
  102. package/src/types/types.ts +23 -0
  103. package/src/utils/compressImage.ts +32 -0
  104. package/src/version.json +1 -1
@@ -1,76 +1,76 @@
1
1
  {
2
- "1 Reply": "",
3
- "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
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": "",
17
- "Editing Message": "",
2
+ "1 Reply": "1 Ответ",
3
+ "1 Thread Reply": "1 тема Ответить",
4
+ "Allow access to your Gallery": "Разрешить доступ к вашей галерее",
5
+ "Allow camera access in device settings": "Разрешите доступ к камере в настройках устройства.",
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": "Редактировать сообщение",
17
+ "Editing Message": "Редактирование сообщения",
18
18
  "Emoji matching": "Соответствие эмодзи",
19
- "Empty message...": "",
20
- "Error loading": "",
21
- "Error loading channel list...": "",
22
- "Error loading messages for this channel...": "",
23
- "Error while loading, please reload/refresh": "",
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": "",
28
- "How about sending your first message to a friend?": "",
19
+ "Empty message...": "Пустое сообщение...",
20
+ "Error loading": "Ошибка при загрузке",
21
+ "Error loading channel list...": "Ошибка загрузки списка каналов...",
22
+ "Error loading messages for this channel...": "Ошибка загрузки сообщений для этого канала...",
23
+ "Error while loading, please reload/refresh": "Ошибка загрузки, пожалуйста перезагрузите или обновите",
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": "Не удалось отправить жалобу. Возможные причины: проблема с подключением к интернету или ваша жалоба уже была принята.",
28
+ "How about sending your first message to a friend?": "Как насчет отправки первого сообщения другу?",
29
29
  "Instant Commands": "Мгновенные Команды",
30
- "Let's start chatting!": "",
31
- "Links are disabled": "",
32
- "Loading channels...": "",
33
- "Loading messages...": "",
34
- "Loading...": "",
35
- "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
36
- "Message Reactions": "",
37
- "Message deleted": "",
38
- "Message flagged": "",
39
- "Mute User": "",
30
+ "Let's start chatting!": "Давайте начнем общаться!",
31
+ "Links are disabled": "Ссылки отключены",
32
+ "Loading channels...": "Загружаю каналы...",
33
+ "Loading messages...": "Загружаю сообщения...",
34
+ "Loading...": "Загружаю...",
35
+ "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Достигнут предел максимального размера файла для загрузки. Загрузите файл размером менее {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} МБ.",
36
+ "Message Reactions": "Сообщения Реакции",
37
+ "Message deleted": "Сообщение удалено",
38
+ "Message flagged": "Сообщение отмечено",
39
+ "Mute User": "Отключить пользователя",
40
40
  "Not supported": "не поддерживается",
41
- "Nothing yet...": "",
42
- "Ok": "",
43
- "Only visible to you": "",
44
- "Open Settings": "",
41
+ "Nothing yet...": "Пока ничего нет...",
42
+ "Ok": "",
43
+ "Only visible to you": "Видно только вам",
44
+ "Open Settings": "Открыть настройки",
45
45
  "Photo": "Фото",
46
- "Photos and Videos": "",
47
- "Pin to Conversation": "",
48
- "Pinned by": "",
49
- "Please enable access to your photos and videos so you can share them.": "",
50
- "Please select a channel first": "",
51
- "Reconnecting...": "",
52
- "Reply": "",
53
- "Reply to Message": "",
54
- "Resend": "",
46
+ "Photos and Videos": "Фото и видео",
47
+ "Pin to Conversation": "Закрепить к беседе",
48
+ "Pinned by": "Закреплено пользователем",
49
+ "Please enable access to your photos and videos so you can share them.": "Разрешите доступ к своим фотографиям и видео, чтобы вы могли ими поделиться.",
50
+ "Please select a channel first": "Пожалуйста, сначала выберите канал",
51
+ "Reconnecting...": "Переподключение...",
52
+ "Reply": "Ответить",
53
+ "Reply to Message": "Ответить на сообщение",
54
+ "Resend": "Отправить",
55
55
  "Search GIFs": "Поиск GIF",
56
- "Select More Photos": "",
56
+ "Select More Photos": "Выбрать больше фотографий",
57
57
  "Send a message": "Отправить сообщение",
58
- "Sending links is not allowed in this conversation": "",
58
+ "Sending links is not allowed in this conversation": "Отправка ссылок недоступна в этом чате",
59
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": "",
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
67
  "Video": "видео",
68
- "You": "",
69
- "You can't send messages in this channel": "",
68
+ "You": "Вы",
69
+ "You can't send messages in this channel": "Вы не можете отправлять сообщения в этот канал",
70
70
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} и еще {{ nonSelfUserLength }} пишут",
71
- "{{ index }} of {{ photoLength }}": "",
72
- "{{ replyCount }} Replies": "",
73
- "{{ replyCount }} Thread Replies": "",
71
+ "{{ index }} of {{ photoLength }}": "{{ index }} из {{ photoLength }}",
72
+ "{{ replyCount }} Replies": "{{ replyCount }} Ответов",
73
+ "{{ replyCount }} Thread Replies": "{{replyCount}} Ответы в темах",
74
74
  "{{ user }} is typing": "{{ user }} пишет",
75
- "🏙 Attachment...": ""
75
+ "🏙 Attachment...": "🏙 Вложение..."
76
76
  }
@@ -1,76 +1,76 @@
1
1
  {
2
- "1 Reply": "",
3
- "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
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": "",
17
- "Editing Message": "",
2
+ "1 Reply": "1 Cevap",
3
+ "1 Thread Reply": "1 Konu Yanıtı",
4
+ "Allow access to your Gallery": "Galerinize erişime izin verin",
5
+ "Allow camera access in device settings": "Cihaz ayarlarında kamera erişimine izin ver",
6
+ "Also send to channel": "Kanala da gönder",
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.": "Cihaz kamerası fotoğraf veya video çekmek için kullanılır.",
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
+ "Editing Message": "Mesaj Düzenleniyor",
18
18
  "Emoji matching": "Emoji eşleştirme",
19
- "Empty message...": "",
20
- "Error loading": "",
21
- "Error loading channel list...": "",
22
- "Error loading messages for this channel...": "",
23
- "Error while loading, please reload/refresh": "",
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": "",
28
- "How about sending your first message to a friend?": "",
19
+ "Empty message...": "Boş mesaj...",
20
+ "Error loading": "Yükleme hatası",
21
+ "Error loading channel list...": "Kanal listesi yüklenirken hata oluştu...",
22
+ "Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
23
+ "Error while loading, please reload/refresh": "Yüklenirken hata oluştu, lütfen tekrar deneyiniz",
24
+ "File type not supported": "Dosya türü desteklenmiyor",
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
+ "How about sending your first message to a friend?": "İlk mesajınızı bir arkadaşınıza göndermeye ne dersiniz?",
29
29
  "Instant Commands": "Anlık Komutlar",
30
- "Let's start chatting!": "",
31
- "Links are disabled": "",
32
- "Loading channels...": "",
33
- "Loading messages...": "",
34
- "Loading...": "",
35
- "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
36
- "Message Reactions": "",
37
- "Message deleted": "",
38
- "Message flagged": "",
39
- "Mute User": "",
30
+ "Let's start chatting!": "Haydi sohbete başlayalım!",
31
+ "Links are disabled": "Bağlantılar devre dışı",
32
+ "Loading channels...": "Kanallar yükleniyor...",
33
+ "Loading messages...": "Mesajlar yükleniyor...",
34
+ "Loading...": "Yükleniyor...",
35
+ "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Maksimum dosya boyutu yükleme sınırına ulaşıldı. Lütfen {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB'ın altında bir dosya yükleyin.",
36
+ "Message Reactions": "Mesaj Tepkileri",
37
+ "Message deleted": "Mesaj silindi",
38
+ "Message flagged": "Mesaj işaretlendi",
39
+ "Mute User": "Kullanıcıyı sessize al",
40
40
  "Not supported": "Desteklenmiyor",
41
- "Nothing yet...": "",
42
- "Ok": "",
43
- "Only visible to you": "",
44
- "Open Settings": "",
41
+ "Nothing yet...": "Henüz değil...",
42
+ "Ok": "Tamam",
43
+ "Only visible to you": "Sadece siz görebilirsiniz",
44
+ "Open Settings": "Ayarları aç",
45
45
  "Photo": "Fotoğraf",
46
- "Photos and Videos": "",
47
- "Pin to Conversation": "",
48
- "Pinned by": "",
49
- "Please enable access to your photos and videos so you can share them.": "",
50
- "Please select a channel first": "",
51
- "Reconnecting...": "",
52
- "Reply": "",
53
- "Reply to Message": "",
54
- "Resend": "",
46
+ "Photos and Videos": "Fotoğraflar ve Videolar",
47
+ "Pin to Conversation": "Konuşmaya sabitle",
48
+ "Pinned by": "Tarafından sabitlendi",
49
+ "Please enable access to your photos and videos so you can share them.": "Paylaşım yapabilmek için lutfen fotoğraflarınıza ve videolarınıza erişimi etkinleştirin.",
50
+ "Please select a channel first": "Lütfen önce bir kanal seçiniz",
51
+ "Reconnecting...": "Yeniden Bağlanılıyor...",
52
+ "Reply": "Yanıtla",
53
+ "Reply to Message": "Mesajı Yanıtla",
54
+ "Resend": "Yeniden gönder",
55
55
  "Search GIFs": "GIF Ara",
56
- "Select More Photos": "",
56
+ "Select More Photos": "Daha Fazla Fotoğraf Seçin",
57
57
  "Send a message": "Mesaj gönder",
58
- "Sending links is not allowed in this conversation": "",
58
+ "Sending links is not allowed in this conversation": "Bu konuşmada bağlantı göndermek desteklenmiyor",
59
59
  "Slow mode ON": "Yavaş Mod Açık",
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": "",
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": "Bilinmeyen kullanıcı",
64
+ "Unmute User": "Kullanıcının sesini aç",
65
+ "Unpin from Conversation": "Sabitlemeyi kaldır",
66
+ "Unread Messages": "Okunmamış Mesajlar",
67
67
  "Video": "Video",
68
- "You": "",
69
- "You can't send messages in this channel": "",
68
+ "You": "Sen",
69
+ "You can't send messages in this channel": "Bu konuşmaya mesaj gönderemezsiniz",
70
70
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} ve {{ nonSelfUserLength }} kişi daha yazıyor",
71
- "{{ index }} of {{ photoLength }}": "",
72
- "{{ replyCount }} Replies": "",
73
- "{{ replyCount }} Thread Replies": "",
71
+ "{{ index }} of {{ photoLength }}": "{{ index }} / {{ photoLength }}",
72
+ "{{ replyCount }} Replies": "{{ replyCount }} Cevap",
73
+ "{{ replyCount }} Thread Replies": "{{responseCount}} Konu Cevapı",
74
74
  "{{ user }} is typing": "{{ user }} yazıyor",
75
- "🏙 Attachment...": ""
75
+ "🏙 Attachment...": "🏙 Ek..."
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.0-beta.8",
4
+ "version": "5.22.0",
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": "~8.14.0"
82
+ "stream-chat": "~8.14.3"
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 { FileUpload, useTheme } from '../../contexts';
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
- file?.uri &&
1306
+ image?.uri &&
1298
1307
  attachment.image_url &&
1299
1308
  isLocalUrl(attachment.image_url)
1300
1309
  ) {
1301
- const filename = file.name ?? file.uri.replace(/^(file:\/\/|content:\/\/)/, '');
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(file, channel)
1306
- : await channel.sendImage(file.uri, filename, contentType);
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
- message,
1612
+ messageOrBoolean,
1591
1613
  ) => {
1592
- setEditing(message);
1614
+ clearQuotedMessageState();
1615
+ setEditing(messageOrBoolean);
1593
1616
  };
1594
1617
 
1595
1618
  const setQuotedMessageState: MessagesContextValue<StreamChatGenerics>['setQuotedMessageState'] = (
1596
- message,
1619
+ messageOrBoolean,
1597
1620
  ) => {
1598
- setQuotedMessage(message);
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 editingExists = !!editing;
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