@cometchat/chat-uikit-react-native 4.1.3 → 4.1.4

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 CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  [![Platform](https://img.shields.io/badge/Platform-ReactNative-brightgreen.svg)](#)
13
13
  [![Platform](https://img.shields.io/badge/Language-TypeScript-yellowgreen.svg)](#)
14
- ![Version](https://shields.io/badge/version-v4.1.3-orange)
14
+ ![Version](https://shields.io/badge/version-v4.1.4-orange)
15
15
  ![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)
16
16
 
17
17
  ## Table of contents
package/ios/FileManager.m CHANGED
@@ -246,6 +246,7 @@ RCT_EXPORT_METHOD(startRecording:(RCTResponseSenderBlock)callback) {
246
246
  [self setupRecorderWithResult:callback];
247
247
  // callback(@[@"{\"success\": true}"]);
248
248
  } else {
249
+ callback(@[@"{\"granted\": false}"]);
249
250
  // Failed to record
250
251
  }
251
252
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
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",
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useEffect } from 'react';
2
2
  import { CometChatContext, CometChatContextType, ImageType, localize } from "../..";
3
- import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert } from "react-native";
3
+ import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert, Platform } from "react-native";
4
4
  import { Style } from "./style";
5
5
  import { ICONS } from '../../framework/resources';
6
6
  import { MediaRecorderStyle, MediaRecorderStyleInterface } from './MediaRecorderStyle';
@@ -58,7 +58,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
58
58
 
59
59
  return async () => {
60
60
  let microphonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
61
- if (!microphonePermission) return;
61
+ if (!microphonePermission && Platform.OS === "android") return;
62
62
  NativeModules.FileManager.deleteFile((success) => console.log("Filepath delete", success));
63
63
  NativeModules.FileManager.releaseMediaResources((result) => { });
64
64
  clearInterval(timerIntervalId)
@@ -69,9 +69,24 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
69
69
 
70
70
  const recordingInitiator = async () => {
71
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();
72
+ if (microphonePermission || Platform.OS === "ios") {
73
+ NativeModules.FileManager.startRecording((filepath) => {
74
+ if (Platform.OS === "ios") {
75
+ try {
76
+ let resObj = JSON.parse(filepath);
77
+ if (resObj?.granted === false) {
78
+ Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
79
+ onClose && onClose();
80
+ } else {
81
+ startInterval();
82
+ }
83
+ } catch (error) {
84
+ Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
85
+ onClose && onClose();
86
+ }
87
+ }
88
+ });
89
+ Platform.OS === "android" && startInterval();
75
90
  } else {
76
91
  Alert.alert(undefined, localize("MICROPHONE_PERMISSION"));
77
92
  onClose && onClose();