stream-chat-react-native 5.36.1-beta.2 → 5.36.1-beta.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native",
|
|
3
3
|
"description": "The official React Native SDK for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.36.1-beta.
|
|
4
|
+
"version": "5.36.1-beta.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"types": "types/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"es6-symbol": "^3.1.3",
|
|
14
|
-
"stream-chat-react-native-core": "5.36.1-beta.
|
|
14
|
+
"stream-chat-react-native-core": "5.36.1-beta.4"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@react-native-camera-roll/camera-roll": ">=5.0.0",
|
|
@@ -168,74 +168,85 @@ const verifyAndroidPermissions = async () => {
|
|
|
168
168
|
return true;
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
171
|
+
class _Audio {
|
|
172
|
+
pausePlayer = async () => {
|
|
173
|
+
await audioRecorderPlayer.pausePlayer();
|
|
174
|
+
};
|
|
175
|
+
resumePlayer = async () => {
|
|
176
|
+
await audioRecorderPlayer.resumePlayer();
|
|
177
|
+
};
|
|
178
|
+
startPlayer = async (uri, _, onPlaybackStatusUpdate) => {
|
|
179
|
+
try {
|
|
180
|
+
const playback = await audioRecorderPlayer.startPlayer(uri);
|
|
181
|
+
console.log({ playback });
|
|
182
|
+
audioRecorderPlayer.addPlayBackListener((status) => {
|
|
183
|
+
onPlaybackStatusUpdate(status);
|
|
184
|
+
});
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.log('Error starting player', error);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
startRecording = async (options: RecordingOptions, onRecordingStatusUpdate) => {
|
|
190
|
+
if (Platform.OS === 'android') {
|
|
191
|
+
try {
|
|
192
|
+
await verifyAndroidPermissions();
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.warn('Audio Recording Permissions error', err);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const path = Platform.select({
|
|
200
|
+
android: `${RNFS.CachesDirectoryPath}/sound.aac`,
|
|
201
|
+
ios: 'sound.aac',
|
|
202
|
+
});
|
|
203
|
+
const audioSet = {
|
|
204
|
+
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
|
|
205
|
+
AudioSourceAndroid: AudioSourceAndroidType.MIC,
|
|
206
|
+
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
|
|
207
|
+
AVFormatIDKeyIOS: AVEncodingOption.aac,
|
|
208
|
+
AVModeIOS: AVModeIOSOption.measurement,
|
|
209
|
+
AVNumberOfChannelsKeyIOS: 2,
|
|
210
|
+
OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
|
|
211
|
+
};
|
|
212
|
+
const recording = await audioRecorderPlayer.startRecorder(
|
|
213
|
+
path,
|
|
214
|
+
audioSet,
|
|
215
|
+
options?.isMeteringEnabled,
|
|
216
|
+
);
|
|
218
217
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
console.log(error);
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
stopRecording: async () => {
|
|
237
|
-
await audioRecorderPlayer.stopRecorder();
|
|
238
|
-
audioRecorderPlayer.removeRecordBackListener();
|
|
239
|
-
},
|
|
218
|
+
audioRecorderPlayer.addRecordBackListener((status) => {
|
|
219
|
+
onRecordingStatusUpdate(status);
|
|
220
|
+
});
|
|
221
|
+
return { accessGranted: true, recording };
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.error('Failed to start recording', error);
|
|
224
|
+
// There is currently a bug in react-native-audio-recorder-player and we
|
|
225
|
+
// need to do this until it gets fixed. More information can be found here:
|
|
226
|
+
// https://github.com/hyochan/react-native-audio-recorder-player/pull/625
|
|
227
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
228
|
+
audioRecorderPlayer._isRecording = false;
|
|
229
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
230
|
+
audioRecorderPlayer._hasPausedRecord = false;
|
|
231
|
+
return { accessGranted: false, recording: null };
|
|
240
232
|
}
|
|
241
|
-
|
|
233
|
+
};
|
|
234
|
+
stopPlayer = async () => {
|
|
235
|
+
try {
|
|
236
|
+
await audioRecorderPlayer.stopPlayer();
|
|
237
|
+
audioRecorderPlayer.removePlayBackListener();
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.log(error);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
stopRecording = async () => {
|
|
243
|
+
try {
|
|
244
|
+
await audioRecorderPlayer.stopRecorder();
|
|
245
|
+
audioRecorderPlayer.removeRecordBackListener();
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.log(error);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export const Audio = AudioRecorderPackage ? new _Audio() : null;
|
|
@@ -10,7 +10,9 @@ try {
|
|
|
10
10
|
export const pickImage = ImagePicker
|
|
11
11
|
? async () => {
|
|
12
12
|
try {
|
|
13
|
-
const result = await ImagePicker.launchImageLibrary({
|
|
13
|
+
const result = await ImagePicker.launchImageLibrary({
|
|
14
|
+
mediaType: 'mixed',
|
|
15
|
+
});
|
|
14
16
|
const canceled = result.didCancel;
|
|
15
17
|
const errorCode = result.errorCode;
|
|
16
18
|
|
|
@@ -20,7 +22,7 @@ export const pickImage = ImagePicker
|
|
|
20
22
|
if (!canceled) {
|
|
21
23
|
const assets = result.assets.map((asset) => ({
|
|
22
24
|
...asset,
|
|
23
|
-
duration: asset.duration * 1000, // in milliseconds
|
|
25
|
+
duration: asset.duration ? asset.duration * 1000 : undefined, // in milliseconds
|
|
24
26
|
name: asset.fileName,
|
|
25
27
|
size: asset.fileSize,
|
|
26
28
|
source: 'picker',
|