stream-chat-react-native 8.13.5 → 8.13.7
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": "8.13.
|
|
4
|
+
"version": "8.13.7",
|
|
5
5
|
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
6
6
|
"author": {
|
|
7
7
|
"company": "Stream.io Inc",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"es6-symbol": "^3.1.3",
|
|
28
28
|
"mime": "^4.0.7",
|
|
29
|
-
"stream-chat-react-native-core": "8.13.
|
|
29
|
+
"stream-chat-react-native-core": "8.13.7"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@react-native-camera-roll/camera-roll": ">=7.8.0",
|
|
@@ -92,9 +92,12 @@ export const getPhotos = CameraRollDependency
|
|
|
92
92
|
results.edges.map(async (edge) => {
|
|
93
93
|
const originalUri = edge.node?.image?.uri;
|
|
94
94
|
const type =
|
|
95
|
-
Platform.OS === 'ios'
|
|
96
|
-
? mime.getType(edge.node.image.filename as string)
|
|
97
|
-
: edge.node.type
|
|
95
|
+
(Platform.OS === 'ios'
|
|
96
|
+
? mime.getType(edge.node.image.filename as string) || edge.node.type
|
|
97
|
+
: edge.node.type) ||
|
|
98
|
+
mime.getType(edge.node.image.filename as string) ||
|
|
99
|
+
mime.getType(originalUri) ||
|
|
100
|
+
(edge.node.image.playableDuration ? 'video/*' : 'image/*');
|
|
98
101
|
const isImage = type.includes('image');
|
|
99
102
|
|
|
100
103
|
const uri =
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import mime from 'mime';
|
|
2
3
|
import { PickImageOptions } from 'stream-chat-react-native-core';
|
|
3
4
|
let ImagePicker;
|
|
4
5
|
|
|
@@ -28,7 +29,10 @@ export const pickImage = ImagePicker
|
|
|
28
29
|
duration: asset.duration ? asset.duration * 1000 : undefined, // in milliseconds
|
|
29
30
|
name: asset.fileName,
|
|
30
31
|
size: asset.fileSize,
|
|
31
|
-
type:
|
|
32
|
+
type:
|
|
33
|
+
asset.type ||
|
|
34
|
+
mime.getType(asset.fileName || asset.uri) ||
|
|
35
|
+
(asset.duration ? 'video/*' : 'image/*'),
|
|
32
36
|
uri: asset.uri,
|
|
33
37
|
}));
|
|
34
38
|
return { assets, cancelled: false };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppState, Image, PermissionsAndroid, Platform } from 'react-native';
|
|
2
|
+
import mime from 'mime';
|
|
2
3
|
|
|
3
4
|
let ImagePicker;
|
|
4
5
|
|
|
@@ -46,7 +47,11 @@ export const takePhoto = ImagePicker
|
|
|
46
47
|
cancelled: true,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
+
const assetType =
|
|
51
|
+
asset.type ||
|
|
52
|
+
mime.getType(asset.fileName || asset.uri) ||
|
|
53
|
+
(mediaType === 'video' || asset.duration ? 'video/*' : 'image/*');
|
|
54
|
+
if (assetType.includes('video')) {
|
|
50
55
|
const clearFilter = new RegExp('[.:]', 'g');
|
|
51
56
|
const date = new Date().toISOString().replace(clearFilter, '_');
|
|
52
57
|
return {
|
|
@@ -55,7 +60,7 @@ export const takePhoto = ImagePicker
|
|
|
55
60
|
duration: asset.duration * 1000,
|
|
56
61
|
name: 'video_recording_' + date + '.' + asset.fileName.split('.').pop(),
|
|
57
62
|
size: asset.fileSize,
|
|
58
|
-
type:
|
|
63
|
+
type: assetType,
|
|
59
64
|
uri: asset.uri,
|
|
60
65
|
};
|
|
61
66
|
} else {
|
|
@@ -90,7 +95,7 @@ export const takePhoto = ImagePicker
|
|
|
90
95
|
cancelled: false,
|
|
91
96
|
name: 'image_' + date + '.' + asset.uri.split('.').pop(),
|
|
92
97
|
size: asset.fileSize,
|
|
93
|
-
type:
|
|
98
|
+
type: assetType,
|
|
94
99
|
uri: asset.uri,
|
|
95
100
|
...size,
|
|
96
101
|
};
|