stream-chat-react-native 7.0.0-rc.8 → 7.0.0
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
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://www.npmjs.com/package/stream-chat-react-native)
|
|
11
11
|
[](https://github.com/GetStream/stream-chat-react-native/actions)
|
|
12
12
|
[](https://getstream.io/chat/docs/sdk/reactnative)
|
|
13
|
-

|
|
14
14
|
|
|
15
15
|
<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
|
|
16
16
|
|
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": "7.0.0
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
6
6
|
"author": {
|
|
7
7
|
"company": "Stream.io Inc",
|
|
@@ -19,17 +19,18 @@
|
|
|
19
19
|
"main": "src/index.js",
|
|
20
20
|
"types": "types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"es6-symbol": "^3.1.
|
|
23
|
-
"
|
|
22
|
+
"es6-symbol": "^3.1.3",
|
|
23
|
+
"mime": "^4.0.7",
|
|
24
|
+
"stream-chat-react-native-core": "7.0.0"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"@react-native-camera-roll/camera-roll": ">=7.8.0",
|
|
27
28
|
"@react-native-clipboard/clipboard": ">=1.14.1",
|
|
29
|
+
"@react-native-documents/picker": ">=10.1.1",
|
|
28
30
|
"@stream-io/flat-list-mvcp": ">=0.10.3",
|
|
29
31
|
"react-native": ">=0.71.0",
|
|
30
32
|
"react-native-audio-recorder-player": ">=3.6.4",
|
|
31
33
|
"react-native-blob-util": ">=0.19.9",
|
|
32
|
-
"@react-native-documents/picker": ">=10.1.1",
|
|
33
34
|
"react-native-haptic-feedback": ">=2.2.0",
|
|
34
35
|
"react-native-image-picker": ">=7.1.2",
|
|
35
36
|
"react-native-share": ">=10.2.1",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PermissionsAndroid, Platform } from 'react-native';
|
|
2
|
+
import mime from 'mime';
|
|
3
|
+
|
|
4
|
+
import type { File } from 'stream-chat-react-native-core';
|
|
2
5
|
|
|
3
6
|
let CameraRollDependency;
|
|
4
7
|
|
|
@@ -11,12 +14,10 @@ try {
|
|
|
11
14
|
);
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
import type { Asset } from 'stream-chat-react-native-core';
|
|
15
|
-
|
|
16
17
|
import { getLocalAssetUri } from './getLocalAssetUri';
|
|
17
18
|
|
|
18
19
|
type ReturnType = {
|
|
19
|
-
assets:
|
|
20
|
+
assets: File[];
|
|
20
21
|
endCursor: string | undefined;
|
|
21
22
|
hasNextPage: boolean;
|
|
22
23
|
iOSLimited: boolean;
|
|
@@ -90,16 +91,22 @@ export const getPhotos = CameraRollDependency
|
|
|
90
91
|
const assets = await Promise.all(
|
|
91
92
|
results.edges.map(async (edge) => {
|
|
92
93
|
const originalUri = edge.node?.image?.uri;
|
|
93
|
-
const
|
|
94
|
+
const type =
|
|
95
|
+
Platform.OS === 'ios'
|
|
96
|
+
? mime.getType(edge.node.image.filename as string)
|
|
97
|
+
: edge.node.type;
|
|
98
|
+
const isImage = type.includes('image');
|
|
99
|
+
|
|
100
|
+
const uri =
|
|
101
|
+
isImage && getLocalAssetUri ? await getLocalAssetUri(originalUri) : originalUri;
|
|
102
|
+
|
|
94
103
|
return {
|
|
95
104
|
...edge.node.image,
|
|
96
|
-
duration: edge.node.image.playableDuration * 1000,
|
|
97
|
-
// since we include filename, fileSize in the query, we can safely assume it will be defined
|
|
98
105
|
name: edge.node.image.filename as string,
|
|
99
|
-
|
|
106
|
+
duration: edge.node.image.playableDuration * 1000,
|
|
107
|
+
thumb_url: isImage ? undefined : originalUri,
|
|
100
108
|
size: edge.node.image.fileSize as number,
|
|
101
|
-
|
|
102
|
-
type: edge.node.type,
|
|
109
|
+
type,
|
|
103
110
|
uri,
|
|
104
111
|
};
|
|
105
112
|
}),
|
|
@@ -26,11 +26,10 @@ export const pickImage = ImagePicker
|
|
|
26
26
|
duration: asset.duration ? asset.duration * 1000 : undefined, // in milliseconds
|
|
27
27
|
name: asset.fileName,
|
|
28
28
|
size: asset.fileSize,
|
|
29
|
-
source: 'picker',
|
|
30
29
|
type: asset.type,
|
|
31
30
|
uri: asset.uri,
|
|
32
31
|
}));
|
|
33
|
-
return { assets, cancelled: false
|
|
32
|
+
return { assets, cancelled: false };
|
|
34
33
|
} else {
|
|
35
34
|
return { cancelled: true };
|
|
36
35
|
}
|
|
@@ -53,10 +53,8 @@ export const takePhoto = ImagePicker
|
|
|
53
53
|
...asset,
|
|
54
54
|
cancelled: false,
|
|
55
55
|
duration: asset.duration * 1000,
|
|
56
|
-
mimeType: asset.type,
|
|
57
56
|
name: 'video_recording_' + date + '.' + asset.fileName.split('.').pop(),
|
|
58
57
|
size: asset.fileSize,
|
|
59
|
-
source: 'camera',
|
|
60
58
|
type: asset.type,
|
|
61
59
|
uri: asset.uri,
|
|
62
60
|
};
|
|
@@ -90,10 +88,8 @@ export const takePhoto = ImagePicker
|
|
|
90
88
|
const date = new Date().toISOString().replace(clearFilter, '_');
|
|
91
89
|
return {
|
|
92
90
|
cancelled: false,
|
|
93
|
-
mimeType: asset.type,
|
|
94
91
|
name: 'video_recording_' + date + '.' + asset.fileName.split('.').pop(),
|
|
95
92
|
size: asset.size,
|
|
96
|
-
source: 'camera',
|
|
97
93
|
type: asset.type,
|
|
98
94
|
uri: asset.uri,
|
|
99
95
|
...size,
|