stream-chat-react-native 6.7.5-beta.1 → 7.0.0-beta.1
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": "
|
|
4
|
+
"version": "7.0.0-beta.1",
|
|
5
5
|
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
6
6
|
"author": {
|
|
7
7
|
"company": "Stream.io Inc",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"types": "types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"es6-symbol": "^3.1.3",
|
|
23
|
-
"
|
|
23
|
+
"mime": "^4.0.7",
|
|
24
|
+
"stream-chat-react-native-core": "7.0.0-beta.1"
|
|
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
|
-
"react-native": ">=0.
|
|
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-document-picker": ">=9.3.0",
|
|
33
|
-
"@react-native-documents/picker": ">=10.1.1",
|
|
34
34
|
"react-native-haptic-feedback": ">=2.2.0",
|
|
35
35
|
"react-native-image-picker": ">=7.1.2",
|
|
36
36
|
"react-native-share": ">=10.2.1",
|
|
@@ -49,9 +49,6 @@
|
|
|
49
49
|
"react-native-share": {
|
|
50
50
|
"optional": true
|
|
51
51
|
},
|
|
52
|
-
"react-native-document-picker": {
|
|
53
|
-
"optional": true
|
|
54
|
-
},
|
|
55
52
|
"@react-native-documents/picker": {
|
|
56
53
|
"optional": true
|
|
57
54
|
},
|
|
@@ -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
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types are approximated from what we need from the DocumentPicker API.
|
|
3
3
|
*
|
|
4
|
-
* For its full API, see https://github.com/
|
|
4
|
+
* For its full API, see https://github.com/react-native-documents/document-picker/blob/main/packages/document-picker/src/index.ts
|
|
5
5
|
* */
|
|
6
6
|
type ResponseValue = {
|
|
7
7
|
name: string;
|
|
@@ -19,31 +19,12 @@ type DocumentPickerType =
|
|
|
19
19
|
|
|
20
20
|
let DocumentPicker: DocumentPickerType;
|
|
21
21
|
|
|
22
|
-
let OldDocumentPicker: DocumentPickerType;
|
|
23
|
-
let NewDocumentPicker: DocumentPickerType;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
NewDocumentPicker = require('@react-native-documents/picker');
|
|
27
|
-
} catch (err) {
|
|
28
|
-
// we log below
|
|
29
|
-
}
|
|
30
|
-
|
|
31
22
|
try {
|
|
32
|
-
|
|
23
|
+
DocumentPicker = require('@react-native-documents/picker');
|
|
33
24
|
} catch (err) {
|
|
34
|
-
//
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (NewDocumentPicker) {
|
|
38
|
-
DocumentPicker = NewDocumentPicker;
|
|
39
|
-
} else if (OldDocumentPicker) {
|
|
40
|
-
DocumentPicker = OldDocumentPicker;
|
|
41
|
-
console.log(
|
|
42
|
-
"You're using the react-native-document-picker library, which is no longer supported and has moved to @react-native-documents/picker. Things might not work as intended. Please migrate to the new library as soon as possible !",
|
|
43
|
-
);
|
|
44
|
-
} else {
|
|
25
|
+
// do nothing
|
|
45
26
|
console.log(
|
|
46
|
-
'
|
|
27
|
+
'The @react-native-documents/picker is not installed. Installing it will enable you to pick and upload files from within your app.',
|
|
47
28
|
);
|
|
48
29
|
}
|
|
49
30
|
|
|
@@ -62,9 +43,9 @@ export const pickDocument = DocumentPicker
|
|
|
62
43
|
|
|
63
44
|
return {
|
|
64
45
|
assets: res.map(({ name, size, type, uri }) => ({
|
|
65
|
-
mimeType: type,
|
|
66
46
|
name,
|
|
67
47
|
size,
|
|
48
|
+
type,
|
|
68
49
|
uri,
|
|
69
50
|
})),
|
|
70
51
|
cancelled: false,
|
|
@@ -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,
|