@cometchat/chat-uikit-react-native 4.1.1 → 4.1.3
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/README.md +1 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +5 -1
- package/package.json +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +6 -6
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +2 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +2 -1
- package/src/shared/utils/conversationUtils.ts +3 -0
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +19 -5
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[](#)
|
|
13
13
|
[](#)
|
|
14
|
-

|
|
15
15
|

|
|
16
16
|
|
|
17
17
|
## Table of contents
|
|
@@ -88,7 +88,11 @@ public class FileManager extends ReactContextBaseJavaModule {
|
|
|
88
88
|
mContext = context.getApplicationContext();
|
|
89
89
|
mReactContext = context;
|
|
90
90
|
folderPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath();
|
|
91
|
-
|
|
91
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
92
|
+
context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_NOT_EXPORTED);
|
|
93
|
+
} else {
|
|
94
|
+
context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
|
95
|
+
}
|
|
92
96
|
context.addActivityEventListener(activityEventListener);
|
|
93
97
|
}
|
|
94
98
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react-native",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"module": "src/index",
|
|
@@ -389,19 +389,19 @@ export const CometChatMessageList = forwardRef<
|
|
|
389
389
|
.fetchNext()
|
|
390
390
|
.then(newMessages => {
|
|
391
391
|
let cleanUpdatedList = [...updatedList];
|
|
392
|
-
for (let i =
|
|
392
|
+
for (let i = (cleanUpdatedList.length - 1); i >= 0; i--) {
|
|
393
393
|
if (cleanUpdatedList[i].id == lastID.current) break;
|
|
394
|
-
if (cleanUpdatedList[i].id == undefined)
|
|
394
|
+
if (cleanUpdatedList[i].id == undefined || Number.isNaN(parseInt(cleanUpdatedList[i].id)))
|
|
395
395
|
cleanUpdatedList.splice(i, 1);
|
|
396
396
|
}
|
|
397
397
|
// console.log("newMessages", newMessages.length, JSON.stringify(newMessages))
|
|
398
|
-
if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[
|
|
399
|
-
let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[
|
|
398
|
+
if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]) {
|
|
399
|
+
let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]);
|
|
400
400
|
if (localFileExists > -1) {
|
|
401
401
|
cleanUpdatedList.shift();
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
let tmpList = [...newMessages.reverse()
|
|
404
|
+
let tmpList = [...cleanUpdatedList, ...newMessages.reverse()];
|
|
405
405
|
tmpList = tmpList.map((item: CometChat.BaseMessage, index) => {
|
|
406
406
|
if (item.getCategory() === MessageCategoryConstants.interactive) {
|
|
407
407
|
return InteractiveMessageUtils.convertInteractiveMessage(item);
|
|
@@ -570,7 +570,7 @@ export const CometChatMessageList = forwardRef<
|
|
|
570
570
|
const deleteMessage = (message: CometChat.BaseMessage) => {
|
|
571
571
|
CometChat.deleteMessage(message.getId().toString())
|
|
572
572
|
.then(res => {
|
|
573
|
-
|
|
573
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageDeleted, { message: res });
|
|
574
574
|
setShowMessageOptions([]);
|
|
575
575
|
})
|
|
576
576
|
.catch(rej => {
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"لا توجد تسجيلات",
|
|
288
288
|
"CALL_LOGS":"سجلات المكالمات",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"مكالمة صوتية ملغاة",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"مكالمة فيديو ملغاة"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"مكالمة فيديو ملغاة",
|
|
291
|
+
"MICROPHONE_PERMISSION":"نحن نستخدم الميكروفون لتسجيل الرسائل الصوتية ومشاركتها. انتقل إلى الإعدادات لتمكين الوصول إلى الميكروفون"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Keine Aufzeichnungen",
|
|
288
288
|
"CALL_LOGS":"Anruflisten",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Abgebrochener Audioanruf",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Videoanruf abgesagt"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Videoanruf abgesagt",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Wir verwenden ein Mikrofon, um Audionachrichten aufzunehmen und zu teilen. Gehen Sie zu den Einstellungen, um den Mikrofonzugriff zu aktivieren"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"No Recordings",
|
|
288
288
|
"CALL_LOGS":"Call Logs",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Cancelled audio call",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Cancelled video call"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Cancelled video call",
|
|
291
|
+
"MICROPHONE_PERMISSION": "We use microphone to record and share audio messages. Go to settings to enable microphone access"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Sin grabaciones",
|
|
288
288
|
"CALL_LOGS":"Registros de llamadas",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Llamada de audio cancelada",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Videollamada cancelada"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Videollamada cancelada",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Usamos el micrófono para grabar y compartir mensajes de audio. Ve a la configuración para habilitar el acceso al micrófono"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Aucun enregistrement",
|
|
288
288
|
"CALL_LOGS":"Journaux d'appels",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Appel audio annulé",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Appel vidéo annulé"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Appel vidéo annulé",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Nous utilisons un microphone pour enregistrer et partager des messages audio. Accédez aux paramètres pour activer l'accès au microphone"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"कोई रिकॉर्डिंग नहीं",
|
|
288
288
|
"CALL_LOGS":"कॉल लॉग्स",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"रद्द किया गया ऑडियो कॉल",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"रद्द किया गया वीडियो कॉल"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"रद्द किया गया वीडियो कॉल",
|
|
291
|
+
"MICROPHONE_PERMISSION":"हम ऑडियो संदेशों को रिकॉर्ड करने और साझा करने के लिए माइक्रोफ़ोन का उपयोग करते हैं। माइक्रोफ़ोन ऐक्सेस चालू करने के लिए सेटिंग में जाएँ"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Nessuna registrazione",
|
|
288
288
|
"CALL_LOGS":"Registri delle chiamate",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Chiamata audio annullata",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Videochiamata annullata"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Videochiamata annullata",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Utilizziamo il microfono per registrare e condividere messaggi audio. Vai alle impostazioni per abilitare l'accesso al microfono"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Tiada Rakaman",
|
|
288
288
|
"CALL_LOGS":"Log Panggilan",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Panggilan audio yang dibatalkan",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Panggilan video dibatalkan"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Panggilan video dibatalkan",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Kami menggunakan mikrofon untuk merakam dan berkongsi mesej audio. Pergi ke tetapan untuk membolehkan akses mikrofon"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Sem gravações",
|
|
288
288
|
"CALL_LOGS":"Registros de chamadas",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Chamada de áudio cancelada",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Chamada de vídeo cancelada"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Chamada de vídeo cancelada",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Usamos o microfone para gravar e compartilhar mensagens de áudio. Vá para as configurações para ativar o acesso ao microfone"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Нет записей",
|
|
288
288
|
"CALL_LOGS":"Журналы вызовов",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Отмененный аудиозвонок",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Отмененный видеозвонок"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Отмененный видеозвонок",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Мы используем микрофон для записи аудиосообщений и обмена ими. Перейдите в настройки, чтобы включить доступ к микрофону"
|
|
291
292
|
}
|
|
@@ -287,5 +287,6 @@
|
|
|
287
287
|
"NO_RECORDINGS":"Inga inspelningar",
|
|
288
288
|
"CALL_LOGS":"Samtalsloggar",
|
|
289
289
|
"CANCELLED_AUDIO_CALL":"Avbrutet ljudsamtal",
|
|
290
|
-
"CANCELLED_VIDEO_CALL":"Avbrutet videosamtal"
|
|
290
|
+
"CANCELLED_VIDEO_CALL":"Avbrutet videosamtal",
|
|
291
|
+
"MICROPHONE_PERMISSION":"Vi använder mikrofon för att spela in och dela ljudmeddelanden. Gå till inställningar för att aktivera mikrofonåtkomst"
|
|
291
292
|
}
|
|
@@ -66,6 +66,9 @@ export class CometChatConversationUtils {
|
|
|
66
66
|
} else if (lastMessage.getCategory() == CometChat.CATEGORY_CUSTOM as CometChat.MessageCategory) {
|
|
67
67
|
msgText = lastMessage.getType();
|
|
68
68
|
} else if (lastMessage.getCategory() == CometChat.CATEGORY_ACTION as CometChat.MessageCategory) {
|
|
69
|
+
if ((lastMessage as CometChat.Action)?.getAction() === CometChat.ACTION_TYPE.MESSSAGE_DELETED) {
|
|
70
|
+
return localize("THIS_MESSAGE_DELETED");
|
|
71
|
+
}
|
|
69
72
|
msgText = (lastMessage as CometChat.Action).getMessage();
|
|
70
73
|
} else if (lastMessage.getCategory() === CometChat.CATEGORY_INTERACTIVE) {
|
|
71
74
|
msgText = lastMessage.getType() === "form" ? `${localize('FORM')} 📋` : `${localize('CARD')} 🪧`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
|
-
import { CometChatContext, CometChatContextType, ImageType } from "../..";
|
|
3
|
-
import { View, TouchableOpacity, Text, Image, NativeModules, FlatList } from "react-native";
|
|
2
|
+
import { CometChatContext, CometChatContextType, ImageType, localize } from "../..";
|
|
3
|
+
import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert } from "react-native";
|
|
4
4
|
import { Style } from "./style";
|
|
5
5
|
import { ICONS } from '../../framework/resources';
|
|
6
6
|
import { MediaRecorderStyle, MediaRecorderStyleInterface } from './MediaRecorderStyle';
|
|
@@ -54,9 +54,11 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
|
|
|
54
54
|
} = _style;
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return () => {
|
|
57
|
+
recordingInitiator();
|
|
58
|
+
|
|
59
|
+
return async () => {
|
|
60
|
+
let microphonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
|
|
61
|
+
if (!microphonePermission) return;
|
|
60
62
|
NativeModules.FileManager.deleteFile((success) => console.log("Filepath delete", success));
|
|
61
63
|
NativeModules.FileManager.releaseMediaResources((result) => { });
|
|
62
64
|
clearInterval(timerIntervalId)
|
|
@@ -65,6 +67,18 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
|
|
|
65
67
|
}
|
|
66
68
|
}, [])
|
|
67
69
|
|
|
70
|
+
const recordingInitiator = async () => {
|
|
71
|
+
let microphonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
|
|
72
|
+
if (microphonePermission) {
|
|
73
|
+
NativeModules.FileManager.startRecording((filepath) => { console.log("Filepath startRecording", filepath) });
|
|
74
|
+
startInterval();
|
|
75
|
+
} else {
|
|
76
|
+
Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
|
|
77
|
+
onClose && onClose();
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
const startInterval = () => {
|
|
69
83
|
timerIntervalId = setInterval(timer, 1000);
|
|
70
84
|
}
|