Skip to content

Commit

Permalink
v4.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitninawe-cometchat committed Jun 4, 2024
1 parent 6d2e83a commit bd416f0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

[![Platform](https://img.shields.io/badge/Platform-ReactNative-brightgreen.svg)](#)
[![Platform](https://img.shields.io/badge/Language-TypeScript-yellowgreen.svg)](#)
![Version](https://shields.io/badge/version-v4.1.3-orange)
![Version](https://shields.io/badge/version-v4.1.4-orange)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)

## Table of contents
Expand Down
1 change: 1 addition & 0 deletions ios/FileManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ - (void)shareMedia:(id)item {
[self setupRecorderWithResult:callback];
// callback(@[@"{\"success\": true}"]);
} else {
callback(@[@"{\"granted\": false}"]);
// Failed to record
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cometchat/chat-uikit-react-native",
"version": "4.1.3",
"version": "4.1.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",
"main": "src/index",
"module": "src/index",
Expand Down
25 changes: 20 additions & 5 deletions src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext, useEffect } from 'react';
import { CometChatContext, CometChatContextType, ImageType, localize } from "../..";
import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert } from "react-native";
import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert, Platform } from "react-native";
import { Style } from "./style";
import { ICONS } from '../../framework/resources';
import { MediaRecorderStyle, MediaRecorderStyleInterface } from './MediaRecorderStyle';
Expand Down Expand Up @@ -58,7 +58,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =

return async () => {
let microphonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
if (!microphonePermission) return;
if (!microphonePermission && Platform.OS === "android") return;
NativeModules.FileManager.deleteFile((success) => console.log("Filepath delete", success));
NativeModules.FileManager.releaseMediaResources((result) => { });
clearInterval(timerIntervalId)
Expand All @@ -69,9 +69,24 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =

const recordingInitiator = async () => {
let microphonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
if (microphonePermission) {
NativeModules.FileManager.startRecording((filepath) => { console.log("Filepath startRecording", filepath) });
startInterval();
if (microphonePermission || Platform.OS === "ios") {
NativeModules.FileManager.startRecording((filepath) => {
if (Platform.OS === "ios") {
try {
let resObj = JSON.parse(filepath);
if (resObj?.granted === false) {
Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
onClose && onClose();
} else {
startInterval();
}
} catch (error) {
Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
onClose && onClose();
}
}
});
Platform.OS === "android" && startInterval();
} else {
Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
onClose && onClose();
Expand Down

0 comments on commit bd416f0

Please sign in to comment.